Ruby | Matrix hash() function
Last Updated :
14 Sep, 2021
The hash() is an inbuilt method in Ruby returns the hash-code of the matrix.
Syntax: mat1.hash()
Parameters: The function does not accepts any parameter.
Return Value: It returns the hash-code of the matrix.
Example 1:
Ruby
require "matrix"
mat1 = Matrix[[ 12 , 21 ], [ 31 , 12 ]]
puts mat1.hash()
|
Output:
631900695216402634
Example 2:
Ruby
require "matrix"
mat1 = Matrix[[ 6 , 7 ], [ 9 , 10 ], [ 12 , 4 ]]
puts mat1.hash()
|
Output:
-1308023948917233670]
Share your thoughts in the comments
Please Login to comment...