CECS 282
LAB ASSIGNMENT 5
Assigned date: 2/23
Due date: Thu 3/2
10 points
1. Write a program that reads two matrices and determines their product matrix.
For example:
1 2 3 1 2 3 4 5
M1 = and M2 = 2 5 3 1 4
3 2 1 5 4 3 2 1
then
20 24 18 12 16
P =
12 20 18 16 24
Requirements:
Hint:
void mulmatrix(float *matrix1, int rows1, int cols1, float *matrix2, int cols2, float *product)
{int i, j, k;
for (i = 0; ________________ )
for(j=0;________________ )
{
for(k = 0, *product = 0;________________________)
/* p[i,j] += m1[i,k] * m2[k j]*/
*product += matrix1[_____________] * matrix2[_________________];
product++;
}
}
GRADING