Ruby | Matrix hash() function
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 program for hash() method in Matrix # Include matrix require "matrix" # Initilizes the matrix mat1 = Matrix[[ 12 , 21 ], [ 31 , 12 ]] # Prints the hash-code puts mat1.hash() |
chevron_right
filter_none
Output:
631900695216402634
Example 2:
# Ruby program for hash() method in Matrix # Include matrix require "matrix" # Initilizes the matrix mat1 = Matrix[[ 6 , 7 ], [ 9 , 10 ], [ 12 , 4 ]] # Prints the hash-code puts mat1.hash() |
chevron_right
filter_none
Output:
-1308023948917233670]
Recommended Posts:
- Ruby | Hash each() function
- Ruby | Hash key() function
- Ruby | Hash key?() function
- Ruby | Hash dig() function
- Ruby | Hash eql? function
- Ruby | Hash any?() function
- Ruby | Hash each_key() function
- Ruby | Vector hash() function
- Ruby | Hash each_key function
- Ruby | Hash clear() function
- Ruby | Hash assoc() function
- Ruby | Range hash() function
- Ruby | Hash values function
- Ruby | Hash empty? function
- Ruby | Hash inspect() function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.