summaryrefslogtreecommitdiff
path: root/lib/LAPACK/lapack-aux.c
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2007-09-29 16:12:44 +0000
committerAlberto Ruiz <aruiz@um.es>2007-09-29 16:12:44 +0000
commitc54d047956412dafc8e2a11f5c5f11733d330d68 (patch)
treeef2c7a2162a30140d7784edd71a219f6b1b4b18f /lib/LAPACK/lapack-aux.c
parent59e449d624d5313660848dd0e58fe95dc482f9ca (diff)
lapack QR (unpacked)
Diffstat (limited to 'lib/LAPACK/lapack-aux.c')
-rw-r--r--lib/LAPACK/lapack-aux.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/LAPACK/lapack-aux.c b/lib/LAPACK/lapack-aux.c
index 5781cd1..4ef9a6e 100644
--- a/lib/LAPACK/lapack-aux.c
+++ b/lib/LAPACK/lapack-aux.c
@@ -619,3 +619,38 @@ int chol_l_S(KDMAT(a),DMAT(l)) {
619 } 619 }
620 OK 620 OK
621} 621}
622
623//////////////////// QR factorization /////////////////////////
624// TO DO: unpack
625
626int qr_l_R(KDMAT(a), DVEC(tau), DMAT(r)) {
627 integer m = ar;
628 integer n = ac;
629 integer mn = MIN(m,n);
630 REQUIRES(m>=1 && n >=1 && rr== m && rc == n && taun == mn, BAD_SIZE);
631 DEBUGMSG("qr_l_R");
632 double *WORK = (double*)malloc(m*sizeof(double));
633 CHECK(!WORK,MEM);
634 memcpy(rp,ap,m*n*sizeof(double));
635 integer res;
636 dgeqr2_ (&m,&n,rp,&m,taup,WORK,&res);
637 CHECK(res,res);
638 free(WORK);
639 OK
640}
641
642int qr_l_C(KCMAT(a), CVEC(tau), CMAT(r)) {
643 integer m = ar;
644 integer n = ac;
645 integer mn = MIN(m,n);
646 REQUIRES(m>=1 && n >=1 && rr== m && rc == n && taun == mn, BAD_SIZE);
647 DEBUGMSG("qr_l_C");
648 doublecomplex *WORK = (doublecomplex*)malloc(m*sizeof(doublecomplex));
649 CHECK(!WORK,MEM);
650 memcpy(rp,ap,m*n*sizeof(doublecomplex));
651 integer res;
652 zgeqr2_ (&m,&n,(doublecomplex*)rp,&m,(doublecomplex*)taup,WORK,&res);
653 CHECK(res,res);
654 free(WORK);
655 OK
656}