summaryrefslogtreecommitdiff
path: root/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c')
-rw-r--r--lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c104
1 files changed, 104 insertions, 0 deletions
diff --git a/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c b/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c
index 8cf73e9..1c35376 100644
--- a/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c
+++ b/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c
@@ -101,6 +101,11 @@ for(k=0; k<(M##r * M##c); k++) { \
101 101
102//////////////////// real svd //////////////////////////////////// 102//////////////////// real svd ////////////////////////////////////
103 103
104/* Subroutine */ int dgesvd_(char *jobu, char *jobvt, integer *m, integer *n,
105 doublereal *a, integer *lda, doublereal *s, doublereal *u, integer *
106 ldu, doublereal *vt, integer *ldvt, doublereal *work, integer *lwork,
107 integer *info);
108
104int svd_l_R(KDMAT(a),DMAT(u), DVEC(s),DMAT(v)) { 109int svd_l_R(KDMAT(a),DMAT(u), DVEC(s),DMAT(v)) {
105 integer m = ar; 110 integer m = ar;
106 integer n = ac; 111 integer n = ac;
@@ -159,6 +164,11 @@ int svd_l_R(KDMAT(a),DMAT(u), DVEC(s),DMAT(v)) {
159 164
160// (alternative version) 165// (alternative version)
161 166
167/* Subroutine */ int dgesdd_(char *jobz, integer *m, integer *n, doublereal *
168 a, integer *lda, doublereal *s, doublereal *u, integer *ldu,
169 doublereal *vt, integer *ldvt, doublereal *work, integer *lwork,
170 integer *iwork, integer *info);
171
162int svd_l_Rdd(KDMAT(a),DMAT(u), DVEC(s),DMAT(v)) { 172int svd_l_Rdd(KDMAT(a),DMAT(u), DVEC(s),DMAT(v)) {
163 integer m = ar; 173 integer m = ar;
164 integer n = ac; 174 integer n = ac;
@@ -331,6 +341,11 @@ int svd_l_Cdd(KCMAT(a),CMAT(u), DVEC(s),CMAT(v)) {
331 341
332//////////////////// general complex eigensystem //////////// 342//////////////////// general complex eigensystem ////////////
333 343
344/* Subroutine */ int zgeev_(char *jobvl, char *jobvr, integer *n,
345 doublecomplex *a, integer *lda, doublecomplex *w, doublecomplex *vl,
346 integer *ldvl, doublecomplex *vr, integer *ldvr, doublecomplex *work,
347 integer *lwork, doublereal *rwork, integer *info);
348
334int eig_l_C(KCMAT(a), CMAT(u), CVEC(s),CMAT(v)) { 349int eig_l_C(KCMAT(a), CMAT(u), CVEC(s),CMAT(v)) {
335 integer n = ar; 350 integer n = ar;
336 REQUIRES(ac==n && sn==n, BAD_SIZE); 351 REQUIRES(ac==n && sn==n, BAD_SIZE);
@@ -381,6 +396,11 @@ int eig_l_C(KCMAT(a), CMAT(u), CVEC(s),CMAT(v)) {
381 396
382//////////////////// general real eigensystem //////////// 397//////////////////// general real eigensystem ////////////
383 398
399/* Subroutine */ int dgeev_(char *jobvl, char *jobvr, integer *n, doublereal *
400 a, integer *lda, doublereal *wr, doublereal *wi, doublereal *vl,
401 integer *ldvl, doublereal *vr, integer *ldvr, doublereal *work,
402 integer *lwork, integer *info);
403
384int eig_l_R(KDMAT(a),DMAT(u), CVEC(s),DMAT(v)) { 404int eig_l_R(KDMAT(a),DMAT(u), CVEC(s),DMAT(v)) {
385 integer n = ar; 405 integer n = ar;
386 REQUIRES(ac==n && sn==n, BAD_SIZE); 406 REQUIRES(ac==n && sn==n, BAD_SIZE);
@@ -425,6 +445,9 @@ int eig_l_R(KDMAT(a),DMAT(u), CVEC(s),DMAT(v)) {
425 445
426//////////////////// symmetric real eigensystem //////////// 446//////////////////// symmetric real eigensystem ////////////
427 447
448/* Subroutine */ int dsyev_(char *jobz, char *uplo, integer *n, doublereal *a,
449 integer *lda, doublereal *w, doublereal *work, integer *lwork,
450 integer *info);
428 451
429int eig_l_S(int wantV,KDMAT(a),DVEC(s),DMAT(v)) { 452int eig_l_S(int wantV,KDMAT(a),DVEC(s),DMAT(v)) {
430 integer n = ar; 453 integer n = ar;
@@ -460,6 +483,10 @@ int eig_l_S(int wantV,KDMAT(a),DVEC(s),DMAT(v)) {
460 483
461//////////////////// hermitian complex eigensystem //////////// 484//////////////////// hermitian complex eigensystem ////////////
462 485
486/* Subroutine */ int zheev_(char *jobz, char *uplo, integer *n, doublecomplex
487 *a, integer *lda, doublereal *w, doublecomplex *work, integer *lwork,
488 doublereal *rwork, integer *info);
489
463int eig_l_H(int wantV,KCMAT(a),DVEC(s),CMAT(v)) { 490int eig_l_H(int wantV,KCMAT(a),DVEC(s),CMAT(v)) {
464 integer n = ar; 491 integer n = ar;
465 REQUIRES(ac==n && sn==n, BAD_SIZE); 492 REQUIRES(ac==n && sn==n, BAD_SIZE);
@@ -499,6 +526,9 @@ int eig_l_H(int wantV,KCMAT(a),DVEC(s),CMAT(v)) {
499 526
500//////////////////// general real linear system //////////// 527//////////////////// general real linear system ////////////
501 528
529/* Subroutine */ int dgesv_(integer *n, integer *nrhs, doublereal *a, integer
530 *lda, integer *ipiv, doublereal *b, integer *ldb, integer *info);
531
502int linearSolveR_l(KDMAT(a),KDMAT(b),DMAT(x)) { 532int linearSolveR_l(KDMAT(a),KDMAT(b),DMAT(x)) {
503 integer n = ar; 533 integer n = ar;
504 integer nhrs = bc; 534 integer nhrs = bc;
@@ -525,6 +555,10 @@ int linearSolveR_l(KDMAT(a),KDMAT(b),DMAT(x)) {
525 555
526//////////////////// general complex linear system //////////// 556//////////////////// general complex linear system ////////////
527 557
558/* Subroutine */ int zgesv_(integer *n, integer *nrhs, doublecomplex *a,
559 integer *lda, integer *ipiv, doublecomplex *b, integer *ldb, integer *
560 info);
561
528int linearSolveC_l(KCMAT(a),KCMAT(b),CMAT(x)) { 562int linearSolveC_l(KCMAT(a),KCMAT(b),CMAT(x)) {
529 integer n = ar; 563 integer n = ar;
530 integer nhrs = bc; 564 integer nhrs = bc;
@@ -551,6 +585,10 @@ int linearSolveC_l(KCMAT(a),KCMAT(b),CMAT(x)) {
551 585
552//////// symmetric positive definite real linear system using Cholesky //////////// 586//////// symmetric positive definite real linear system using Cholesky ////////////
553 587
588/* Subroutine */ int dpotrs_(char *uplo, integer *n, integer *nrhs,
589 doublereal *a, integer *lda, doublereal *b, integer *ldb, integer *
590 info);
591
554int cholSolveR_l(KDMAT(a),KDMAT(b),DMAT(x)) { 592int cholSolveR_l(KDMAT(a),KDMAT(b),DMAT(x)) {
555 integer n = ar; 593 integer n = ar;
556 integer nhrs = bc; 594 integer nhrs = bc;
@@ -569,6 +607,10 @@ int cholSolveR_l(KDMAT(a),KDMAT(b),DMAT(x)) {
569 607
570//////// Hermitian positive definite real linear system using Cholesky //////////// 608//////// Hermitian positive definite real linear system using Cholesky ////////////
571 609
610/* Subroutine */ int zpotrs_(char *uplo, integer *n, integer *nrhs,
611 doublecomplex *a, integer *lda, doublecomplex *b, integer *ldb,
612 integer *info);
613
572int cholSolveC_l(KCMAT(a),KCMAT(b),CMAT(x)) { 614int cholSolveC_l(KCMAT(a),KCMAT(b),CMAT(x)) {
573 integer n = ar; 615 integer n = ar;
574 integer nhrs = bc; 616 integer nhrs = bc;
@@ -587,6 +629,10 @@ int cholSolveC_l(KCMAT(a),KCMAT(b),CMAT(x)) {
587 629
588//////////////////// least squares real linear system //////////// 630//////////////////// least squares real linear system ////////////
589 631
632/* Subroutine */ int dgels_(char *trans, integer *m, integer *n, integer *
633 nrhs, doublereal *a, integer *lda, doublereal *b, integer *ldb,
634 doublereal *work, integer *lwork, integer *info);
635
590int linearSolveLSR_l(KDMAT(a),KDMAT(b),DMAT(x)) { 636int linearSolveLSR_l(KDMAT(a),KDMAT(b),DMAT(x)) {
591 integer m = ar; 637 integer m = ar;
592 integer n = ac; 638 integer n = ac;
@@ -631,6 +677,10 @@ int linearSolveLSR_l(KDMAT(a),KDMAT(b),DMAT(x)) {
631 677
632//////////////////// least squares complex linear system //////////// 678//////////////////// least squares complex linear system ////////////
633 679
680/* Subroutine */ int zgels_(char *trans, integer *m, integer *n, integer *
681 nrhs, doublecomplex *a, integer *lda, doublecomplex *b, integer *ldb,
682 doublecomplex *work, integer *lwork, integer *info);
683
634int linearSolveLSC_l(KCMAT(a),KCMAT(b),CMAT(x)) { 684int linearSolveLSC_l(KCMAT(a),KCMAT(b),CMAT(x)) {
635 integer m = ar; 685 integer m = ar;
636 integer n = ac; 686 integer n = ac;
@@ -675,6 +725,11 @@ int linearSolveLSC_l(KCMAT(a),KCMAT(b),CMAT(x)) {
675 725
676//////////////////// least squares real linear system using SVD //////////// 726//////////////////// least squares real linear system using SVD ////////////
677 727
728/* Subroutine */ int dgelss_(integer *m, integer *n, integer *nrhs,
729 doublereal *a, integer *lda, doublereal *b, integer *ldb, doublereal *
730 s, doublereal *rcond, integer *rank, doublereal *work, integer *lwork,
731 integer *info);
732
678int linearSolveSVDR_l(double rcond,KDMAT(a),KDMAT(b),DMAT(x)) { 733int linearSolveSVDR_l(double rcond,KDMAT(a),KDMAT(b),DMAT(x)) {
679 integer m = ar; 734 integer m = ar;
680 integer n = ac; 735 integer n = ac;
@@ -789,6 +844,9 @@ int linearSolveSVDC_l(double rcond, KCMAT(a),KCMAT(b),CMAT(x)) {
789 844
790//////////////////// Cholesky factorization ///////////////////////// 845//////////////////// Cholesky factorization /////////////////////////
791 846
847/* Subroutine */ int zpotrf_(char *uplo, integer *n, doublecomplex *a,
848 integer *lda, integer *info);
849
792int chol_l_H(KCMAT(a),CMAT(l)) { 850int chol_l_H(KCMAT(a),CMAT(l)) {
793 integer n = ar; 851 integer n = ar;
794 REQUIRES(n>=1 && ac == n && lr==n && lc==n,BAD_SIZE); 852 REQUIRES(n>=1 && ac == n && lr==n && lc==n,BAD_SIZE);
@@ -809,6 +867,10 @@ int chol_l_H(KCMAT(a),CMAT(l)) {
809 OK 867 OK
810} 868}
811 869
870
871/* Subroutine */ int dpotrf_(char *uplo, integer *n, doublereal *a, integer *
872 lda, integer *info);
873
812int chol_l_S(KDMAT(a),DMAT(l)) { 874int chol_l_S(KDMAT(a),DMAT(l)) {
813 integer n = ar; 875 integer n = ar;
814 REQUIRES(n>=1 && ac == n && lr==n && lc==n,BAD_SIZE); 876 REQUIRES(n>=1 && ac == n && lr==n && lc==n,BAD_SIZE);
@@ -830,6 +892,9 @@ int chol_l_S(KDMAT(a),DMAT(l)) {
830 892
831//////////////////// QR factorization ///////////////////////// 893//////////////////// QR factorization /////////////////////////
832 894
895/* Subroutine */ int dgeqr2_(integer *m, integer *n, doublereal *a, integer *
896 lda, doublereal *tau, doublereal *work, integer *info);
897
833int qr_l_R(KDMAT(a), DVEC(tau), DMAT(r)) { 898int qr_l_R(KDMAT(a), DVEC(tau), DMAT(r)) {
834 integer m = ar; 899 integer m = ar;
835 integer n = ac; 900 integer n = ac;
@@ -846,6 +911,9 @@ int qr_l_R(KDMAT(a), DVEC(tau), DMAT(r)) {
846 OK 911 OK
847} 912}
848 913
914/* Subroutine */ int zgeqr2_(integer *m, integer *n, doublecomplex *a,
915 integer *lda, doublecomplex *tau, doublecomplex *work, integer *info);
916
849int qr_l_C(KCMAT(a), CVEC(tau), CMAT(r)) { 917int qr_l_C(KCMAT(a), CVEC(tau), CMAT(r)) {
850 integer m = ar; 918 integer m = ar;
851 integer n = ac; 919 integer n = ac;
@@ -864,6 +932,10 @@ int qr_l_C(KCMAT(a), CVEC(tau), CMAT(r)) {
864 932
865//////////////////// Hessenberg factorization ///////////////////////// 933//////////////////// Hessenberg factorization /////////////////////////
866 934
935/* Subroutine */ int dgehrd_(integer *n, integer *ilo, integer *ihi,
936 doublereal *a, integer *lda, doublereal *tau, doublereal *work,
937 integer *lwork, integer *info);
938
867int hess_l_R(KDMAT(a), DVEC(tau), DMAT(r)) { 939int hess_l_R(KDMAT(a), DVEC(tau), DMAT(r)) {
868 integer m = ar; 940 integer m = ar;
869 integer n = ac; 941 integer n = ac;
@@ -882,6 +954,11 @@ int hess_l_R(KDMAT(a), DVEC(tau), DMAT(r)) {
882 OK 954 OK
883} 955}
884 956
957
958/* Subroutine */ int zgehrd_(integer *n, integer *ilo, integer *ihi,
959 doublecomplex *a, integer *lda, doublecomplex *tau, doublecomplex *
960 work, integer *lwork, integer *info);
961
885int hess_l_C(KCMAT(a), CVEC(tau), CMAT(r)) { 962int hess_l_C(KCMAT(a), CVEC(tau), CMAT(r)) {
886 integer m = ar; 963 integer m = ar;
887 integer n = ac; 964 integer n = ac;
@@ -902,6 +979,11 @@ int hess_l_C(KCMAT(a), CVEC(tau), CMAT(r)) {
902 979
903//////////////////// Schur factorization ///////////////////////// 980//////////////////// Schur factorization /////////////////////////
904 981
982/* Subroutine */ int dgees_(char *jobvs, char *sort, L_fp select, integer *n,
983 doublereal *a, integer *lda, integer *sdim, doublereal *wr,
984 doublereal *wi, doublereal *vs, integer *ldvs, doublereal *work,
985 integer *lwork, logical *bwork, integer *info);
986
905int schur_l_R(KDMAT(a), DMAT(u), DMAT(s)) { 987int schur_l_R(KDMAT(a), DMAT(u), DMAT(s)) {
906 integer m = ar; 988 integer m = ar;
907 integer n = ac; 989 integer n = ac;
@@ -936,6 +1018,12 @@ int schur_l_R(KDMAT(a), DMAT(u), DMAT(s)) {
936 OK 1018 OK
937} 1019}
938 1020
1021
1022/* Subroutine */ int zgees_(char *jobvs, char *sort, L_fp select, integer *n,
1023 doublecomplex *a, integer *lda, integer *sdim, doublecomplex *w,
1024 doublecomplex *vs, integer *ldvs, doublecomplex *work, integer *lwork,
1025 doublereal *rwork, logical *bwork, integer *info);
1026
939int schur_l_C(KCMAT(a), CMAT(u), CMAT(s)) { 1027int schur_l_C(KCMAT(a), CMAT(u), CMAT(s)) {
940 integer m = ar; 1028 integer m = ar;
941 integer n = ac; 1029 integer n = ac;
@@ -965,6 +1053,9 @@ int schur_l_C(KCMAT(a), CMAT(u), CMAT(s)) {
965 1053
966//////////////////// LU factorization ///////////////////////// 1054//////////////////// LU factorization /////////////////////////
967 1055
1056/* Subroutine */ int dgetrf_(integer *m, integer *n, doublereal *a, integer *
1057 lda, integer *ipiv, integer *info);
1058
968int lu_l_R(KDMAT(a), DVEC(ipiv), DMAT(r)) { 1059int lu_l_R(KDMAT(a), DVEC(ipiv), DMAT(r)) {
969 integer m = ar; 1060 integer m = ar;
970 integer n = ac; 1061 integer n = ac;
@@ -987,6 +1078,10 @@ int lu_l_R(KDMAT(a), DVEC(ipiv), DMAT(r)) {
987 OK 1078 OK
988} 1079}
989 1080
1081
1082/* Subroutine */ int zgetrf_(integer *m, integer *n, doublecomplex *a,
1083 integer *lda, integer *ipiv, integer *info);
1084
990int lu_l_C(KCMAT(a), DVEC(ipiv), CMAT(r)) { 1085int lu_l_C(KCMAT(a), DVEC(ipiv), CMAT(r)) {
991 integer m = ar; 1086 integer m = ar;
992 integer n = ac; 1087 integer n = ac;
@@ -1012,6 +1107,10 @@ int lu_l_C(KCMAT(a), DVEC(ipiv), CMAT(r)) {
1012 1107
1013//////////////////// LU substitution ///////////////////////// 1108//////////////////// LU substitution /////////////////////////
1014 1109
1110/* Subroutine */ int dgetrs_(char *trans, integer *n, integer *nrhs,
1111 doublereal *a, integer *lda, integer *ipiv, doublereal *b, integer *
1112 ldb, integer *info);
1113
1015int luS_l_R(KDMAT(a), KDVEC(ipiv), KDMAT(b), DMAT(x)) { 1114int luS_l_R(KDMAT(a), KDVEC(ipiv), KDMAT(b), DMAT(x)) {
1016 integer m = ar; 1115 integer m = ar;
1017 integer n = ac; 1116 integer n = ac;
@@ -1032,6 +1131,11 @@ int luS_l_R(KDMAT(a), KDVEC(ipiv), KDMAT(b), DMAT(x)) {
1032 OK 1131 OK
1033} 1132}
1034 1133
1134
1135/* Subroutine */ int zgetrs_(char *trans, integer *n, integer *nrhs,
1136 doublecomplex *a, integer *lda, integer *ipiv, doublecomplex *b,
1137 integer *ldb, integer *info);
1138
1035int luS_l_C(KCMAT(a), KDVEC(ipiv), KCMAT(b), CMAT(x)) { 1139int luS_l_C(KCMAT(a), KDVEC(ipiv), KCMAT(b), CMAT(x)) {
1036 integer m = ar; 1140 integer m = ar;
1037 integer n = ac; 1141 integer n = ac;