aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/Eigen/src/SparseExtra/SuperLUSupport.h
diff options
context:
space:
mode:
Diffstat (limited to 'unsupported/Eigen/src/SparseExtra/SuperLUSupport.h')
-rw-r--r--unsupported/Eigen/src/SparseExtra/SuperLUSupport.h36
1 files changed, 20 insertions, 16 deletions
diff --git a/unsupported/Eigen/src/SparseExtra/SuperLUSupport.h b/unsupported/Eigen/src/SparseExtra/SuperLUSupport.h
index 9453aabce..31a0ee509 100644
--- a/unsupported/Eigen/src/SparseExtra/SuperLUSupport.h
+++ b/unsupported/Eigen/src/SparseExtra/SuperLUSupport.h
@@ -126,7 +126,7 @@ struct SluMatrix : SuperMatrix
Store = &storage;
else
{
- ei_assert(false && "storage type not supported");
+ eigen_assert(false && "storage type not supported");
Store = 0;
}
}
@@ -134,17 +134,17 @@ struct SluMatrix : SuperMatrix
template<typename Scalar>
void setScalarType()
{
- if (ei_is_same_type<Scalar,float>::ret)
+ if (internal::is_same_type<Scalar,float>::ret)
Dtype = SLU_S;
- else if (ei_is_same_type<Scalar,double>::ret)
+ else if (internal::is_same_type<Scalar,double>::ret)
Dtype = SLU_D;
- else if (ei_is_same_type<Scalar,std::complex<float> >::ret)
+ else if (internal::is_same_type<Scalar,std::complex<float> >::ret)
Dtype = SLU_C;
- else if (ei_is_same_type<Scalar,std::complex<double> >::ret)
+ else if (internal::is_same_type<Scalar,std::complex<double> >::ret)
Dtype = SLU_Z;
else
{
- ei_assert(false && "Scalar type not supported by SuperLU");
+ eigen_assert(false && "Scalar type not supported by SuperLU");
}
}
@@ -152,7 +152,7 @@ struct SluMatrix : SuperMatrix
static SluMatrix Map(Matrix<Scalar,Rows,Cols,Options,MRows,MCols>& mat)
{
typedef Matrix<Scalar,Rows,Cols,Options,MRows,MCols> MatrixType;
- ei_assert( ((Options&RowMajor)!=RowMajor) && "row-major dense matrices is not supported by SuperLU");
+ eigen_assert( ((Options&RowMajor)!=RowMajor) && "row-major dense matrices is not supported by SuperLU");
SluMatrix res;
res.setStorageType(SLU_DN);
res.setScalarType<Scalar>();
@@ -198,7 +198,7 @@ struct SluMatrix : SuperMatrix
if (MatrixType::Flags & Lower)
res.Mtype = SLU_TRL;
if (MatrixType::Flags & SelfAdjoint)
- ei_assert(false && "SelfAdjoint matrix shape not supported by SuperLU");
+ eigen_assert(false && "SelfAdjoint matrix shape not supported by SuperLU");
return res;
}
};
@@ -209,7 +209,7 @@ struct SluMatrixMapHelper<Matrix<Scalar,Rows,Cols,Options,MRows,MCols> >
typedef Matrix<Scalar,Rows,Cols,Options,MRows,MCols> MatrixType;
static void run(MatrixType& mat, SluMatrix& res)
{
- ei_assert( ((Options&RowMajor)!=RowMajor) && "row-major dense matrices is not supported by SuperLU");
+ eigen_assert( ((Options&RowMajor)!=RowMajor) && "row-major dense matrices is not supported by SuperLU");
res.setStorageType(SLU_DN);
res.setScalarType<Scalar>();
res.Mtype = SLU_GE;
@@ -256,21 +256,23 @@ struct SluMatrixMapHelper<SparseMatrixBase<Derived> >
if (MatrixType::Flags & Lower)
res.Mtype = SLU_TRL;
if (MatrixType::Flags & SelfAdjoint)
- ei_assert(false && "SelfAdjoint matrix shape not supported by SuperLU");
+ eigen_assert(false && "SelfAdjoint matrix shape not supported by SuperLU");
}
};
+namespace internal {
+
template<typename MatrixType>
-SluMatrix ei_asSluMatrix(MatrixType& mat)
+SluMatrix asSluMatrix(MatrixType& mat)
{
return SluMatrix::Map(mat);
}
/** View a Super LU matrix as an Eigen expression */
template<typename Scalar, int Flags, typename Index>
-MappedSparseMatrix<Scalar,Flags,Index> ei_map_superlu(SluMatrix& sluMat)
+MappedSparseMatrix<Scalar,Flags,Index> map_superlu(SluMatrix& sluMat)
{
- ei_assert((Flags&RowMajor)==RowMajor && sluMat.Stype == SLU_NR
+ eigen_assert((Flags&RowMajor)==RowMajor && sluMat.Stype == SLU_NR
|| (Flags&ColMajor)==ColMajor && sluMat.Stype == SLU_NC);
Index outerSize = (Flags&RowMajor)==RowMajor ? sluMat.ncol : sluMat.nrow;
@@ -280,6 +282,8 @@ MappedSparseMatrix<Scalar,Flags,Index> ei_map_superlu(SluMatrix& sluMat)
sluMat.storage.outerInd, sluMat.storage.innerInd, reinterpret_cast<Scalar*>(sluMat.storage.values) );
}
+} // end namespace internal
+
template<typename MatrixType>
class SparseLU<MatrixType,SuperLU> : public SparseLU<MatrixType>
{
@@ -393,7 +397,7 @@ void SparseLU<MatrixType,SuperLU>::compute(const MatrixType& a)
m_sluOptions.ColPerm = NATURAL;
};
- m_sluA = ei_asSluMatrix(m_matrix);
+ m_sluA = internal::asSluMatrix(m_matrix);
memset(&m_sluL,0,sizeof m_sluL);
memset(&m_sluU,0,sizeof m_sluU);
//m_sluEqued = 'B';
@@ -471,7 +475,7 @@ bool SparseLU<MatrixType,SuperLU>::solve(const MatrixBase<BDerived> &b,
{
const int size = m_matrix.rows();
const int rhsCols = b.cols();
- ei_assert(size==b.rows());
+ eigen_assert(size==b.rows());
switch (transposed) {
case SvNoTrans : m_sluOptions.Trans = NOTRANS; break;
@@ -637,7 +641,7 @@ typename SparseLU<MatrixType,SuperLU>::Scalar SparseLU<MatrixType,SuperLU>::dete
if (m_u._outerIndexPtr()[j+1]-m_u._outerIndexPtr()[j] > 0)
{
int lastId = m_u._outerIndexPtr()[j+1]-1;
- ei_assert(m_u._innerIndexPtr()[lastId]<=j);
+ eigen_assert(m_u._innerIndexPtr()[lastId]<=j);
if (m_u._innerIndexPtr()[lastId]==j)
{
det *= m_u._valuePtr()[lastId];