aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2009-09-04 18:19:34 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2009-09-04 18:19:34 +0200
commite4f94b8c58bcfe63c444463b69ac272122175d55 (patch)
treea6b2315c470fa9fef834e585ff972a5864c91dde /Eigen
parent80179e954916cdd8222aaa1f5e7b991c421214a5 (diff)
enable ILU in super LU only if the super version supports it
Diffstat (limited to 'Eigen')
-rw-r--r--Eigen/src/Sparse/SuperLUSupport.h23
1 files changed, 21 insertions, 2 deletions
diff --git a/Eigen/src/Sparse/SuperLUSupport.h b/Eigen/src/Sparse/SuperLUSupport.h
index ad0c5cd92..98d598809 100644
--- a/Eigen/src/Sparse/SuperLUSupport.h
+++ b/Eigen/src/Sparse/SuperLUSupport.h
@@ -48,6 +48,12 @@ DECL_GSSVX(SuperLU_C,cgssvx,float,std::complex<float>)
DECL_GSSVX(SuperLU_D,dgssvx,double,double)
DECL_GSSVX(SuperLU_Z,zgssvx,double,std::complex<double>)
+#ifdef MILU_ALPHA
+#define EIGEN_SUPERLU_HAS_ILU
+#endif
+
+#ifdef EIGEN_SUPERLU_HAS_ILU
+
// similarly for the incomplete factorization using gsisx
#define DECL_GSISX(NAMESPACE,FNAME,FLOATTYPE,KEYTYPE) \
inline float SuperLU_gsisx(superlu_options_t *options, SuperMatrix *A, \
@@ -71,6 +77,8 @@ DECL_GSISX(SuperLU_C,cgsisx,float,std::complex<float>)
DECL_GSISX(SuperLU_D,dgsisx,double,double)
DECL_GSISX(SuperLU_Z,zgsisx,double,std::complex<double>)
+#endif
+
template<typename MatrixType>
struct SluMatrixMapHelper;
@@ -94,7 +102,7 @@ struct SluMatrix : SuperMatrix
Store = &storage;
storage = other.storage;
}
-
+
SluMatrix& operator=(const SluMatrix& other)
{
SuperMatrix::operator=(static_cast<const SuperMatrix&>(other));
@@ -420,6 +428,7 @@ void SparseLU<MatrixType,SuperLU>::compute(const MatrixType& a)
StatInit(&m_sluStat);
if (m_flags&IncompleteFactorization)
{
+ #ifdef EIGEN_SUPERLU_HAS_ILU
ilu_set_default_options(&m_sluOptions);
// no attempt to preserve column sum
@@ -430,7 +439,7 @@ void SparseLU<MatrixType,SuperLU>::compute(const MatrixType& a)
// and set ILU_FillFactor to max memory growth
m_sluOptions.ILU_DropRule = DROP_BASIC;
m_sluOptions.ILU_DropTol = Base::m_precision;
-
+
SuperLU_gsisx(&m_sluOptions, &m_sluA, m_q.data(), m_p.data(), &m_sluEtree[0],
&m_sluEqued, &m_sluRscale[0], &m_sluCscale[0],
&m_sluL, &m_sluU,
@@ -438,6 +447,11 @@ void SparseLU<MatrixType,SuperLU>::compute(const MatrixType& a)
&m_sluB, &m_sluX,
&recip_pivot_gross, &rcond,
&m_sluStat, &info, Scalar());
+ #else
+ std::cerr << "Incomplete factorization is only available in SuperLU v4\n";
+ Base::m_succeeded = false;
+ return;
+ #endif
}
else
{
@@ -490,6 +504,7 @@ bool SparseLU<MatrixType,SuperLU>::solve(const MatrixBase<BDerived> &b,
if (m_flags&IncompleteFactorization)
{
+ #ifdef EIGEN_SUPERLU_HAS_ILU
SuperLU_gsisx(&m_sluOptions, &m_sluA, m_q.data(), m_p.data(), &m_sluEtree[0],
&m_sluEqued, &m_sluRscale[0], &m_sluCscale[0],
&m_sluL, &m_sluU,
@@ -497,6 +512,10 @@ bool SparseLU<MatrixType,SuperLU>::solve(const MatrixBase<BDerived> &b,
&m_sluB, &m_sluX,
&recip_pivot_gross, &rcond,
&m_sluStat, &info, Scalar());
+ #else
+ std::cerr << "Incomplete factorization is only available in SuperLU v4\n";
+ return false;
+ #endif
}
else
{