Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void version1(int mat1[N][N], int mat2[N][N], int result[N][N])
- {
- int i, j, k;
- for (i = 0; i < N; ++i)
- {
- for (j = 0; j < N; ++j)
- {
- // Compute the value for result[i][j]. Initialize it to 0, then
- result[i][j] = result[0][0];
- // run through row i of mat1 and column j of mat2 in parallel and
- // multiply their elements pairwise and sum up the products.
- for (k = 0; k < N; ++k)
- result[i][j] += mat1[i][k] * mat2[k][j];
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement