From b2341058a2214d22dc23f516b6f09d3270faa18d Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Sat, 11 Jul 2015 14:19:21 +0200 Subject: ldl factorization --- packages/base/src/Internal/C/lapack-aux.c | 107 ++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) (limited to 'packages/base/src/Internal/C/lapack-aux.c') diff --git a/packages/base/src/Internal/C/lapack-aux.c b/packages/base/src/Internal/C/lapack-aux.c index 30689bf..177d373 100644 --- a/packages/base/src/Internal/C/lapack-aux.c +++ b/packages/base/src/Internal/C/lapack-aux.c @@ -1086,6 +1086,113 @@ int luS_l_C(KOCMAT(a), KDVEC(ipiv), OCMAT(b)) { OK } + +//////////////////// LDL factorization ///////////////////////// + +int dsytrf_(char *uplo, integer *n, doublereal *a, integer *lda, integer *ipiv, + doublereal *work, integer *lwork, integer *info); + +int ldl_R(DVEC(ipiv), ODMAT(r)) { + integer n = rr; + REQUIRES(n>=1 && rc==n && ipivn == n, BAD_SIZE); + DEBUGMSG("ldl_R"); + integer* auxipiv = (integer*)malloc(n*sizeof(integer)); + integer res; + integer lda = rXc; + integer lwork = -1; + doublereal ans; + dsytrf_ ("L",&n,rp,&lda,auxipiv,&ans,&lwork,&res); + lwork = ceil(ans); + doublereal* work = (doublereal*)malloc(lwork*sizeof(doublereal)); + dsytrf_ ("L",&n,rp,&lda,auxipiv,work,&lwork,&res); + CHECK(res,res); + int k; + for (k=0; k=1 && rc==n && ipivn == n, BAD_SIZE); + DEBUGMSG("ldl_R"); + integer* auxipiv = (integer*)malloc(n*sizeof(integer)); + integer res; + integer lda = rXc; + integer lwork = -1; + doublecomplex ans; + zhetrf_ ("L",&n,rp,&lda,auxipiv,&ans,&lwork,&res); + lwork = ceil(ans.r); + doublecomplex* work = (doublecomplex*)malloc(lwork*sizeof(doublecomplex)); + zhetrf_ ("L",&n,rp,&lda,auxipiv,work,&lwork,&res); + CHECK(res,res); + int k; + for (k=0; k