The
orthogonal?()
is an inbuilt method in
Rubyreturns a boolean value. It returns true if it is a orthogonal matrix, else it returns false. It returns error if anything other than square matrix is used.
Syntax: mat1.orthogonal?() Parameters: The function needs the matrix to be checked for orthogonal matrix or not. Return Value: It returns true if it is a orthogonal matrix, else it returns false.
Example 1
:
#Ruby program for orthogonal ? () method in Matrix
#Include matrix
require "matrix"
#Initialize a matrix
mat1
= Matrix[[ 1, 21 ], [ 31, 18 ]]
#Prints if orthogonal ? or not
puts mat1.orthogonal
? ()
Output
:
false
Example 2
:
#Ruby program for orthogonal ? () method in Matrix
#Include matrix
require "matrix"
#Initialize a matrix
mat1
= Matrix[[ 1, 0 ], [ 0, 1 ]]
#Prints if orthogonal ? or not
puts mat1.orthogonal
? ()
Output
:
true