home *** CD-ROM | disk | FTP | other *** search
- matmul(lra,lrb,lrc,i,j,k,a,b,c)
-
- /*this function performs the multiplication of two*/
- /*two-dimensional matrices: c(i,k)=a(i,j)*b(j,k) */
-
- float a[],b[],c[];
- int lra,lrb,lrc,i,j,k;
-
- {
- int l,lm,ln,m,n,nm;
-
- for(l = 0; l <= i-1; l++) /* rows of a */
- {
- lm = l * lrc;
- for(m = 0; m <= k-1; m++) /* cols of b */
- {
- ln = l * lra;
- nm = m;
- c[lm] = 0.0;
- for(n = 0; n <= j - 1; n++) /* cols of a */
- {
- c[lm] += a[ln]*b[nm]; /* c[l,m] += a[l,n]*b[n,m] */
- nm += lrb; /* advance 1 row in B */
- ln++; /* advance 1 col in A */
- } /* end of n loop */
- lm++; /* advance 1 col in C */
- } /* end of m loop */
- } /* end of l loop */
- }
-