mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-09-16 03:13:14 +08:00
fix BTL cholesky action and output errors if the factorization failed
This commit is contained in:
parent
837f1ae59c
commit
1731a432e7
@ -44,7 +44,7 @@ public :
|
||||
|
||||
// make sure X is invertible
|
||||
for (int i=0; i<_size; ++i)
|
||||
X_stl[i][i] = X_stl[i][i] * 1e2 + 1;
|
||||
X_stl[i][i] = std::abs(X_stl[i][i]) * 1e2 + 100;
|
||||
|
||||
// generic matrix and vector initialization
|
||||
Interface::matrix_from_stl(X_ref,X_stl);
|
||||
|
@ -246,12 +246,13 @@ public :
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void cholesky(const gene_vector & X, gene_vector & C, int N){
|
||||
static inline void cholesky(const gene_matrix & X, gene_matrix & C, int N){
|
||||
int N2 = N*N;
|
||||
scopy_(&N2, X, &intone, C, &intone);
|
||||
char uplo = 'L';
|
||||
int info = 0;
|
||||
spotrf_(&uplo, &N, C, &N, &info);
|
||||
if(info!=0) std::cerr << "spotrf_ error " << info << "\n";
|
||||
}
|
||||
|
||||
static inline void partial_lu_decomp(const gene_matrix & X, gene_matrix & C, int N){
|
||||
@ -261,6 +262,7 @@ public :
|
||||
int info = 0;
|
||||
int * ipiv = (int*)alloca(sizeof(int)*N);
|
||||
sgetrf_(&N, &N, C, &N, ipiv, &info);
|
||||
if(info!=0) std::cerr << "sgetrf_ error " << info << "\n";
|
||||
}
|
||||
|
||||
#ifdef HAS_LAPACK
|
||||
|
Loading…
x
Reference in New Issue
Block a user