10 #ifndef EIGEN_UMFPACKSUPPORT_H 11 #define EIGEN_UMFPACKSUPPORT_H 21 { umfpack_di_defaults(control); }
24 { umfpack_zi_defaults(control); }
27 { umfpack_di_report_info(control, info);}
29 inline void umfpack_report_info(
double control[UMFPACK_CONTROL],
double info[UMFPACK_INFO], std::complex<double>)
30 { umfpack_zi_report_info(control, info);}
33 { umfpack_di_report_status(control, status);}
36 { umfpack_zi_report_status(control, status);}
39 { umfpack_di_report_control(control);}
42 { umfpack_zi_report_control(control);}
45 { umfpack_di_free_numeric(Numeric); *Numeric = 0; }
48 { umfpack_zi_free_numeric(Numeric); *Numeric = 0; }
51 { umfpack_di_free_symbolic(Symbolic); *Symbolic = 0; }
54 { umfpack_zi_free_symbolic(Symbolic); *Symbolic = 0; }
57 const int Ap[],
const int Ai[],
const double Ax[],
void **Symbolic,
58 const double Control [UMFPACK_CONTROL],
double Info [UMFPACK_INFO])
60 return umfpack_di_symbolic(n_row,n_col,Ap,Ai,Ax,Symbolic,Control,
Info);
64 const int Ap[],
const int Ai[],
const std::complex<double> Ax[],
void **Symbolic,
65 const double Control [UMFPACK_CONTROL],
double Info [UMFPACK_INFO])
67 return umfpack_zi_symbolic(n_row,n_col,Ap,Ai,&numext::real_ref(Ax[0]),0,Symbolic,Control,
Info);
71 void *Symbolic,
void **Numeric,
72 const double Control[UMFPACK_CONTROL],
double Info [UMFPACK_INFO])
74 return umfpack_di_numeric(Ap,Ai,Ax,Symbolic,Numeric,Control,
Info);
77 inline int umfpack_numeric(
const int Ap[],
const int Ai[],
const std::complex<double> Ax[],
78 void *Symbolic,
void **Numeric,
79 const double Control[UMFPACK_CONTROL],
double Info [UMFPACK_INFO])
81 return umfpack_zi_numeric(Ap,Ai,&numext::real_ref(Ax[0]),0,Symbolic,Numeric,Control,
Info);
84 inline int umfpack_solve(
int sys,
const int Ap[],
const int Ai[],
const double Ax[],
85 double X[],
const double B[],
void *Numeric,
86 const double Control[UMFPACK_CONTROL],
double Info[UMFPACK_INFO])
88 return umfpack_di_solve(sys,Ap,Ai,Ax,X,B,Numeric,Control,
Info);
91 inline int umfpack_solve(
int sys,
const int Ap[],
const int Ai[],
const std::complex<double> Ax[],
92 std::complex<double> X[],
const std::complex<double> B[],
void *Numeric,
93 const double Control[UMFPACK_CONTROL],
double Info[UMFPACK_INFO])
95 return umfpack_zi_solve(sys,Ap,Ai,&numext::real_ref(Ax[0]),0,&numext::real_ref(X[0]),0,&numext::real_ref(B[0]),0,Numeric,Control,
Info);
98 inline int umfpack_get_lunz(
int *lnz,
int *unz,
int *n_row,
int *n_col,
int *nz_udiag,
void *Numeric,
double)
100 return umfpack_di_get_lunz(lnz,unz,n_row,n_col,nz_udiag,Numeric);
103 inline int umfpack_get_lunz(
int *lnz,
int *unz,
int *n_row,
int *n_col,
int *nz_udiag,
void *Numeric, std::complex<double>)
105 return umfpack_zi_get_lunz(lnz,unz,n_row,n_col,nz_udiag,Numeric);
109 int P[],
int Q[],
double Dx[],
int *do_recip,
double Rs[],
void *Numeric)
111 return umfpack_di_get_numeric(Lp,Lj,Lx,Up,Ui,Ux,P,Q,Dx,do_recip,Rs,Numeric);
114 inline int umfpack_get_numeric(
int Lp[],
int Lj[], std::complex<double> Lx[],
int Up[],
int Ui[], std::complex<double> Ux[],
115 int P[],
int Q[], std::complex<double> Dx[],
int *do_recip,
double Rs[],
void *Numeric)
117 double& lx0_real = numext::real_ref(Lx[0]);
118 double& ux0_real = numext::real_ref(Ux[0]);
119 double& dx0_real = numext::real_ref(Dx[0]);
120 return umfpack_zi_get_numeric(Lp,Lj,Lx?&lx0_real:0,0,Up,Ui,Ux?&ux0_real:0,0,P,Q,
121 Dx?&dx0_real:0,0,do_recip,Rs,Numeric);
126 return umfpack_di_get_determinant(Mx,Ex,NumericHandle,User_Info);
129 inline int umfpack_get_determinant(std::complex<double> *Mx,
double *Ex,
void *NumericHandle,
double User_Info [UMFPACK_INFO])
131 double& mx_real = numext::real_ref(*Mx);
132 return umfpack_zi_get_determinant(&mx_real,0,Ex,NumericHandle,User_Info);
151 template<
typename _MatrixType>
160 typedef typename MatrixType::Scalar
Scalar;
185 template<
typename InputMatrixType>
241 template<
typename InputMatrixType>
246 grab(matrix.derived());
257 template<
typename InputMatrixType>
263 grab(matrix.derived());
307 template<
typename InputMatrixType>
314 grab(matrix.derived());
348 template<
typename BDerived,
typename XDerived>
371 internal::convert_index<int>(
mp_matrix.cols()),
393 template<
typename MatrixDerived>
400 void grab(
const UmfpackMatrixRef &
A)
416 mutable IntColVectorType
m_p;
417 mutable IntRowVectorType
m_q;
435 template<
typename MatrixType>
463 template<
typename MatrixType>
471 template<
typename MatrixType>
472 template<
typename BDerived,
typename XDerived>
475 Index rhsCols = b.cols();
477 eigen_assert((XDerived::Flags&RowMajorBit)==0 &&
"UmfPackLU backend does not support non col-major result yet");
478 eigen_assert(b.derived().data() != x.derived().data() &&
" Umfpack does not support inplace solve");
483 if(x.innerStride()!=1)
486 x_ptr = x_tmp.
data();
488 for (
int j=0; j<rhsCols; ++j)
490 if(x.innerStride()==1)
491 x_ptr = &x.
col(j).coeffRef(0);
495 if(x.innerStride()!=1)
506 #endif // EIGEN_UMFPACKSUPPORT_H EIGEN_DEVICE_FUNC ColXpr col(Index i)
void _solve_impl(const SparseMatrixBase< Rhs > &b, SparseMatrixBase< Dest > &dest) const
Matrix< int, MatrixType::RowsAtCompileTime, 1 > IntColVectorType
int umfpack_get_lunz(int *lnz, int *unz, int *n_row, int *n_col, int *nz_udiag, void *Numeric, double)
A sparse LU factorization and solver based on UmfPack.
void factorize(const InputMatrixType &matrix)
void umfpackReportStatus()
bool _solve_impl(const MatrixBase< BDerived > &b, MatrixBase< XDerived > &x) const
void umfpack_report_status(double control[UMFPACK_CONTROL], int status, double)
void compute(const InputMatrixType &matrix)
void analyzePattern(const InputMatrixType &matrix)
void umfpack_defaults(double control[UMFPACK_CONTROL], double)
void resize(Index rows, Index cols)
A base class for sparse solvers.
int umfpack_numeric(const int Ap[], const int Ai[], const double Ax[], void *Symbolic, void **Numeric, const double Control[UMFPACK_CONTROL], double Info[UMFPACK_INFO])
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar * data() const
Matrix< Scalar, Dynamic, 1 > Vector
const IntColVectorType & permutationP() const
int umfpack_get_determinant(double *Mx, double *Ex, void *NumericHandle, double User_Info[UMFPACK_INFO])
int umfpack_symbolic(int n_row, int n_col, const int Ap[], const int Ai[], const double Ax[], void **Symbolic, const double Control[UMFPACK_CONTROL], double Info[UMFPACK_INFO])
const Scalar * valuePtr() const
const unsigned int RowMajorBit
void resizeNonZeros(Index size)
MatrixType::RealScalar RealScalar
UmfpackMatrixType m_dummy
const IntRowVectorType & permutationQ() const
SparseMatrix< Scalar > LUMatrixType
void umfpack_free_numeric(void **Numeric, double)
void umfpack_report_info(double control[UMFPACK_CONTROL], double info[UMFPACK_INFO], double)
void grab(const UmfpackMatrixRef &A)
MatrixType::StorageIndex StorageIndex
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void resize(Index rows, Index cols)
UmfpackInfo m_umfpackInfo
void umfpackReportControl()
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
UmfpackMatrixRef mp_matrix
const LUMatrixType & matrixL() const
void grab(const EigenBase< MatrixDerived > &A)
const StorageIndex * outerIndexPtr() const
ComputationInfo info() const
Reports whether previous computation was successful.
const LUMatrixType & matrixU() const
Ref< const UmfpackMatrixType, StandardCompressedFormat > UmfpackMatrixRef
Scalar determinant() const
Array< double, UMFPACK_CONTROL, 1 > UmfpackControl
void analyzePattern_impl()
bool m_extractedDataAreDirty
Matrix< int, 1, MatrixType::ColsAtCompileTime > IntRowVectorType
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)
MatrixType::Scalar Scalar
const UmfpackControl & umfpackControl() const
UmfpackControl & umfpackControl()
int umfpackFactorizeReturncode() const
int umfpack_solve(int sys, const int Ap[], const int Ai[], const double Ax[], double X[], const double B[], void *Numeric, const double Control[UMFPACK_CONTROL], double Info[UMFPACK_INFO])
const StorageIndex * innerIndexPtr() const
UmfPackLU(const UmfPackLU &)
Array< double, UMFPACK_INFO, 1 > UmfpackInfo
EIGEN_DEVICE_FUNC const Scalar & b
UmfPackLU(const InputMatrixType &matrix)
EIGEN_DEVICE_FUNC Derived & derived()
SparseSolverBase< UmfPackLU< _MatrixType > > Base
Base class for all dense matrices, vectors, and expressions.
void umfpack_free_symbolic(void **Symbolic, double)
SparseMatrix< Scalar, ColMajor, int > UmfpackMatrixType
void umfpack_report_control(double control[UMFPACK_CONTROL], double)