Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. void version1(int mat1[N][N], int mat2[N][N], int result[N][N])
  2. {
  3. int i, j, k;
  4. for (i = 0; i < N; ++i)
  5. {
  6. for (j = 0; j < N; ++j)
  7. {
  8. // Compute the value for result[i][j]. Initialize it to 0, then
  9. result[i][j] = result[0][0];
  10. // run through row i of mat1 and column j of mat2 in parallel and
  11. // multiply their elements pairwise and sum up the products.
  12.  
  13. for (k = 0; k < N; ++k)
  14. result[i][j] += mat1[i][k] * mat2[k][j];
  15. }
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement