32 #ifndef EIGEN_PARDISOSUPPORT_H
33 #define EIGEN_PARDISOSUPPORT_H
37 template<
typename _MatrixType>
class PardisoLU;
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);
62 ::pardiso_64(pt, &maxfct, &mnum, &
type, &phase, &n,
a, ia, ja, perm, &nrhs, iparm, &msglvl, b, x, &error);
69 template<
typename _MatrixType>
73 typedef typename _MatrixType::Scalar
Scalar;
78 template<
typename _MatrixType,
int Options>
82 typedef typename _MatrixType::Scalar
Scalar;
87 template<
typename _MatrixType,
int Options>
91 typedef typename _MatrixType::Scalar
Scalar;
98 template<
class Derived>
179 template<
typename Rhs,
typename Dest>
187 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,
207 m_iparm[10] = symmetric ? 0 : 1;
209 m_iparm[12] = symmetric ? 0 : 1;
259 template<
class Derived>
266 m_perm.setZero(m_size);
267 derived().getMatrix(
a);
271 m_matrix.valuePtr(), m_matrix.outerIndexPtr(), m_matrix.innerIndexPtr(),
272 m_perm.data(), 0, m_iparm.data(), m_msglvl, NULL, NULL);
273 manageErrorCode(error);
274 m_analysisIsOk =
true;
275 m_factorizationIsOk =
true;
276 m_isInitialized =
true;
280 template<
class Derived>
287 m_perm.setZero(m_size);
288 derived().getMatrix(
a);
292 m_matrix.valuePtr(), m_matrix.outerIndexPtr(), m_matrix.innerIndexPtr(),
293 m_perm.data(), 0, m_iparm.data(), m_msglvl, NULL, NULL);
295 manageErrorCode(error);
296 m_analysisIsOk =
true;
297 m_factorizationIsOk =
false;
298 m_isInitialized =
true;
302 template<
class Derived>
305 eigen_assert(m_analysisIsOk &&
"You must first call analyzePattern()");
308 derived().getMatrix(
a);
312 m_matrix.valuePtr(), m_matrix.outerIndexPtr(), m_matrix.innerIndexPtr(),
313 m_perm.data(), 0, m_iparm.data(), m_msglvl, NULL, NULL);
315 manageErrorCode(error);
316 m_factorizationIsOk =
true;
320 template<
class Derived>
321 template<
typename BDerived,
typename XDerived>
335 eigen_assert(((nrhs == 1) || b.outerStride() == b.rows()));
347 Scalar* rhs_ptr =
const_cast<Scalar*
>(b.derived().data());
351 if(rhs_ptr == x.derived().data())
354 rhs_ptr = tmp.
data();
359 m_matrix.valuePtr(), m_matrix.outerIndexPtr(), m_matrix.innerIndexPtr(),
360 m_perm.data(), internal::convert_index<StorageIndex>(nrhs), m_iparm.data(), m_msglvl,
361 rhs_ptr, x.derived().data());
363 manageErrorCode(error);
384 template<
typename MatrixType>
440 template<
typename MatrixType,
int _UpLo>
477 m_matrix.template selfadjointView<Upper>() = matrix.template selfadjointView<UpLo>().
twistedBy(p_null);
503 template<
typename MatrixType,
int Options>
538 m_matrix.template selfadjointView<Upper>() = matrix.template selfadjointView<UpLo>().
twistedBy(p_null);
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const AbsReturnType abs() const
Definition: ArrayCwiseUnaryOps.h:52
#define eigen_assert(x)
Definition: Macros.h:1037
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:50
Definition: PardisoSupport.h:100
Derived & compute(const MatrixType &matrix)
Definition: PardisoSupport.h:260
StorageIndex m_type
Definition: PardisoSupport.h:251
void * m_pt[64]
Definition: PardisoSupport.h:252
Matrix< StorageIndex, MatrixType::RowsAtCompileTime, 1 > IntColVectorType
Definition: PardisoSupport.h:117
void _solve_impl(const MatrixBase< Rhs > &b, MatrixBase< Dest > &dest) const
Traits::StorageIndex StorageIndex
Definition: PardisoSupport.h:113
~PardisoImpl()
Definition: PardisoSupport.h:134
Traits::MatrixType MatrixType
Definition: PardisoSupport.h:110
PardisoImpl()
Definition: PardisoSupport.h:125
IntColVectorType m_perm
Definition: PardisoSupport.h:254
@ MaxColsAtCompileTime
Definition: PardisoSupport.h:122
@ ColsAtCompileTime
Definition: PardisoSupport.h:121
@ ScalarIsComplex
Definition: PardisoSupport.h:120
ParameterType & pardisoParameterArray()
Definition: PardisoSupport.h:156
SparseMatrixType m_matrix
Definition: PardisoSupport.h:248
Traits::RealScalar RealScalar
Definition: PardisoSupport.h:112
void pardisoInit(int type)
Definition: PardisoSupport.h:193
Index rows() const
Definition: PardisoSupport.h:140
Index cols() const
Definition: PardisoSupport.h:139
Array< StorageIndex, 64, 1, DontAlign > ParameterType
Definition: PardisoSupport.h:118
Derived & factorize(const MatrixType &matrix)
Definition: PardisoSupport.h:303
Index m_size
Definition: PardisoSupport.h:255
ComputationInfo info() const
Reports whether previous computation was successful.
Definition: PardisoSupport.h:147
Matrix< Scalar, Dynamic, 1 > VectorType
Definition: PardisoSupport.h:115
StorageIndex m_msglvl
Definition: PardisoSupport.h:251
internal::pardiso_traits< Derived > Traits
Definition: PardisoSupport.h:106
bool m_factorizationIsOk
Definition: PardisoSupport.h:250
Matrix< StorageIndex, 1, MatrixType::ColsAtCompileTime > IntRowVectorType
Definition: PardisoSupport.h:116
SparseMatrix< Scalar, RowMajor, StorageIndex > SparseMatrixType
Definition: PardisoSupport.h:114
ComputationInfo m_info
Definition: PardisoSupport.h:249
void pardisoRelease()
Definition: PardisoSupport.h:183
bool m_isInitialized
Definition: SparseSolverBase.h:119
void manageErrorCode(Index error) const
Definition: PardisoSupport.h:232
Traits::Scalar Scalar
Definition: PardisoSupport.h:111
SparseSolverBase< Derived > Base
Definition: PardisoSupport.h:102
ParameterType m_iparm
Definition: PardisoSupport.h:253
Derived & analyzePattern(const MatrixType &matrix)
Definition: PardisoSupport.h:281
bool m_analysisIsOk
Definition: PardisoSupport.h:250
A sparse direct Cholesky (LDLT) factorization and solver based on the PARDISO library.
Definition: PardisoSupport.h:505
Base::RealScalar RealScalar
Definition: PardisoSupport.h:515
Base::Scalar Scalar
Definition: PardisoSupport.h:514
PardisoImpl< PardisoLDLT< MatrixType, Options > > Base
Definition: PardisoSupport.h:507
@ UpLo
Definition: PardisoSupport.h:518
PardisoLDLT(const MatrixType &matrix)
Definition: PardisoSupport.h:526
PardisoLDLT()
Definition: PardisoSupport.h:520
void getMatrix(const MatrixType &matrix)
Definition: PardisoSupport.h:533
Base::StorageIndex StorageIndex
Definition: PardisoSupport.h:516
A sparse direct Cholesky (LLT) factorization and solver based on the PARDISO library.
Definition: PardisoSupport.h:442
PardisoLLT(const MatrixType &matrix)
Definition: PardisoSupport.h:463
PardisoImpl< PardisoLLT< MatrixType, _UpLo > > Base
Definition: PardisoSupport.h:444
@ UpLo
Definition: PardisoSupport.h:454
Base::StorageIndex StorageIndex
Definition: PardisoSupport.h:453
PardisoLLT()
Definition: PardisoSupport.h:457
void getMatrix(const MatrixType &matrix)
Definition: PardisoSupport.h:472
Base::RealScalar RealScalar
Definition: PardisoSupport.h:452
Base::Scalar Scalar
Definition: PardisoSupport.h:451
A sparse direct LU factorization and solver based on the PARDISO library.
Definition: PardisoSupport.h:386
Derived & compute(const MatrixType &matrix)
Definition: PardisoSupport.h:260
SparseMatrixType m_matrix
Definition: PardisoSupport.h:248
void pardisoInit(int type)
Definition: PardisoSupport.h:193
Base::RealScalar RealScalar
Definition: PardisoSupport.h:396
PardisoImpl< PardisoLU > Base
Definition: PardisoSupport.h:388
PardisoLU()
Definition: PardisoSupport.h:401
Base::Scalar Scalar
Definition: PardisoSupport.h:395
PardisoLU(const MatrixType &matrix)
Definition: PardisoSupport.h:407
void getMatrix(const MatrixType &matrix)
Definition: PardisoSupport.h:414
EIGEN_DEVICE_FUNC Derived & setZero(Index size)
Definition: CwiseNullaryOp.h:562
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar * data() const
Definition: PlainObjectBase.h:247
SparseSymmetricPermutationProduct< Derived, Upper|Lower > twistedBy(const PermutationMatrix< Dynamic, Dynamic, StorageIndex > &perm) const
Definition: SparseMatrixBase.h:329
void makeCompressed()
Definition: SparseMatrix.h:467
void resize(Index rows, Index cols)
Definition: SparseMatrix.h:626
A base class for sparse solvers.
Definition: SparseSolverBase.h:68
const Solve< Derived, Rhs > solve(const MatrixBase< Rhs > &b) const
Definition: SparseSolverBase.h:88
void _solve_impl(const SparseMatrixBase< Rhs > &b, SparseMatrixBase< Dest > &dest) const
Definition: SparseSolverBase.h:111
bool m_isInitialized
Definition: SparseSolverBase.h:119
Derived & derived()
Definition: SparseSolverBase.h:79
ComputationInfo
Definition: Constants.h:440
@ Symmetric
Definition: Constants.h:227
@ Lower
Definition: Constants.h:209
@ Upper
Definition: Constants.h:211
@ NumericalIssue
Definition: Constants.h:444
@ InvalidInput
Definition: Constants.h:449
@ Success
Definition: Constants.h:442
const unsigned int RowMajorBit
Definition: Constants.h:66
Namespace containing all symbols from the Eigen library.
Definition: LDLT.h:16
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:74
const int Dynamic
Definition: Constants.h:22
type
The type the bitset is encoded with.
Definition: bitset.hpp:44
Definition: document.h:416
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition: pointer.h:1181
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition: NumTraits.h:233
long long int IndexType
Definition: PardisoSupport.h:57
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)
Definition: PardisoSupport.h:58
Definition: PardisoSupport.h:45
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)
Definition: PardisoSupport.h:46
_MatrixType::RealScalar RealScalar
Definition: PardisoSupport.h:92
_MatrixType::Scalar Scalar
Definition: PardisoSupport.h:91
_MatrixType::StorageIndex StorageIndex
Definition: PardisoSupport.h:93
_MatrixType MatrixType
Definition: PardisoSupport.h:90
_MatrixType::StorageIndex StorageIndex
Definition: PardisoSupport.h:84
_MatrixType::Scalar Scalar
Definition: PardisoSupport.h:82
_MatrixType::RealScalar RealScalar
Definition: PardisoSupport.h:83
_MatrixType MatrixType
Definition: PardisoSupport.h:81
_MatrixType::Scalar Scalar
Definition: PardisoSupport.h:73
_MatrixType MatrixType
Definition: PardisoSupport.h:72
_MatrixType::StorageIndex StorageIndex
Definition: PardisoSupport.h:75
_MatrixType::RealScalar RealScalar
Definition: PardisoSupport.h:74
Definition: PardisoSupport.h:67