aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2010-05-19 16:49:05 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2010-05-19 16:49:05 +0200
commit64cbd452669bccdb2470ddaf74f1312b4566b48e (patch)
tree54d1589b9b66a1c660b138ed92bf1e01589b5240 /Eigen
parent2b6153d3ed3fb0096a6f10e97c884b1ad559192e (diff)
minor chnages in Taucs and Cholmod backends
Diffstat (limited to 'Eigen')
-rw-r--r--Eigen/src/Sparse/CholmodSupport.h9
-rw-r--r--Eigen/src/Sparse/TaucsSupport.h12
2 files changed, 15 insertions, 6 deletions
diff --git a/Eigen/src/Sparse/CholmodSupport.h b/Eigen/src/Sparse/CholmodSupport.h
index a9ef2d3a4..cf407240f 100644
--- a/Eigen/src/Sparse/CholmodSupport.h
+++ b/Eigen/src/Sparse/CholmodSupport.h
@@ -31,22 +31,22 @@ void ei_cholmod_configure_matrix(CholmodType& mat)
if (ei_is_same_type<Scalar,float>::ret)
{
mat.xtype = CHOLMOD_REAL;
- mat.dtype = 1;
+ mat.dtype = CHOLMOD_SINGLE;
}
else if (ei_is_same_type<Scalar,double>::ret)
{
mat.xtype = CHOLMOD_REAL;
- mat.dtype = 0;
+ mat.dtype = CHOLMOD_DOUBLE;
}
else if (ei_is_same_type<Scalar,std::complex<float> >::ret)
{
mat.xtype = CHOLMOD_COMPLEX;
- mat.dtype = 1;
+ mat.dtype = CHOLMOD_SINGLE;
}
else if (ei_is_same_type<Scalar,std::complex<double> >::ret)
{
mat.xtype = CHOLMOD_COMPLEX;
- mat.dtype = 0;
+ mat.dtype = CHOLMOD_DOUBLE;
}
else
{
@@ -74,6 +74,7 @@ cholmod_sparse SparseMatrixBase<Derived>::asCholmodMatrix()
ei_cholmod_configure_matrix<Scalar>(res);
+
if (Derived::Flags & SelfAdjoint)
{
if (Derived::Flags & Upper)
diff --git a/Eigen/src/Sparse/TaucsSupport.h b/Eigen/src/Sparse/TaucsSupport.h
index 0caa8cbed..2a1963f5b 100644
--- a/Eigen/src/Sparse/TaucsSupport.h
+++ b/Eigen/src/Sparse/TaucsSupport.h
@@ -50,6 +50,7 @@ taucs_ccs_matrix SparseMatrixBase<Derived>::asTaucsMatrix()
ei_assert(false && "Scalar type not supported by TAUCS");
}
+ // FIXME 1) shapes are not in the Flags and 2) it seems Taucs ignores these flags anyway and only accept lower symmetric matrices
if (Flags & Upper)
res.flags |= TAUCS_UPPER;
if (Flags & Lower)
@@ -86,6 +87,7 @@ class SparseLLT<MatrixType,Taucs> : public SparseLLT<MatrixType>
using Base::m_flags;
using Base::m_matrix;
using Base::m_status;
+ using Base::m_succeeded;
public:
@@ -126,10 +128,16 @@ void SparseLLT<MatrixType,Taucs>::compute(const MatrixType& a)
m_taucsSupernodalFactor = 0;
}
+ taucs_ccs_matrix taucsMatA = const_cast<MatrixType&>(a).asTaucsMatrix();
+
if (m_flags & IncompleteFactorization)
{
- taucs_ccs_matrix taucsMatA = const_cast<MatrixType&>(a).asTaucsMatrix();
taucs_ccs_matrix* taucsRes = taucs_ccs_factor_llt(&taucsMatA, Base::m_precision, 0);
+ if(!taucsRes)
+ {
+ m_succeeded = false;
+ return;
+ }
// the matrix returned by Taucs is not necessarily sorted,
// so let's copy it in two steps
DynamicSparseMatrix<Scalar,RowMajor> tmp = MappedSparseMatrix<Scalar>(*taucsRes);
@@ -141,7 +149,6 @@ void SparseLLT<MatrixType,Taucs>::compute(const MatrixType& a)
}
else
{
- taucs_ccs_matrix taucsMatA = const_cast<MatrixType&>(a).asTaucsMatrix();
if ( (m_flags & SupernodalLeftLooking)
|| ((!(m_flags & SupernodalMultifrontal)) && (m_flags & MemoryEfficient)) )
{
@@ -154,6 +161,7 @@ void SparseLLT<MatrixType,Taucs>::compute(const MatrixType& a)
}
m_status = (m_status & ~IncompleteFactorization) | CompleteFactorization | MatrixLIsDirty;
}
+ m_succeeded = true;
}
template<typename MatrixType>