Open In App

Ruby | Vector covector() function

Last Updated : 07 Jan, 2020
Comments
Improve
Suggest changes
Like Article
Like
Report
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: CPP
#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: CPP
#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]]

Next Article

Similar Reads