Matrix multiplication: Difference between revisions
Content added Content deleted
m (→{{header|C}}) |
m (→{{header|C}}) |
||
Line 1,098: | Line 1,098: | ||
typedef const double * const MAT_IN_t; |
typedef const double * const MAT_IN_t; |
||
static inline void |
static inline void mat_mult( |
||
const int m, |
const int m, |
||
const int n, |
const int n, |
||
Line 1,119: | Line 1,119: | ||
const int m, |
const int m, |
||
const int p, |
const int p, |
||
MAT_IN_t |
MAT_IN_t a) |
||
{ |
{ |
||
for (int row=0; row<m;row++) { |
for (int row=0; row<m;row++) { |
||
for (int col=0; col<p;col++) { |
for (int col=0; col<p;col++) { |
||
printf("\t%7.3f", |
printf("\t%7.3f", a[MAT_ELEM(m,p,row,col)]); |
||
} |
} |
||
putchar('\n'); |
putchar('\n'); |
||
Line 1,143: | Line 1,143: | ||
double c[4*3] = {0}; |
double c[4*3] = {0}; |
||
mat_mult(4,4,3,a,b,c); |
|||
mat_show(4,3,c); |
mat_show(4,3,c); |
||
return 0; |
return 0; |