10 #ifndef EIGEN_KLUSUPPORT_H
11 #define EIGEN_KLUSUPPORT_H
36 inline int klu_solve(klu_symbolic *Symbolic, klu_numeric *Numeric,
Index ldim,
Index nrhs,
double B [ ], klu_common *Common,
double) {
37 return klu_solve(Symbolic, Numeric, internal::convert_index<int>(ldim), internal::convert_index<int>(nrhs),
B, Common);
40 inline int klu_solve(klu_symbolic *Symbolic, klu_numeric *Numeric,
Index ldim,
Index nrhs, std::complex<double>
B[], klu_common *Common, std::complex<double>) {
41 return klu_z_solve(Symbolic, Numeric, internal::convert_index<int>(ldim), internal::convert_index<int>(nrhs), &
numext::real_ref(
B[0]), Common);
44 inline int klu_tsolve(klu_symbolic *Symbolic, klu_numeric *Numeric,
Index ldim,
Index nrhs,
double B[], klu_common *Common,
double) {
45 return klu_tsolve(Symbolic, Numeric, internal::convert_index<int>(ldim), internal::convert_index<int>(nrhs),
B, Common);
48 inline int klu_tsolve(klu_symbolic *Symbolic, klu_numeric *Numeric,
Index ldim,
Index nrhs, std::complex<double>
B[], klu_common *Common, std::complex<double>) {
49 return klu_z_tsolve(Symbolic, Numeric, internal::convert_index<int>(ldim), internal::convert_index<int>(nrhs), &
numext::real_ref(
B[0]), 0, Common);
52 inline klu_numeric*
klu_factor(
int Ap [ ],
int Ai [ ],
double Ax [ ], klu_symbolic *Symbolic, klu_common *Common,
double) {
53 return klu_factor(Ap, Ai, Ax, Symbolic, Common);
56 inline klu_numeric*
klu_factor(
int Ap[],
int Ai[], std::complex<double> Ax[], klu_symbolic *Symbolic, klu_common *Common, std::complex<double>) {
61 template<
typename MatrixType_>
68 using Base::_solve_impl;
92 template<
typename InputMatrixType>
93 explicit KLU(
const InputMatrixType& matrix)
148 template<
typename InputMatrixType>
153 grab(matrix.derived());
164 template<
typename InputMatrixType>
170 grab(matrix.derived());
202 template<
typename InputMatrixType>
209 grab(matrix.derived());
215 template<
typename BDerived,
typename XDerived>
219 Scalar determinant()
const;
221 void extractData()
const;
265 template<
typename MatrixDerived>
305 template<
typename MatrixType>
306 void KLU<MatrixType>::extractData()
const
308 if (m_extractedDataAreDirty)
310 eigen_assert(
false &&
"KLU: extractData Not Yet Implemented");
318 m_l.resizeNonZeros(lnz);
321 m_u.resizeNonZeros(unz);
328 m_u.outerIndexPtr(), m_u.innerIndexPtr(), m_u.valuePtr(),
329 m_p.data(), m_q.data(), 0, 0, 0, m_numeric);
331 m_extractedDataAreDirty =
false;
335 template<
typename MatrixType>
338 eigen_assert(
false &&
"KLU: extractData Not Yet Implemented");
343 template<
typename MatrixType>
344 template<
typename BDerived,
typename XDerived>
349 eigen_assert(m_factorizationIsOk &&
"The decomposition is not in a valid state for solving, you must first call either compute() or analyzePattern()/factorize()");
352 int info =
klu_solve(m_symbolic, m_numeric,
b.rows(), rhsCols,
x.const_cast_derived().data(),
const_cast<klu_common*
>(&m_common),
Scalar());
#define EIGEN_STATIC_ASSERT(X, MSG)
NumTraits< Scalar >::Real RealScalar
internal::traits< Derived >::StorageIndex StorageIndex
The type used to store indices.
internal::traits< Derived >::Scalar Scalar
klu_symbolic * m_symbolic
EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
const klu_common & kluCommon() const
void compute(const InputMatrixType &matrix)
void factorize(const InputMatrixType &matrix)
SparseSolverBase< KLU< MatrixType_ > > Base
void grab(const EigenBase< MatrixDerived > &A)
Ref< const KLUMatrixType, StandardCompressedFormat > KLUMatrixRef
SparseMatrix< Scalar, ColMajor, int > KLUMatrixType
EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
MatrixType::StorageIndex StorageIndex
ComputationInfo info() const
Reports whether previous computation was successful.
KLU(const InputMatrixType &matrix)
bool _solve_impl(const MatrixBase< BDerived > &b, MatrixBase< XDerived > &x) const
MatrixType::RealScalar RealScalar
bool m_extractedDataAreDirty
void analyzePattern_impl()
Matrix< Scalar, Dynamic, 1 > Vector
Matrix< int, 1, MatrixType::ColsAtCompileTime > IntRowVectorType
Matrix< int, MatrixType::RowsAtCompileTime, 1 > IntColVectorType
MatrixType::Scalar Scalar
SparseMatrix< Scalar > LUMatrixType
void grab(const KLUMatrixRef &A)
void analyzePattern(const InputMatrixType &matrix)
Base class for all dense matrices, vectors, and expressions.
A base class for sparse solvers.
int klu_solve(klu_symbolic *Symbolic, klu_numeric *Numeric, Index ldim, Index nrhs, double B[], klu_common *Common, double)
A sparse LU factorization and solver based on KLU.
const unsigned int RowMajorBit
bfloat16() min(const bfloat16 &a, const bfloat16 &b)
T * construct_at(T *p, Args &&... args)
internal::add_const_on_value_type_t< EIGEN_MATHFUNC_RETVAL(real_ref, Scalar) > real_ref(const Scalar &x)
int umfpack_get_numeric(int Lp[], int Lj[], double Lx[], int Up[], int Ui[], double Ux[], int P[], int Q[], double Dx[], int *do_recip, double Rs[], void *Numeric)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
klu_numeric * klu_factor(int Ap[], int Ai[], double Ax[], klu_symbolic *Symbolic, klu_common *Common, double)
int klu_tsolve(klu_symbolic *Symbolic, klu_numeric *Numeric, Index ldim, Index nrhs, double B[], klu_common *Common, double)
int umfpack_get_lunz(int *lnz, int *unz, int *n_row, int *n_col, int *nz_udiag, void *Numeric, double)