28 #ifndef _math_scmat_mops_h
29 #define _math_scmat_mops_h
37 copy_block(
double **dest,
double **source,
38 int istart,
int ni,
int jstart,
int nj)
42 for (ii=0; ii < ni; ii++) {
43 double *di = dest[ii];
44 double *si = &source[istart+ii][jstart];
45 for (jj=0; jj < nj; jj++)
53 memset(dest[ii], 0,
sizeof(
double)*left*D1);
57 copy_trans_block(
double **dest,
double **source,
58 int istart,
int ni,
int jstart,
int nj)
62 memset(dest[0], 0,
sizeof(
double)*D1*D1);
64 for (jj=0; jj < nj; jj++) {
65 double *sj = &source[jstart+jj][istart];
66 for (ii=0; ii < ni; ii++)
67 dest[ii][jj] = sj[ii];
74 copy_sym_block(
double **dest,
double **source,
75 int istart,
int ni,
int jstart,
int nj)
79 for (ii=0; ii < ni; ii++) {
80 double *di = dest[ii];
81 double *si = &source[istart+ii][jstart];
84 for (jj=0; jj < nj; jj++)
86 else if (jstart==istart)
87 for (jj=0; jj <= ii; jj++)
88 di[jj] = dest[jj][ii] = si[jj];
90 for (jj=0; jj < nj; jj++)
91 di[jj] = source[jstart+jj][istart+ii];
93 for (jj=nj; jj < D1; jj++)
99 memset(dest[ii], 0,
sizeof(
double)*left*D1);
103 return_block(
double **dest,
double **source,
104 int istart,
int ni,
int jstart,
int nj)
108 for (ii=0; ii < ni; ii++)
109 for (jj=0; jj < nj; jj++)
110 dest[istart+ii][jstart+jj] = source[ii][jj];
115 mult_block(
double **a,
double **b,
double **c,
int ni,
int nj,
int nk)
118 double t00,t10,t20,t30;
119 double *a0, *a1, *a2, *a3;
120 double *c0, *c1, *c2, *c3;
122 for (ii=0; ii < ni; ii += 4) {
123 a0=a[ii]; a1=a[ii+1]; a2=a[ii+2]; a3=a[ii+3];
124 c0=c[ii]; c1=c[ii+1]; c2=c[ii+2]; c3=c[ii+3];
126 for (jj=0; jj < nj; jj++) {
128 t00=c0[jj]; t10=c1[jj]; t20=c2[jj]; t30=c3[jj];
130 for (kk=0; kk < nk; kk += 2) {
131 double b0=bt[kk], b1=bt[kk+1];
132 t00 += a0[kk]*b0 + a0[kk+1]*b1;
133 t10 += a1[kk]*b0 + a1[kk+1]*b1;
134 t20 += a2[kk]*b0 + a2[kk+1]*b1;
135 t30 += a3[kk]*b0 + a3[kk+1]*b1;