ALGORITHM :(Matrix Multiplication) MATMULTI(X,Y,Z,P,Q,R)
Here X is a matrix array of P*Q and Y is a matrix array of Q*R .This algorithm stores the product of X and Y in matrix Z of order P*R.
1.Repeat steps 2,3 and 4 for I=1 to P.
2.Repeat steps 3 and 4 for J=1 to R.
3.Set Z[I,J]=0.
4.Repeat for K=1 to Q.
Z[I,J]=Z[I,J]+X[I,K]*Y[K,J]
[End Of Step 4 Inner Loop.]
[End Of Step 2 Middle Loop.]
[End Of Step 1 Outer Loop.]
5.Exit.
Here X is a matrix array of P*Q and Y is a matrix array of Q*R .This algorithm stores the product of X and Y in matrix Z of order P*R.
1.Repeat steps 2,3 and 4 for I=1 to P.
2.Repeat steps 3 and 4 for J=1 to R.
3.Set Z[I,J]=0.
4.Repeat for K=1 to Q.
Z[I,J]=Z[I,J]+X[I,K]*Y[K,J]
[End Of Step 4 Inner Loop.]
[End Of Step 2 Middle Loop.]
[End Of Step 1 Outer Loop.]
5.Exit.
If you have any suggestions regarding this post, please comment below in the comment section.
No comments