diff options
author | Alberto Ruiz <aruiz@um.es> | 2010-09-11 10:35:56 +0000 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2010-09-11 10:35:56 +0000 |
commit | 84a5ee4fb1b2185eabf64b761279b4da313bd207 (patch) | |
tree | 90d3d831fad68d71c5f544eacb3315bed07443be | |
parent | ec9965371be5b37234684ba392f55a1a1e24f053 (diff) |
removed lapack-aux redundant casts
-rw-r--r-- | lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c | 137 | ||||
-rw-r--r-- | lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.h | 22 |
2 files changed, 82 insertions, 77 deletions
diff --git a/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c b/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c index 2c4c647..09979cd 100644 --- a/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c +++ b/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c | |||
@@ -187,9 +187,9 @@ int svd_l_C(KCMAT(a),CMAT(u), DVEC(s),CMAT(v)) { | |||
187 | ldvt = q; | 187 | ldvt = q; |
188 | } | 188 | } |
189 | }DEBUGMSG("svd_l_C"); | 189 | }DEBUGMSG("svd_l_C"); |
190 | double *B = (double*)malloc(2*m*n*sizeof(double)); | 190 | doublecomplex *B = (doublecomplex*)malloc(m*n*sizeof(doublecomplex)); |
191 | CHECK(!B,MEM); | 191 | CHECK(!B,MEM); |
192 | memcpy(B,ap,m*n*2*sizeof(double)); | 192 | memcpy(B,ap,m*n*sizeof(doublecomplex)); |
193 | 193 | ||
194 | double *rwork = (double*) malloc(5*q*sizeof(double)); | 194 | double *rwork = (double*) malloc(5*q*sizeof(double)); |
195 | CHECK(!rwork,MEM); | 195 | CHECK(!rwork,MEM); |
@@ -198,21 +198,21 @@ int svd_l_C(KCMAT(a),CMAT(u), DVEC(s),CMAT(v)) { | |||
198 | // ask for optimal lwork | 198 | // ask for optimal lwork |
199 | doublecomplex ans; | 199 | doublecomplex ans; |
200 | zgesvd_ (jobu,jobvt, | 200 | zgesvd_ (jobu,jobvt, |
201 | &m,&n,(doublecomplex*)B,&m, | 201 | &m,&n,B,&m, |
202 | sp, | 202 | sp, |
203 | (doublecomplex*)up,&m, | 203 | up,&m, |
204 | (doublecomplex*)vp,&ldvt, | 204 | vp,&ldvt, |
205 | &ans, &lwork, | 205 | &ans, &lwork, |
206 | rwork, | 206 | rwork, |
207 | &res); | 207 | &res); |
208 | lwork = ceil(ans.r); | 208 | lwork = ceil(ans.r); |
209 | doublecomplex * work = (doublecomplex*)malloc(lwork*2*sizeof(double)); | 209 | doublecomplex * work = (doublecomplex*)malloc(lwork*sizeof(doublecomplex)); |
210 | CHECK(!work,MEM); | 210 | CHECK(!work,MEM); |
211 | zgesvd_ (jobu,jobvt, | 211 | zgesvd_ (jobu,jobvt, |
212 | &m,&n,(doublecomplex*)B,&m, | 212 | &m,&n,B,&m, |
213 | sp, | 213 | sp, |
214 | (doublecomplex*)up,&m, | 214 | up,&m, |
215 | (doublecomplex*)vp,&ldvt, | 215 | vp,&ldvt, |
216 | work, &lwork, | 216 | work, &lwork, |
217 | rwork, | 217 | rwork, |
218 | &res); | 218 | &res); |
@@ -267,12 +267,12 @@ int svd_l_Cdd(KCMAT(a),CMAT(u), DVEC(s),CMAT(v)) { | |||
267 | integer res; | 267 | integer res; |
268 | // ask for optimal lwk | 268 | // ask for optimal lwk |
269 | doublecomplex ans; | 269 | doublecomplex ans; |
270 | zgesdd_ (jobz,&m,&n,B,&m,sp,(doublecomplex*)up,&m,(doublecomplex*)vp,&ldvt,&ans,&lwk,rwk,iwk,&res); | 270 | zgesdd_ (jobz,&m,&n,B,&m,sp,up,&m,vp,&ldvt,&ans,&lwk,rwk,iwk,&res); |
271 | lwk = ans.r; | 271 | lwk = ans.r; |
272 | //printf("lwk = %ld\n",lwk); | 272 | //printf("lwk = %ld\n",lwk); |
273 | doublecomplex * workv = (doublecomplex*)malloc(lwk*sizeof(doublecomplex)); | 273 | doublecomplex * workv = (doublecomplex*)malloc(lwk*sizeof(doublecomplex)); |
274 | CHECK(!workv,MEM); | 274 | CHECK(!workv,MEM); |
275 | zgesdd_ (jobz,&m,&n,B,&m,sp,(doublecomplex*)up,&m,(doublecomplex*)vp,&ldvt,workv,&lwk,rwk,iwk,&res); | 275 | zgesdd_ (jobz,&m,&n,B,&m,sp,up,&m,vp,&ldvt,workv,&lwk,rwk,iwk,&res); |
276 | //printf("res = %ld\n",res); | 276 | //printf("res = %ld\n",res); |
277 | CHECK(res,res); | 277 | CHECK(res,res); |
278 | free(workv); // printf("freed workv\n"); | 278 | free(workv); // printf("freed workv\n"); |
@@ -303,10 +303,10 @@ int eig_l_C(KCMAT(a), CMAT(u), CVEC(s),CMAT(v)) { | |||
303 | doublecomplex ans; | 303 | doublecomplex ans; |
304 | //printf("ask zgeev\n"); | 304 | //printf("ask zgeev\n"); |
305 | zgeev_ (&jobvl,&jobvr, | 305 | zgeev_ (&jobvl,&jobvr, |
306 | &n,(doublecomplex*)B,&n, | 306 | &n,B,&n, |
307 | (doublecomplex*)sp, | 307 | sp, |
308 | (doublecomplex*)up,&n, | 308 | up,&n, |
309 | (doublecomplex*)vp,&n, | 309 | vp,&n, |
310 | &ans, &lwork, | 310 | &ans, &lwork, |
311 | rwork, | 311 | rwork, |
312 | &res); | 312 | &res); |
@@ -316,10 +316,10 @@ int eig_l_C(KCMAT(a), CMAT(u), CVEC(s),CMAT(v)) { | |||
316 | CHECK(!work,MEM); | 316 | CHECK(!work,MEM); |
317 | //printf("zgeev\n"); | 317 | //printf("zgeev\n"); |
318 | zgeev_ (&jobvl,&jobvr, | 318 | zgeev_ (&jobvl,&jobvr, |
319 | &n,(doublecomplex*)B,&n, | 319 | &n,B,&n, |
320 | (doublecomplex*)sp, | 320 | sp, |
321 | (doublecomplex*)up,&n, | 321 | up,&n, |
322 | (doublecomplex*)vp,&n, | 322 | vp,&n, |
323 | work, &lwork, | 323 | work, &lwork, |
324 | rwork, | 324 | rwork, |
325 | &res); | 325 | &res); |
@@ -352,7 +352,7 @@ int eig_l_R(KDMAT(a),DMAT(u), CVEC(s),DMAT(v)) { | |||
352 | //printf("ask dgeev\n"); | 352 | //printf("ask dgeev\n"); |
353 | dgeev_ (&jobvl,&jobvr, | 353 | dgeev_ (&jobvl,&jobvr, |
354 | &n,B,&n, | 354 | &n,B,&n, |
355 | sp, sp+n, | 355 | (double*)sp, (double*)sp+n, |
356 | up,&n, | 356 | up,&n, |
357 | vp,&n, | 357 | vp,&n, |
358 | &ans, &lwork, | 358 | &ans, &lwork, |
@@ -364,7 +364,7 @@ int eig_l_R(KDMAT(a),DMAT(u), CVEC(s),DMAT(v)) { | |||
364 | //printf("dgeev\n"); | 364 | //printf("dgeev\n"); |
365 | dgeev_ (&jobvl,&jobvr, | 365 | dgeev_ (&jobvl,&jobvr, |
366 | &n,B,&n, | 366 | &n,B,&n, |
367 | sp, sp+n, | 367 | (double*)sp, (double*)sp+n, |
368 | up,&n, | 368 | up,&n, |
369 | vp,&n, | 369 | vp,&n, |
370 | work, &lwork, | 370 | work, &lwork, |
@@ -429,7 +429,7 @@ int eig_l_H(int wantV,KCMAT(a),DVEC(s),CMAT(v)) { | |||
429 | doublecomplex ans; | 429 | doublecomplex ans; |
430 | //printf("ask zheev\n"); | 430 | //printf("ask zheev\n"); |
431 | zheev_ (&jobz,&uplo, | 431 | zheev_ (&jobz,&uplo, |
432 | &n,(doublecomplex*)vp,&n, | 432 | &n,vp,&n, |
433 | sp, | 433 | sp, |
434 | &ans, &lwork, | 434 | &ans, &lwork, |
435 | rwork, | 435 | rwork, |
@@ -439,7 +439,7 @@ int eig_l_H(int wantV,KCMAT(a),DVEC(s),CMAT(v)) { | |||
439 | doublecomplex * work = (doublecomplex*)malloc(lwork*sizeof(doublecomplex)); | 439 | doublecomplex * work = (doublecomplex*)malloc(lwork*sizeof(doublecomplex)); |
440 | CHECK(!work,MEM); | 440 | CHECK(!work,MEM); |
441 | zheev_ (&jobz,&uplo, | 441 | zheev_ (&jobz,&uplo, |
442 | &n,(doublecomplex*)vp,&n, | 442 | &n,vp,&n, |
443 | sp, | 443 | sp, |
444 | work, &lwork, | 444 | work, &lwork, |
445 | rwork, | 445 | rwork, |
@@ -483,15 +483,15 @@ int linearSolveC_l(KCMAT(a),KCMAT(b),CMAT(x)) { | |||
483 | integer nhrs = bc; | 483 | integer nhrs = bc; |
484 | REQUIRES(n>=1 && ar==ac && ar==br,BAD_SIZE); | 484 | REQUIRES(n>=1 && ar==ac && ar==br,BAD_SIZE); |
485 | DEBUGMSG("linearSolveC_l"); | 485 | DEBUGMSG("linearSolveC_l"); |
486 | double*AC = (double*)malloc(2*n*n*sizeof(double)); | 486 | doublecomplex*AC = (doublecomplex*)malloc(n*n*sizeof(doublecomplex)); |
487 | memcpy(AC,ap,2*n*n*sizeof(double)); | 487 | memcpy(AC,ap,n*n*sizeof(doublecomplex)); |
488 | memcpy(xp,bp,2*n*nhrs*sizeof(double)); | 488 | memcpy(xp,bp,n*nhrs*sizeof(doublecomplex)); |
489 | integer * ipiv = (integer*)malloc(n*sizeof(integer)); | 489 | integer * ipiv = (integer*)malloc(n*sizeof(integer)); |
490 | integer res; | 490 | integer res; |
491 | zgesv_ (&n,&nhrs, | 491 | zgesv_ (&n,&nhrs, |
492 | (doublecomplex*)AC, &n, | 492 | AC, &n, |
493 | ipiv, | 493 | ipiv, |
494 | (doublecomplex*)xp, &n, | 494 | xp, &n, |
495 | &res); | 495 | &res); |
496 | if(res>0) { | 496 | if(res>0) { |
497 | return SINGULAR; | 497 | return SINGULAR; |
@@ -527,12 +527,12 @@ int cholSolveC_l(KCMAT(a),KCMAT(b),CMAT(x)) { | |||
527 | integer nhrs = bc; | 527 | integer nhrs = bc; |
528 | REQUIRES(n>=1 && ar==ac && ar==br,BAD_SIZE); | 528 | REQUIRES(n>=1 && ar==ac && ar==br,BAD_SIZE); |
529 | DEBUGMSG("cholSolveC_l"); | 529 | DEBUGMSG("cholSolveC_l"); |
530 | memcpy(xp,bp,2*n*nhrs*sizeof(double)); | 530 | memcpy(xp,bp,n*nhrs*sizeof(doublecomplex)); |
531 | integer res; | 531 | integer res; |
532 | zpotrs_ ("U", | 532 | zpotrs_ ("U", |
533 | &n,&nhrs, | 533 | &n,&nhrs, |
534 | (doublecomplex*)ap, &n, | 534 | (doublecomplex*)ap, &n, |
535 | (doublecomplex*)xp, &n, | 535 | xp, &n, |
536 | &res); | 536 | &res); |
537 | CHECK(res,res); | 537 | CHECK(res,res); |
538 | OK | 538 | OK |
@@ -591,31 +591,30 @@ int linearSolveLSC_l(KCMAT(a),KCMAT(b),CMAT(x)) { | |||
591 | integer ldb = xr; | 591 | integer ldb = xr; |
592 | REQUIRES(m>=1 && n>=1 && ar==br && xr==MAX(m,n) && xc == bc, BAD_SIZE); | 592 | REQUIRES(m>=1 && n>=1 && ar==br && xr==MAX(m,n) && xc == bc, BAD_SIZE); |
593 | DEBUGMSG("linearSolveLSC_l"); | 593 | DEBUGMSG("linearSolveLSC_l"); |
594 | double*AC = (double*)malloc(2*m*n*sizeof(double)); | 594 | doublecomplex*AC = (doublecomplex*)malloc(m*n*sizeof(doublecomplex)); |
595 | memcpy(AC,ap,2*m*n*sizeof(double)); | 595 | memcpy(AC,ap,m*n*sizeof(doublecomplex)); |
596 | memcpy(AC,ap,2*m*n*sizeof(double)); | ||
597 | if (m>=n) { | 596 | if (m>=n) { |
598 | memcpy(xp,bp,2*m*nrhs*sizeof(double)); | 597 | memcpy(xp,bp,m*nrhs*sizeof(doublecomplex)); |
599 | } else { | 598 | } else { |
600 | int k; | 599 | int k; |
601 | for(k = 0; k<nrhs; k++) { | 600 | for(k = 0; k<nrhs; k++) { |
602 | memcpy(xp+2*ldb*k,bp+2*m*k,m*2*sizeof(double)); | 601 | memcpy(xp+ldb*k,bp+m*k,m*sizeof(doublecomplex)); |
603 | } | 602 | } |
604 | } | 603 | } |
605 | integer res; | 604 | integer res; |
606 | integer lwork = -1; | 605 | integer lwork = -1; |
607 | doublecomplex ans; | 606 | doublecomplex ans; |
608 | zgels_ ("N",&m,&n,&nrhs, | 607 | zgels_ ("N",&m,&n,&nrhs, |
609 | (doublecomplex*)AC,&m, | 608 | AC,&m, |
610 | (doublecomplex*)xp,&ldb, | 609 | xp,&ldb, |
611 | &ans,&lwork, | 610 | &ans,&lwork, |
612 | &res); | 611 | &res); |
613 | lwork = ceil(ans.r); | 612 | lwork = ceil(ans.r); |
614 | //printf("ans = %d\n",lwork); | 613 | //printf("ans = %d\n",lwork); |
615 | doublecomplex * work = (doublecomplex*)malloc(lwork*sizeof(doublecomplex)); | 614 | doublecomplex * work = (doublecomplex*)malloc(lwork*sizeof(doublecomplex)); |
616 | zgels_ ("N",&m,&n,&nrhs, | 615 | zgels_ ("N",&m,&n,&nrhs, |
617 | (doublecomplex*)AC,&m, | 616 | AC,&m, |
618 | (doublecomplex*)xp,&ldb, | 617 | xp,&ldb, |
619 | work,&lwork, | 618 | work,&lwork, |
620 | &res); | 619 | &res); |
621 | if(res>0) { | 620 | if(res>0) { |
@@ -695,16 +694,16 @@ int linearSolveSVDC_l(double rcond, KCMAT(a),KCMAT(b),CMAT(x)) { | |||
695 | integer ldb = xr; | 694 | integer ldb = xr; |
696 | REQUIRES(m>=1 && n>=1 && ar==br && xr==MAX(m,n) && xc == bc, BAD_SIZE); | 695 | REQUIRES(m>=1 && n>=1 && ar==br && xr==MAX(m,n) && xc == bc, BAD_SIZE); |
697 | DEBUGMSG("linearSolveSVDC_l"); | 696 | DEBUGMSG("linearSolveSVDC_l"); |
698 | double*AC = (double*)malloc(2*m*n*sizeof(double)); | 697 | doublecomplex*AC = (doublecomplex*)malloc(m*n*sizeof(doublecomplex)); |
699 | double*S = (double*)malloc(MIN(m,n)*sizeof(double)); | 698 | double*S = (double*)malloc(MIN(m,n)*sizeof(double)); |
700 | double*RWORK = (double*)malloc(5*MIN(m,n)*sizeof(double)); | 699 | double*RWORK = (double*)malloc(5*MIN(m,n)*sizeof(double)); |
701 | memcpy(AC,ap,2*m*n*sizeof(double)); | 700 | memcpy(AC,ap,m*n*sizeof(doublecomplex)); |
702 | if (m>=n) { | 701 | if (m>=n) { |
703 | memcpy(xp,bp,2*m*nrhs*sizeof(double)); | 702 | memcpy(xp,bp,m*nrhs*sizeof(doublecomplex)); |
704 | } else { | 703 | } else { |
705 | int k; | 704 | int k; |
706 | for(k = 0; k<nrhs; k++) { | 705 | for(k = 0; k<nrhs; k++) { |
707 | memcpy(xp+2*ldb*k,bp+2*m*k,m*2*sizeof(double)); | 706 | memcpy(xp+ldb*k,bp+m*k,m*sizeof(doublecomplex)); |
708 | } | 707 | } |
709 | } | 708 | } |
710 | integer res; | 709 | integer res; |
@@ -712,8 +711,8 @@ int linearSolveSVDC_l(double rcond, KCMAT(a),KCMAT(b),CMAT(x)) { | |||
712 | integer rank; | 711 | integer rank; |
713 | doublecomplex ans; | 712 | doublecomplex ans; |
714 | zgelss_ (&m,&n,&nrhs, | 713 | zgelss_ (&m,&n,&nrhs, |
715 | (doublecomplex*)AC,&m, | 714 | AC,&m, |
716 | (doublecomplex*)xp,&ldb, | 715 | xp,&ldb, |
717 | S, | 716 | S, |
718 | &rcond,&rank, | 717 | &rcond,&rank, |
719 | &ans,&lwork, | 718 | &ans,&lwork, |
@@ -723,8 +722,8 @@ int linearSolveSVDC_l(double rcond, KCMAT(a),KCMAT(b),CMAT(x)) { | |||
723 | //printf("ans = %d\n",lwork); | 722 | //printf("ans = %d\n",lwork); |
724 | doublecomplex * work = (doublecomplex*)malloc(lwork*sizeof(doublecomplex)); | 723 | doublecomplex * work = (doublecomplex*)malloc(lwork*sizeof(doublecomplex)); |
725 | zgelss_ (&m,&n,&nrhs, | 724 | zgelss_ (&m,&n,&nrhs, |
726 | (doublecomplex*)AC,&m, | 725 | AC,&m, |
727 | (doublecomplex*)xp,&ldb, | 726 | xp,&ldb, |
728 | S, | 727 | S, |
729 | &rcond,&rank, | 728 | &rcond,&rank, |
730 | work,&lwork, | 729 | work,&lwork, |
@@ -750,14 +749,14 @@ int chol_l_H(KCMAT(a),CMAT(l)) { | |||
750 | memcpy(lp,ap,n*n*sizeof(doublecomplex)); | 749 | memcpy(lp,ap,n*n*sizeof(doublecomplex)); |
751 | char uplo = 'U'; | 750 | char uplo = 'U'; |
752 | integer res; | 751 | integer res; |
753 | zpotrf_ (&uplo,&n,(doublecomplex*)lp,&n,&res); | 752 | zpotrf_ (&uplo,&n,lp,&n,&res); |
754 | CHECK(res>0,NODEFPOS); | 753 | CHECK(res>0,NODEFPOS); |
755 | CHECK(res,res); | 754 | CHECK(res,res); |
756 | doublecomplex zero = {0.,0.}; | 755 | doublecomplex zero = {0.,0.}; |
757 | int r,c; | 756 | int r,c; |
758 | for (r=0; r<lr-1; r++) { | 757 | for (r=0; r<lr-1; r++) { |
759 | for(c=r+1; c<lc; c++) { | 758 | for(c=r+1; c<lc; c++) { |
760 | ((doublecomplex*)lp)[r*lc+c] = zero; | 759 | lp[r*lc+c] = zero; |
761 | } | 760 | } |
762 | } | 761 | } |
763 | OK | 762 | OK |
@@ -810,7 +809,7 @@ int qr_l_C(KCMAT(a), CVEC(tau), CMAT(r)) { | |||
810 | CHECK(!WORK,MEM); | 809 | CHECK(!WORK,MEM); |
811 | memcpy(rp,ap,m*n*sizeof(doublecomplex)); | 810 | memcpy(rp,ap,m*n*sizeof(doublecomplex)); |
812 | integer res; | 811 | integer res; |
813 | zgeqr2_ (&m,&n,(doublecomplex*)rp,&m,(doublecomplex*)taup,WORK,&res); | 812 | zgeqr2_ (&m,&n,rp,&m,taup,WORK,&res); |
814 | CHECK(res,res); | 813 | CHECK(res,res); |
815 | free(WORK); | 814 | free(WORK); |
816 | OK | 815 | OK |
@@ -848,7 +847,7 @@ int hess_l_C(KCMAT(a), CVEC(tau), CMAT(r)) { | |||
848 | memcpy(rp,ap,m*n*sizeof(doublecomplex)); | 847 | memcpy(rp,ap,m*n*sizeof(doublecomplex)); |
849 | integer res; | 848 | integer res; |
850 | integer one = 1; | 849 | integer one = 1; |
851 | zgehrd_ (&n,&one,&n,(doublecomplex*)rp,&n,(doublecomplex*)taup,WORK,&lwork,&res); | 850 | zgehrd_ (&n,&one,&n,rp,&n,taup,WORK,&lwork,&res); |
852 | CHECK(res,res); | 851 | CHECK(res,res); |
853 | free(WORK); | 852 | free(WORK); |
854 | OK | 853 | OK |
@@ -904,8 +903,8 @@ int schur_l_C(KCMAT(a), CMAT(u), CMAT(s)) { | |||
904 | double *RWORK = (double*)malloc(n*sizeof(double)); | 903 | double *RWORK = (double*)malloc(n*sizeof(double)); |
905 | integer res; | 904 | integer res; |
906 | integer sdim; | 905 | integer sdim; |
907 | zgees_ ("V","N",NULL,&n,(doublecomplex*)sp,&n,&sdim,W, | 906 | zgees_ ("V","N",NULL,&n,sp,&n,&sdim,W, |
908 | (doublecomplex*)up,&n, | 907 | up,&n, |
909 | WORK,&lwork,RWORK,BWORK,&res); | 908 | WORK,&lwork,RWORK,BWORK,&res); |
910 | if(res>0) { | 909 | if(res>0) { |
911 | return NOCONVER; | 910 | return NOCONVER; |
@@ -950,7 +949,7 @@ int lu_l_C(KCMAT(a), DVEC(ipiv), CMAT(r)) { | |||
950 | integer* auxipiv = (integer*)malloc(mn*sizeof(integer)); | 949 | integer* auxipiv = (integer*)malloc(mn*sizeof(integer)); |
951 | memcpy(rp,ap,m*n*sizeof(doublecomplex)); | 950 | memcpy(rp,ap,m*n*sizeof(doublecomplex)); |
952 | integer res; | 951 | integer res; |
953 | zgetrf_ (&m,&n,(doublecomplex*)rp,&m,auxipiv,&res); | 952 | zgetrf_ (&m,&n,rp,&m,auxipiv,&res); |
954 | if(res>0) { | 953 | if(res>0) { |
955 | res = 0; // fixme | 954 | res = 0; // fixme |
956 | } | 955 | } |
@@ -1000,7 +999,7 @@ int luS_l_C(KCMAT(a), KDVEC(ipiv), KCMAT(b), CMAT(x)) { | |||
1000 | } | 999 | } |
1001 | integer res; | 1000 | integer res; |
1002 | memcpy(xp,bp,mrhs*nrhs*sizeof(doublecomplex)); | 1001 | memcpy(xp,bp,mrhs*nrhs*sizeof(doublecomplex)); |
1003 | zgetrs_ ("N",&n,&nrhs,(doublecomplex*)ap,&m,auxipiv,(doublecomplex*)xp,&mrhs,&res); | 1002 | zgetrs_ ("N",&n,&nrhs,(doublecomplex*)ap,&m,auxipiv,xp,&mrhs,&res); |
1004 | CHECK(res,res); | 1003 | CHECK(res,res); |
1005 | free(auxipiv); | 1004 | free(auxipiv); |
1006 | OK | 1005 | OK |
@@ -1043,9 +1042,9 @@ int multiplyC(int ta, int tb, KCMAT(a),KCMAT(b),CMAT(r)) { | |||
1043 | doublecomplex alpha = {1,0}; | 1042 | doublecomplex alpha = {1,0}; |
1044 | doublecomplex beta = {0,0}; | 1043 | doublecomplex beta = {0,0}; |
1045 | zgemm_(ta?"T":"N",tb?"T":"N",&m,&n,&k,&alpha, | 1044 | zgemm_(ta?"T":"N",tb?"T":"N",&m,&n,&k,&alpha, |
1046 | (doublecomplex*)ap,&lda, | 1045 | ap,&lda, |
1047 | (doublecomplex*)bp,&ldb,&beta, | 1046 | bp,&ldb,&beta, |
1048 | (doublecomplex*)rp,&ldc); | 1047 | rp,&ldc); |
1049 | OK | 1048 | OK |
1050 | } | 1049 | } |
1051 | 1050 | ||
@@ -1084,9 +1083,9 @@ int multiplyQ(int ta, int tb, KQMAT(a),KQMAT(b),QMAT(r)) { | |||
1084 | complex alpha = {1,0}; | 1083 | complex alpha = {1,0}; |
1085 | complex beta = {0,0}; | 1084 | complex beta = {0,0}; |
1086 | cgemm_(ta?"T":"N",tb?"T":"N",&m,&n,&k,&alpha, | 1085 | cgemm_(ta?"T":"N",tb?"T":"N",&m,&n,&k,&alpha, |
1087 | (complex*)ap,&lda, | 1086 | ap,&lda, |
1088 | (complex*)bp,&ldb,&beta, | 1087 | bp,&ldb,&beta, |
1089 | (complex*)rp,&ldc); | 1088 | rp,&ldc); |
1090 | OK | 1089 | OK |
1091 | } | 1090 | } |
1092 | 1091 | ||
@@ -1122,7 +1121,7 @@ int transQ(KQMAT(x),QMAT(t)) { | |||
1122 | int i,j; | 1121 | int i,j; |
1123 | for (i=0; i<tr; i++) { | 1122 | for (i=0; i<tr; i++) { |
1124 | for (j=0; j<tc; j++) { | 1123 | for (j=0; j<tc; j++) { |
1125 | ((complex*)tp)[i*tc+j] = ((complex*)xp)[j*xc+i]; | 1124 | tp[i*tc+j] = xp[j*xc+i]; |
1126 | } | 1125 | } |
1127 | } | 1126 | } |
1128 | OK | 1127 | OK |
@@ -1134,7 +1133,7 @@ int transC(KCMAT(x),CMAT(t)) { | |||
1134 | int i,j; | 1133 | int i,j; |
1135 | for (i=0; i<tr; i++) { | 1134 | for (i=0; i<tr; i++) { |
1136 | for (j=0; j<tc; j++) { | 1135 | for (j=0; j<tc; j++) { |
1137 | ((doublecomplex*)tp)[i*tc+j] = ((doublecomplex*)xp)[j*xc+i]; | 1136 | tp[i*tc+j] = xp[j*xc+i]; |
1138 | } | 1137 | } |
1139 | } | 1138 | } |
1140 | OK | 1139 | OK |
@@ -1167,7 +1166,7 @@ int constantQ(complex* pval, QVEC(r)) { | |||
1167 | int k; | 1166 | int k; |
1168 | complex val = *pval; | 1167 | complex val = *pval; |
1169 | for(k=0;k<rn;k++) { | 1168 | for(k=0;k<rn;k++) { |
1170 | ((complex*)rp)[k]=val; | 1169 | rp[k]=val; |
1171 | } | 1170 | } |
1172 | OK | 1171 | OK |
1173 | } | 1172 | } |
@@ -1177,7 +1176,7 @@ int constantC(doublecomplex* pval, CVEC(r)) { | |||
1177 | int k; | 1176 | int k; |
1178 | doublecomplex val = *pval; | 1177 | doublecomplex val = *pval; |
1179 | for(k=0;k<rn;k++) { | 1178 | for(k=0;k<rn;k++) { |
1180 | ((doublecomplex*)rp)[k]=val; | 1179 | rp[k]=val; |
1181 | } | 1180 | } |
1182 | OK | 1181 | OK |
1183 | } | 1182 | } |
@@ -1209,8 +1208,8 @@ int conjugateQ(KQVEC(x),QVEC(t)) { | |||
1209 | DEBUGMSG("conjugateQ"); | 1208 | DEBUGMSG("conjugateQ"); |
1210 | int k; | 1209 | int k; |
1211 | for(k=0;k<xn;k++) { | 1210 | for(k=0;k<xn;k++) { |
1212 | ((complex*)tp)[k].r=((complex*)xp)[k].r; | 1211 | tp[k].r = xp[k].r; |
1213 | ((complex*)tp)[k].i=-((complex*)xp)[k].i; | 1212 | tp[k].i = -xp[k].i; |
1214 | } | 1213 | } |
1215 | OK | 1214 | OK |
1216 | } | 1215 | } |
@@ -1220,8 +1219,8 @@ int conjugateC(KCVEC(x),CVEC(t)) { | |||
1220 | DEBUGMSG("conjugateC"); | 1219 | DEBUGMSG("conjugateC"); |
1221 | int k; | 1220 | int k; |
1222 | for(k=0;k<xn;k++) { | 1221 | for(k=0;k<xn;k++) { |
1223 | ((doublecomplex*)tp)[k].r=((doublecomplex*)xp)[k].r; | 1222 | tp[k].r = xp[k].r; |
1224 | ((doublecomplex*)tp)[k].i=-((doublecomplex*)xp)[k].i; | 1223 | tp[k].i = -xp[k].i; |
1225 | } | 1224 | } |
1226 | OK | 1225 | OK |
1227 | } | 1226 | } |
diff --git a/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.h b/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.h index d01d9e5..3de5b19 100644 --- a/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.h +++ b/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.h | |||
@@ -42,21 +42,21 @@ typedef short ftnlen; | |||
42 | 42 | ||
43 | #define FVEC(A) int A##n, float*A##p | 43 | #define FVEC(A) int A##n, float*A##p |
44 | #define DVEC(A) int A##n, double*A##p | 44 | #define DVEC(A) int A##n, double*A##p |
45 | #define QVEC(A) int A##n, float*A##p | 45 | #define QVEC(A) int A##n, complex*A##p |
46 | #define CVEC(A) int A##n, double*A##p | 46 | #define CVEC(A) int A##n, doublecomplex*A##p |
47 | #define FMAT(A) int A##r, int A##c, float* A##p | 47 | #define FMAT(A) int A##r, int A##c, float* A##p |
48 | #define DMAT(A) int A##r, int A##c, double* A##p | 48 | #define DMAT(A) int A##r, int A##c, double* A##p |
49 | #define QMAT(A) int A##r, int A##c, float* A##p | 49 | #define QMAT(A) int A##r, int A##c, complex* A##p |
50 | #define CMAT(A) int A##r, int A##c, double* A##p | 50 | #define CMAT(A) int A##r, int A##c, doublecomplex* A##p |
51 | 51 | ||
52 | #define KFVEC(A) int A##n, const float*A##p | 52 | #define KFVEC(A) int A##n, const float*A##p |
53 | #define KDVEC(A) int A##n, const double*A##p | 53 | #define KDVEC(A) int A##n, const double*A##p |
54 | #define KQVEC(A) int A##n, const float*A##p | 54 | #define KQVEC(A) int A##n, const complex*A##p |
55 | #define KCVEC(A) int A##n, const double*A##p | 55 | #define KCVEC(A) int A##n, const doublecomplex*A##p |
56 | #define KFMAT(A) int A##r, int A##c, const float* A##p | 56 | #define KFMAT(A) int A##r, int A##c, const float* A##p |
57 | #define KDMAT(A) int A##r, int A##c, const double* A##p | 57 | #define KDMAT(A) int A##r, int A##c, const double* A##p |
58 | #define KQMAT(A) int A##r, int A##c, const float* A##p | 58 | #define KQMAT(A) int A##r, int A##c, const complex* A##p |
59 | #define KCMAT(A) int A##r, int A##c, const double* A##p | 59 | #define KCMAT(A) int A##r, int A##c, const doublecomplex* A##p |
60 | 60 | ||
61 | /********************************************************/ | 61 | /********************************************************/ |
62 | 62 | ||
@@ -73,6 +73,12 @@ int constantR(double * pval, DVEC(r)); | |||
73 | int constantQ(complex* pval, QVEC(r)); | 73 | int constantQ(complex* pval, QVEC(r)); |
74 | int constantC(doublecomplex* pval, CVEC(r)); | 74 | int constantC(doublecomplex* pval, CVEC(r)); |
75 | 75 | ||
76 | int float2double(FVEC(x),DVEC(y)); | ||
77 | int double2float(DVEC(x),FVEC(y)); | ||
78 | |||
79 | int conjugateQ(KQVEC(x),QVEC(t)); | ||
80 | int conjugateC(KCVEC(x),CVEC(t)); | ||
81 | |||
76 | int svd_l_R(KDMAT(x),DMAT(u),DVEC(s),DMAT(v)); | 82 | int svd_l_R(KDMAT(x),DMAT(u),DVEC(s),DMAT(v)); |
77 | int svd_l_Rdd(KDMAT(x),DMAT(u),DVEC(s),DMAT(v)); | 83 | int svd_l_Rdd(KDMAT(x),DMAT(u),DVEC(s),DMAT(v)); |
78 | int svd_l_C(KCMAT(a),CMAT(u),DVEC(s),CMAT(v)); | 84 | int svd_l_C(KCMAT(a),CMAT(u),DVEC(s),CMAT(v)); |