summaryrefslogtreecommitdiff
path: root/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2007-12-03 10:43:52 +0000
committerAlberto Ruiz <aruiz@um.es>2007-12-03 10:43:52 +0000
commitc520939e33cc895febed271d5c3218457317bba9 (patch)
tree8661410a5cb946a3ae40e0c0fbacccccd0fd5ada /lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c
parentd7d3b731c037fca41bd9128c3da2a582189cb4d9 (diff)
lapack lu
Diffstat (limited to 'lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c')
-rw-r--r--lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c b/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c
index 8392feb..310f6ee 100644
--- a/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c
+++ b/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c
@@ -768,3 +768,49 @@ int schur_l_C(KCMAT(a), CMAT(u), CMAT(s)) {
768 OK 768 OK
769 #endif 769 #endif
770} 770}
771
772//////////////////// LU factorization /////////////////////////
773
774int lu_l_R(KDMAT(a), DVEC(ipiv), DMAT(r)) {
775 integer m = ar;
776 integer n = ac;
777 integer mn = MIN(m,n);
778 REQUIRES(m>=1 && n >=1 && ipivn == mn, BAD_SIZE);
779 DEBUGMSG("lu_l_R");
780 integer* auxipiv = (integer*)malloc(mn*sizeof(integer));
781 memcpy(rp,ap,m*n*sizeof(double));
782 integer res;
783 dgetrf_ (&m,&n,rp,&m,auxipiv,&res);
784 if(res>0) {
785 res = 0; // fixme
786 }
787 CHECK(res,res);
788 int k;
789 for (k=0; k<mn; k++) {
790 ipivp[k] = auxipiv[k];
791 }
792 free(auxipiv);
793 OK
794}
795
796int lu_l_C(KCMAT(a), DVEC(ipiv), CMAT(r)) {
797 integer m = ar;
798 integer n = ac;
799 integer mn = MIN(m,n);
800 REQUIRES(m>=1 && n >=1 && ipivn == mn, BAD_SIZE);
801 DEBUGMSG("lu_l_C");
802 integer* auxipiv = (integer*)malloc(mn*sizeof(integer));
803 memcpy(rp,ap,m*n*sizeof(doublecomplex));
804 integer res;
805 zgetrf_ (&m,&n,(doublecomplex*)rp,&m,auxipiv,&res);
806 if(res>0) {
807 res = 0; // fixme
808 }
809 CHECK(res,res);
810 int k;
811 for (k=0; k<mn; k++) {
812 ipivp[k] = auxipiv[k];
813 }
814 free(auxipiv);
815 OK
816}