summaryrefslogtreecommitdiff
path: root/lib/Numeric/LinearAlgebra/LAPACK
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Numeric/LinearAlgebra/LAPACK')
-rw-r--r--lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c49
-rw-r--r--lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.h4
2 files changed, 53 insertions, 0 deletions
diff --git a/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c b/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c
index 04ef416..cab3f5b 100644
--- a/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c
+++ b/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c
@@ -701,3 +701,52 @@ int hess_l_C(KCMAT(a), CVEC(tau), CMAT(r)) {
701 free(WORK); 701 free(WORK);
702 OK 702 OK
703} 703}
704
705//////////////////// Schur factorization /////////////////////////
706
707int schur_l_R(KDMAT(a), DMAT(u), DMAT(s)) {
708 integer m = ar;
709 integer n = ac;
710 REQUIRES(m>=1 && n==m && ur==n && uc==n && sr==n && sc==n, BAD_SIZE);
711 DEBUGMSG("schur_l_R");
712 memcpy(sp,ap,n*n*sizeof(double));
713 integer lwork = 6*n; // fixme
714 double *WORK = (double*)malloc(lwork*sizeof(double));
715 double *WR = (double*)malloc(n*sizeof(double));
716 double *WI = (double*)malloc(n*sizeof(double));
717 // WR and WI not really required in this call
718 logical *BWORK = (logical*)malloc(n*sizeof(logical));
719 integer res;
720 integer sdim;
721 dgees_ ("V","N",NULL,&n,sp,&n,&sdim,WR,WI,up,&n,WORK,&lwork,BWORK,&res);
722 CHECK(res,res);
723 free(WR);
724 free(WI);
725 free(BWORK);
726 free(WORK);
727 OK
728}
729
730int schur_l_C(KCMAT(a), CMAT(u), CMAT(s)) {
731 integer m = ar;
732 integer n = ac;
733 REQUIRES(m>=1 && n==m && ur==n && uc==n && sr==n && sc==n, BAD_SIZE);
734 DEBUGMSG("schur_l_C");
735 memcpy(sp,ap,n*n*sizeof(doublecomplex));
736 integer lwork = 6*n; // fixme
737 doublecomplex *WORK = (doublecomplex*)malloc(lwork*sizeof(doublecomplex));
738 doublecomplex *W = (doublecomplex*)malloc(n*sizeof(doublecomplex));
739 // W not really required in this call
740 logical *BWORK = (logical*)malloc(n*sizeof(logical));
741 double *RWORK = (double*)malloc(n*sizeof(double));
742 integer res;
743 integer sdim;
744 zgees_ ("V","N",NULL,&n,(doublecomplex*)sp,&n,&sdim,W,
745 (doublecomplex*)up,&n,
746 WORK,&lwork,RWORK,BWORK,&res);
747 CHECK(res,res);
748 free(W);
749 free(BWORK);
750 free(WORK);
751 OK
752}
diff --git a/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.h b/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.h
index 52ac41e..e5d74d7 100644
--- a/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.h
+++ b/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.h
@@ -48,3 +48,7 @@ int qr_l_C(KCMAT(a), CVEC(tau), CMAT(r));
48int hess_l_R(KDMAT(a), DVEC(tau), DMAT(r)); 48int hess_l_R(KDMAT(a), DVEC(tau), DMAT(r));
49 49
50int hess_l_C(KCMAT(a), CVEC(tau), CMAT(r)); 50int hess_l_C(KCMAT(a), CVEC(tau), CMAT(r));
51
52int schur_l_R(KDMAT(a), DMAT(u), DMAT(s));
53
54int schur_l_C(KCMAT(a), CMAT(u), CMAT(s));