summaryrefslogtreecommitdiff
path: root/lib/Data/Packed/Internal/auxi.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Data/Packed/Internal/auxi.c')
-rw-r--r--lib/Data/Packed/Internal/auxi.c39
1 files changed, 38 insertions, 1 deletions
diff --git a/lib/Data/Packed/Internal/auxi.c b/lib/Data/Packed/Internal/auxi.c
index b53d9b7..7f83bcf 100644
--- a/lib/Data/Packed/Internal/auxi.c
+++ b/lib/Data/Packed/Internal/auxi.c
@@ -125,11 +125,26 @@ int multiplyR(int ta, KRMAT(a), int tb, KRMAT(b),RMAT(r)) {
125 KDMVIEW(a); 125 KDMVIEW(a);
126 KDMVIEW(b); 126 KDMVIEW(b);
127 DMVIEW(r); 127 DMVIEW(r);
128 int k;
129 for(k=0;k<rr*rc;k++) rp[k]=0;
130 int debug = 0;
131 if(debug) {
132 printf("---------------------------\n");
133 printf("%p: ",ap); for(k=0;k<ar*ac;k++) printf("%f ",ap[k]); printf("\n");
134 printf("%p: ",bp); for(k=0;k<br*bc;k++) printf("%f ",bp[k]); printf("\n");
135 printf("%p: ",rp); for(k=0;k<rr*rc;k++) printf("%f ",rp[k]); printf("\n");
136 }
128 int res = gsl_blas_dgemm( 137 int res = gsl_blas_dgemm(
129 ta?CblasTrans:CblasNoTrans, 138 ta?CblasTrans:CblasNoTrans,
130 tb?CblasTrans:CblasNoTrans, 139 tb?CblasTrans:CblasNoTrans,
131 1.0, M(a), M(b), 140 1.0, M(a), M(b),
132 0.0, M(r)); 141 0.0, M(r));
142 if(debug) {
143 printf("--------------\n");
144 printf("%p: ",ap); for(k=0;k<ar*ac;k++) printf("%f ",ap[k]); printf("\n");
145 printf("%p: ",bp); for(k=0;k<br*bc;k++) printf("%f ",bp[k]); printf("\n");
146 printf("%p: ",rp); for(k=0;k<rr*rc;k++) printf("%f ",rp[k]); printf("\n");
147 }
133 CHECK(res,res); 148 CHECK(res,res);
134 OK 149 OK
135} 150}
@@ -140,14 +155,36 @@ int multiplyC(int ta, KCMAT(a), int tb, KCMAT(b),CMAT(r)) {
140 KCMVIEW(a); 155 KCMVIEW(a);
141 KCMVIEW(b); 156 KCMVIEW(b);
142 CMVIEW(r); 157 CMVIEW(r);
158 int k;
143 gsl_complex alpha, beta; 159 gsl_complex alpha, beta;
144 GSL_SET_COMPLEX(&alpha,1.,0.); 160 GSL_SET_COMPLEX(&alpha,1.,0.);
145 GSL_SET_COMPLEX(&beta,0.,0.); 161 GSL_SET_COMPLEX(&beta,0.,0.);
162 //double *TEMP = (double*)malloc(rr*rc*2*sizeof(double));
163 //gsl_matrix_complex_view T = gsl_matrix_complex_view_array(TEMP,rr,rc);
164 for(k=0;k<rr*rc;k++) rp[k]=beta;
165 //for(k=0;k<2*rr*rc;k++) TEMP[k]=0;
166 int debug = 0;
167 if(debug) {
168 printf("---------------------------\n");
169 printf("%p: ",ap); for(k=0;k<2*ar*ac;k++) printf("%f ",((double*)ap)[k]); printf("\n");
170 printf("%p: ",bp); for(k=0;k<2*br*bc;k++) printf("%f ",((double*)bp)[k]); printf("\n");
171 printf("%p: ",rp); for(k=0;k<2*rr*rc;k++) printf("%f ",((double*)rp)[k]); printf("\n");
172 //printf("%p: ",T); for(k=0;k<2*rr*rc;k++) printf("%f ",TEMP[k]); printf("\n");
173 }
146 int res = gsl_blas_zgemm( 174 int res = gsl_blas_zgemm(
147 ta?CblasTrans:CblasNoTrans, 175 ta?CblasTrans:CblasNoTrans,
148 tb?CblasTrans:CblasNoTrans, 176 tb?CblasTrans:CblasNoTrans,
149 alpha, M(a), M(b), 177 alpha, M(a), M(b),
150 beta, M(r)); 178 beta, M(r));
179 //&T.matrix);
180 //memcpy(rp,TEMP,2*rr*rc*sizeof(double));
181 if(debug) {
182 printf("--------------\n");
183 printf("%p: ",ap); for(k=0;k<2*ar*ac;k++) printf("%f ",((double*)ap)[k]); printf("\n");
184 printf("%p: ",bp); for(k=0;k<2*br*bc;k++) printf("%f ",((double*)bp)[k]); printf("\n");
185 printf("%p: ",rp); for(k=0;k<2*rr*rc;k++) printf("%f ",((double*)rp)[k]); printf("\n");
186 //printf("%p: ",T); for(k=0;k<2*rr*rc;k++) printf("%f ",TEMP[k]); printf("\n");
187 }
151 CHECK(res,res); 188 CHECK(res,res);
152 OK 189 OK
153} 190}