Skip to content
Related Articles

Related Articles

Save Article
Improve Article
Save Article
Like Article

Ruby | Vector covector() function

  • Last Updated : 07 Jan, 2020

The covector() is an inbuilt method in Ruby returns a single-row matrix created using vector

Syntax: vec1.covector()

Parameters: The function accepts no parameter

Return Value: It returns a single-row matrix created using vector

Example 1:






#Ruby program for covector() method in Vector
  
#Include matrix
require "matrix"
  
#Initialize the vector
    vec1
    = Vector[1, 2]
  
#Prints single - row matrix
      puts vec1.covector()

Output:

Matrix[[1, 2]]

Example 2:




#Ruby program for covector() method in Vector
  
#Include matrix
require "matrix"
  
#Initialize the vector
    vec1
    = Vector[1, 2, 3]
  
#Prints single - row matrix
      puts vec1.covector()

Output:

Matrix[[1, 2, 3]]
My Personal Notes arrow_drop_up
Recommended Articles
Page :