root / synthbench / euroben-ports / base / C-MPI / mod2am / .svn / text-base / mxm.c.svn-base @ 0:839f52ef7657
History | View | Annotate | Download (908 Bytes)
1 |
void mxm( int lda, int m, int l, int n, double **a, double **b, |
---|---|
2 |
double **c ) |
3 |
// --------------------------------------------------------------------- |
4 |
// --- Routine 'mxm' does a matrix-matrix multiplication 'AB = C' |
5 |
// using an dotproduct implementation. |
6 |
// --------------------------------------------------------------------- |
7 |
{ |
8 |
int i, j, k, lf; |
9 |
// --------------------------------------------------------------------- |
10 |
lf = l - l%4; |
11 |
for( i = 0 ; i < m; i++ ) { |
12 |
for( j = 0; j < lf; j+= 4 ) { |
13 |
for( k = 0; k < n; k++ ) { |
14 |
c[i][k] = c[i][k] + a[i][j] *b[j][k] + a[i][j+1]*b[j+1][k] |
15 |
+ a[i][j+2]*b[j+2][k] + a[i][j+3]*b[j+3][k]; |
16 |
} |
17 |
} |
18 |
} |
19 |
for( i = 0 ; i < m; i++ ){ |
20 |
for( j = lf; j < l; j++ ) { |
21 |
for( k = 0; k < n; k++ ) { |
22 |
c[i][k] = c[i][k] + a[i][j]*b[j][k]; |
23 |
} |
24 |
} |
25 |
} |
26 |
} |