Last active
June 28, 2023 05:02
-
-
Save zainabnazari/d98770fc3e1565b6150a20edbac11a3f to your computer and use it in GitHub Desktop.
hash value function for a matrix multiplication
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// C[] is the elements of matrix multiplication | |
// we consider the hash value as zero and add the sum of the elemnt of the matrix as its value | |
// if the two matrices that we have computed have diffrent hash value then there would be an error in the computation of the matrics. | |
int hash_value = 0; | |
int i_m; | |
for( i_m = 0; i_m < N*N; i_m++) { | |
hash_value += C[i_m]; | |
} | |
// taking a modulo to shorten the final result. | |
hash_value %= 100000007; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment