32 #ifndef EIGEN_PARDISOSUPPORT_H 33 #define EIGEN_PARDISOSUPPORT_H 38 template<
typename _MatrixType,
int Options=Upper>
class PardisoLLT;
39 template<
typename _MatrixType,
int Options=Upper>
class PardisoLDLT;
43 template<
typename IndexType>
46 static IndexType
run( _MKL_DSS_HANDLE_t
pt, IndexType maxfct, IndexType mnum, IndexType
type, IndexType phase, IndexType
n,
void *
a,
47 IndexType *ia, IndexType *ja, IndexType *
perm, IndexType nrhs, IndexType *iparm, IndexType msglvl,
void *
b,
void *
x)
50 ::pardiso(pt, &maxfct, &mnum, &type, &phase, &n, a, ia, ja, perm, &nrhs, iparm, &msglvl, b, x, &error);
58 static IndexType
run( _MKL_DSS_HANDLE_t
pt, IndexType maxfct, IndexType mnum, IndexType
type, IndexType phase, IndexType
n,
void *
a,
59 IndexType *ia, IndexType *ja, IndexType *
perm, IndexType nrhs, IndexType *iparm, IndexType msglvl,
void *
b,
void *
x)
62 ::pardiso_64(pt, &maxfct, &mnum, &type, &phase, &n, a, ia, ja, perm, &nrhs, iparm, &msglvl, b, x, &error);
69 template<
typename _MatrixType>
78 template<
typename _MatrixType,
int Options>
87 template<
typename _MatrixType,
int Options>
98 template<
class Derived>
104 using Base::m_isInitialized;
108 using Base::_solve_impl;
127 eigen_assert((
sizeof(StorageIndex) >=
sizeof(_INTEGER_t) &&
sizeof(StorageIndex) <= 8) &&
"Non-supported index type");
130 m_isInitialized =
false;
148 eigen_assert(m_isInitialized &&
"Decomposition is not initialized.");
166 Derived& analyzePattern(
const MatrixType&
matrix);
174 Derived& factorize(
const MatrixType& matrix);
176 Derived&
compute(
const MatrixType& matrix);
178 template<
typename Rhs,
typename Dest>
186 internal::pardiso_run_selector<StorageIndex>::run(m_pt, 1, 1, m_type, -1, internal::convert_index<StorageIndex>(m_size),0, 0, 0, m_perm.data(), 0,
187 m_iparm.data(), m_msglvl,
NULL,
NULL);
188 m_isInitialized =
false;
195 bool symmetric =
std::abs(m_type) < 10;
206 m_iparm[10] = symmetric ? 0 : 1;
208 m_iparm[12] = symmetric ? 0 : 1;
220 m_iparm[27] = (
sizeof(
RealScalar) == 4) ? 1 : 0;
225 memset(m_pt, 0,
sizeof(m_pt));
251 mutable void *m_pt[64];
258 template<
class Derived>
265 m_perm.setZero(m_size);
266 derived().getMatrix(a);
270 m_matrix.valuePtr(), m_matrix.outerIndexPtr(), m_matrix.innerIndexPtr(),
271 m_perm.data(), 0, m_iparm.data(), m_msglvl,
NULL,
NULL);
272 manageErrorCode(error);
273 m_analysisIsOk =
true;
274 m_factorizationIsOk =
true;
275 m_isInitialized =
true;
279 template<
class Derived>
286 m_perm.setZero(m_size);
287 derived().getMatrix(a);
291 m_matrix.valuePtr(), m_matrix.outerIndexPtr(), m_matrix.innerIndexPtr(),
292 m_perm.data(), 0, m_iparm.data(), m_msglvl,
NULL,
NULL);
294 manageErrorCode(error);
295 m_analysisIsOk =
true;
296 m_factorizationIsOk =
false;
297 m_isInitialized =
true;
301 template<
class Derived>
304 eigen_assert(m_analysisIsOk &&
"You must first call analyzePattern()");
307 derived().getMatrix(a);
311 m_matrix.valuePtr(), m_matrix.outerIndexPtr(), m_matrix.innerIndexPtr(),
312 m_perm.data(), 0, m_iparm.data(), m_msglvl,
NULL,
NULL);
314 manageErrorCode(error);
315 m_factorizationIsOk =
true;
319 template<
class Derived>
320 template<
typename BDerived,
typename XDerived>
334 eigen_assert(((nrhs == 1) || b.outerStride() == b.rows()));
346 Scalar* rhs_ptr =
const_cast<Scalar*
>(b.derived().data());
350 if(rhs_ptr == x.derived().data())
353 rhs_ptr = tmp.
data();
358 m_matrix.valuePtr(), m_matrix.outerIndexPtr(), m_matrix.innerIndexPtr(),
359 m_perm.data(), internal::convert_index<StorageIndex>(nrhs), m_iparm.data(), m_msglvl,
360 rhs_ptr, x.derived().data());
362 manageErrorCode(error);
383 template<
typename MatrixType>
390 using Base::pardisoInit;
391 using Base::m_matrix;
402 pardisoInit(Base::ScalarIsComplex ? 13 : 11);
408 pardisoInit(Base::ScalarIsComplex ? 13 : 11);
415 m_matrix.makeCompressed();
438 template<
typename MatrixType,
int _UpLo>
445 using Base::pardisoInit;
446 using Base::m_matrix;
452 enum { UpLo = _UpLo };
458 pardisoInit(Base::ScalarIsComplex ? 4 : 2);
464 pardisoInit(Base::ScalarIsComplex ? 4 : 2);
474 m_matrix.
resize(matrix.rows(), matrix.cols());
475 m_matrix.template selfadjointView<Upper>() = matrix.template selfadjointView<UpLo>().twistedBy(p_null);
476 m_matrix.makeCompressed();
501 template<
typename MatrixType,
int Options>
508 using Base::pardisoInit;
509 using Base::m_matrix;
521 pardisoInit(Base::ScalarIsComplex ? (
bool(Options&
Symmetric) ? 6 : -4 ) : -2);
527 pardisoInit(Base::ScalarIsComplex ? (
bool(Options&
Symmetric) ? 6 : -4 ) : -2);
535 m_matrix.
resize(matrix.rows(), matrix.cols());
536 m_matrix.template selfadjointView<Upper>() = matrix.template selfadjointView<UpLo>().twistedBy(p_null);
537 m_matrix.makeCompressed();
543 #endif // EIGEN_PARDISOSUPPORT_H
static IndexType run(_MKL_DSS_HANDLE_t pt, IndexType maxfct, IndexType mnum, IndexType type, IndexType phase, IndexType n, void *a, IndexType *ia, IndexType *ja, IndexType *perm, IndexType nrhs, IndexType *iparm, IndexType msglvl, void *b, void *x)
Matrix< StorageIndex, 1, MatrixType::ColsAtCompileTime > IntRowVectorType
_MatrixType::Scalar Scalar
SparseMatrix< Scalar, RowMajor, StorageIndex > SparseMatrixType
Derived & compute(const MatrixType &matrix)
Derived & factorize(const MatrixType &matrix)
void _solve_impl(const MatrixBase< Rhs > &b, MatrixBase< Dest > &dest) const
_MatrixType::StorageIndex StorageIndex
PardisoLDLT(const MatrixType &matrix)
A base class for sparse solvers.
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar * data() const
_MatrixType::StorageIndex StorageIndex
Namespace containing all symbols from the Eigen library.
Matrix< StorageIndex, MatrixType::RowsAtCompileTime, 1 > IntColVectorType
Traits::StorageIndex StorageIndex
PardisoImpl< PardisoLLT< MatrixType, _UpLo > > Base
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
Array< StorageIndex, 64, 1, DontAlign > ParameterType
static const Point3 pt(1.0, 2.0, 3.0)
void getMatrix(const MatrixType &matrix)
_MatrixType::RealScalar RealScalar
const unsigned int RowMajorBit
static IndexType run(_MKL_DSS_HANDLE_t pt, IndexType maxfct, IndexType mnum, IndexType type, IndexType phase, IndexType n, void *a, IndexType *ia, IndexType *ja, IndexType *perm, IndexType nrhs, IndexType *iparm, IndexType msglvl, void *b, void *x)
Traits::RealScalar RealScalar
Base::RealScalar RealScalar
A sparse direct Cholesky (LLT) factorization and solver based on the PARDISO library.
Base::StorageIndex StorageIndex
void pardisoInit(int type)
Derived & analyzePattern(const MatrixType &matrix)
_MatrixType::StorageIndex StorageIndex
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
_MatrixType::RealScalar RealScalar
PardisoImpl< PardisoLU > Base
idx_t idx_t idx_t idx_t idx_t * perm
Base::RealScalar RealScalar
A sparse direct LU factorization and solver based on the PARDISO library.
Matrix< Scalar, Dynamic, 1 > VectorType
NumTraits< Scalar >::Real RealScalar
void manageErrorCode(Index error) const
internal::pardiso_traits< Derived > Traits
ComputationInfo info() const
Reports whether previous computation was successful.
void getMatrix(const MatrixType &matrix)
Base::RealScalar RealScalar
SparseSolverBase< Derived > Base
PardisoImpl< PardisoLDLT< MatrixType, Options > > Base
A sparse direct Cholesky (LDLT) factorization and solver based on the PARDISO library.
ParameterType & pardisoParameterArray()
void getMatrix(const MatrixType &matrix)
Traits::MatrixType MatrixType
EIGEN_DONT_INLINE void compute(Solver &solver, const MatrixType &A)
Map< Matrix< T, Dynamic, Dynamic, ColMajor >, 0, OuterStride<> > matrix(T *data, int rows, int cols, int stride)
void resize(Index newSize)
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
Base class for all dense matrices, vectors, and expressions.
SparseMatrixType m_matrix
_MatrixType::Scalar Scalar
_MatrixType::RealScalar RealScalar
PardisoLLT(const MatrixType &matrix)
PardisoLU(const MatrixType &matrix)
Base::StorageIndex StorageIndex
_MatrixType::Scalar Scalar