diff options
author | Alberto Ruiz <aruiz@um.es> | 2008-11-04 09:32:35 +0000 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2008-11-04 09:32:35 +0000 |
commit | 02805ad64715373347b34bac2f75cbb866563ba2 (patch) | |
tree | 4eeb137ce0232d57ce98c0a0ced8fffe7baf7f99 /lib/Numeric/LinearAlgebra/LAPACK | |
parent | 86c7aed1de8efe5988f994867d35addb6b62a655 (diff) |
multiply/trans ok
Diffstat (limited to 'lib/Numeric/LinearAlgebra/LAPACK')
-rw-r--r-- | lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c | 41 | ||||
-rw-r--r-- | lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.h | 8 |
2 files changed, 47 insertions, 2 deletions
diff --git a/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c b/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c index 842b5ad..e85c1b7 100644 --- a/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c +++ b/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c | |||
@@ -860,3 +860,44 @@ int luS_l_C(KCMAT(a), KDVEC(ipiv), KCMAT(b), CMAT(x)) { | |||
860 | free(auxipiv); | 860 | free(auxipiv); |
861 | OK | 861 | OK |
862 | } | 862 | } |
863 | |||
864 | //////////////////// Matrix Product ///////////////////////// | ||
865 | |||
866 | void dgemm_(char *, char *, integer *, integer *, integer *, | ||
867 | double *, const double *, integer *, const double *, | ||
868 | integer *, double *, double *, integer *); | ||
869 | |||
870 | int multiplyR(int ta, int tb, KDMAT(a),KDMAT(b),DMAT(r)) { | ||
871 | //REQUIRES(ac==br && ar==rr && bc==rc,BAD_SIZE); | ||
872 | integer m = ta?ac:ar; | ||
873 | integer n = tb?br:bc; | ||
874 | integer k = ta?ar:ac; | ||
875 | integer lda = ar; | ||
876 | integer ldb = br; | ||
877 | integer ldc = rr; | ||
878 | double alpha = 1; | ||
879 | double beta = 0; | ||
880 | dgemm_(ta?"T":"N",tb?"T":"N",&m,&n,&k,&alpha,ap,&lda,bp,&ldb,&beta,rp,&ldc); | ||
881 | OK | ||
882 | } | ||
883 | |||
884 | void zgemm_(char *, char *, integer *, integer *, integer *, | ||
885 | doublecomplex *, const doublecomplex *, integer *, const doublecomplex *, | ||
886 | integer *, doublecomplex *, doublecomplex *, integer *); | ||
887 | |||
888 | int multiplyC(int ta, int tb, KCMAT(a),KCMAT(b),CMAT(r)) { | ||
889 | //REQUIRES(ac==br && ar==rr && bc==rc,BAD_SIZE); | ||
890 | integer m = ta?ac:ar; | ||
891 | integer n = tb?br:bc; | ||
892 | integer k = ta?ar:ac; | ||
893 | integer lda = ar; | ||
894 | integer ldb = br; | ||
895 | integer ldc = rr; | ||
896 | doublecomplex alpha = {1,0}; | ||
897 | doublecomplex beta = {0,0}; | ||
898 | zgemm_(ta?"T":"N",tb?"T":"N",&m,&n,&k,&alpha, | ||
899 | (doublecomplex*)ap,&lda, | ||
900 | (doublecomplex*)bp,&ldb,&beta, | ||
901 | (doublecomplex*)rp,&ldc); | ||
902 | OK | ||
903 | } | ||
diff --git a/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.h b/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.h index 23e5e28..3f58243 100644 --- a/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.h +++ b/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.h | |||
@@ -45,11 +45,15 @@ typedef short ftnlen; | |||
45 | #define DMAT(A) int A##r, int A##c, double* A##p | 45 | #define DMAT(A) int A##r, int A##c, double* A##p |
46 | #define CMAT(A) int A##r, int A##c, double* A##p | 46 | #define CMAT(A) int A##r, int A##c, double* A##p |
47 | 47 | ||
48 | // const pointer versions for the parameters | ||
49 | #define KDVEC(A) int A##n, const double*A##p | 48 | #define KDVEC(A) int A##n, const double*A##p |
50 | #define KCVEC(A) int A##n, const double*A##p | 49 | #define KCVEC(A) int A##n, const double*A##p |
51 | #define KDMAT(A) int A##r, int A##c, const double* A##p | 50 | #define KDMAT(A) int A##r, int A##c, const double* A##p |
52 | #define KCMAT(A) int A##r, int A##c, const double* A##p | 51 | #define KCMAT(A) int A##r, int A##c, const double* A##p |
52 | |||
53 | /********************************************************/ | ||
54 | |||
55 | int multiplyR(int ta, int tb, KDMAT(a),KDMAT(b),DMAT(r)); | ||
56 | int multiplyC(int ta, int tb, KCMAT(a),KCMAT(b),CMAT(r)); | ||
53 | 57 | ||
54 | int svd_l_R(KDMAT(x),DMAT(u),DVEC(s),DMAT(v)); | 58 | int svd_l_R(KDMAT(x),DMAT(u),DVEC(s),DMAT(v)); |
55 | int svd_l_Rdd(KDMAT(x),DMAT(u),DVEC(s),DMAT(v)); | 59 | int svd_l_Rdd(KDMAT(x),DMAT(u),DVEC(s),DMAT(v)); |