UmfPackSupport.h
Go to the documentation of this file.
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2008-2011 Gael Guennebaud <gael.guennebaud@inria.fr>
5 //
6 // This Source Code Form is subject to the terms of the Mozilla
7 // Public License v. 2.0. If a copy of the MPL was not distributed
8 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 
10 #ifndef EIGEN_UMFPACKSUPPORT_H
11 #define EIGEN_UMFPACKSUPPORT_H
12 
13 // for compatibility with super old version of umfpack,
14 // not sure this is really needed, but this is harmless.
15 #ifndef SuiteSparse_long
16 #ifdef UF_long
17 #define SuiteSparse_long UF_long
18 #else
19 #error neither SuiteSparse_long nor UF_long are defined
20 #endif
21 #endif
22 
23 // IWYU pragma: private
24 #include "./InternalHeaderCheck.h"
25 
26 namespace Eigen {
27 
28 /* TODO extract L, extract U, compute det, etc... */
29 
30 // generic double/complex<double> wrapper functions:
31 
32 // Defaults
33 inline void umfpack_defaults(double control[UMFPACK_CONTROL], double, int) { umfpack_di_defaults(control); }
34 
35 inline void umfpack_defaults(double control[UMFPACK_CONTROL], std::complex<double>, int) {
36  umfpack_zi_defaults(control);
37 }
38 
39 inline void umfpack_defaults(double control[UMFPACK_CONTROL], double, SuiteSparse_long) {
40  umfpack_dl_defaults(control);
41 }
42 
43 inline void umfpack_defaults(double control[UMFPACK_CONTROL], std::complex<double>, SuiteSparse_long) {
44  umfpack_zl_defaults(control);
45 }
46 
47 // Report info
48 inline void umfpack_report_info(double control[UMFPACK_CONTROL], double info[UMFPACK_INFO], double, int) {
49  umfpack_di_report_info(control, info);
50 }
51 
52 inline void umfpack_report_info(double control[UMFPACK_CONTROL], double info[UMFPACK_INFO], std::complex<double>, int) {
53  umfpack_zi_report_info(control, info);
54 }
55 
56 inline void umfpack_report_info(double control[UMFPACK_CONTROL], double info[UMFPACK_INFO], double, SuiteSparse_long) {
57  umfpack_dl_report_info(control, info);
58 }
59 
60 inline void umfpack_report_info(double control[UMFPACK_CONTROL], double info[UMFPACK_INFO], std::complex<double>,
61  SuiteSparse_long) {
62  umfpack_zl_report_info(control, info);
63 }
64 
65 // Report status
66 inline void umfpack_report_status(double control[UMFPACK_CONTROL], int status, double, int) {
67  umfpack_di_report_status(control, status);
68 }
69 
70 inline void umfpack_report_status(double control[UMFPACK_CONTROL], int status, std::complex<double>, int) {
71  umfpack_zi_report_status(control, status);
72 }
73 
74 inline void umfpack_report_status(double control[UMFPACK_CONTROL], int status, double, SuiteSparse_long) {
75  umfpack_dl_report_status(control, status);
76 }
77 
78 inline void umfpack_report_status(double control[UMFPACK_CONTROL], int status, std::complex<double>, SuiteSparse_long) {
79  umfpack_zl_report_status(control, status);
80 }
81 
82 // report control
83 inline void umfpack_report_control(double control[UMFPACK_CONTROL], double, int) { umfpack_di_report_control(control); }
84 
85 inline void umfpack_report_control(double control[UMFPACK_CONTROL], std::complex<double>, int) {
86  umfpack_zi_report_control(control);
87 }
88 
89 inline void umfpack_report_control(double control[UMFPACK_CONTROL], double, SuiteSparse_long) {
90  umfpack_dl_report_control(control);
91 }
92 
93 inline void umfpack_report_control(double control[UMFPACK_CONTROL], std::complex<double>, SuiteSparse_long) {
94  umfpack_zl_report_control(control);
95 }
96 
97 // Free numeric
98 inline void umfpack_free_numeric(void **Numeric, double, int) {
99  umfpack_di_free_numeric(Numeric);
100  *Numeric = 0;
101 }
102 
103 inline void umfpack_free_numeric(void **Numeric, std::complex<double>, int) {
104  umfpack_zi_free_numeric(Numeric);
105  *Numeric = 0;
106 }
107 
108 inline void umfpack_free_numeric(void **Numeric, double, SuiteSparse_long) {
109  umfpack_dl_free_numeric(Numeric);
110  *Numeric = 0;
111 }
112 
113 inline void umfpack_free_numeric(void **Numeric, std::complex<double>, SuiteSparse_long) {
114  umfpack_zl_free_numeric(Numeric);
115  *Numeric = 0;
116 }
117 
118 // Free symbolic
119 inline void umfpack_free_symbolic(void **Symbolic, double, int) {
120  umfpack_di_free_symbolic(Symbolic);
121  *Symbolic = 0;
122 }
123 
124 inline void umfpack_free_symbolic(void **Symbolic, std::complex<double>, int) {
125  umfpack_zi_free_symbolic(Symbolic);
126  *Symbolic = 0;
127 }
128 
129 inline void umfpack_free_symbolic(void **Symbolic, double, SuiteSparse_long) {
130  umfpack_dl_free_symbolic(Symbolic);
131  *Symbolic = 0;
132 }
133 
134 inline void umfpack_free_symbolic(void **Symbolic, std::complex<double>, SuiteSparse_long) {
135  umfpack_zl_free_symbolic(Symbolic);
136  *Symbolic = 0;
137 }
138 
139 // Symbolic
140 inline int umfpack_symbolic(int n_row, int n_col, const int Ap[], const int Ai[], const double Ax[], void **Symbolic,
141  const double Control[UMFPACK_CONTROL], double Info[UMFPACK_INFO]) {
142  return umfpack_di_symbolic(n_row, n_col, Ap, Ai, Ax, Symbolic, Control, Info);
143 }
144 
145 inline int umfpack_symbolic(int n_row, int n_col, const int Ap[], const int Ai[], const std::complex<double> Ax[],
146  void **Symbolic, const double Control[UMFPACK_CONTROL], double Info[UMFPACK_INFO]) {
147  return umfpack_zi_symbolic(n_row, n_col, Ap, Ai, &numext::real_ref(Ax[0]), 0, Symbolic, Control, Info);
148 }
149 inline SuiteSparse_long umfpack_symbolic(SuiteSparse_long n_row, SuiteSparse_long n_col, const SuiteSparse_long Ap[],
150  const SuiteSparse_long Ai[], const double Ax[], void **Symbolic,
151  const double Control[UMFPACK_CONTROL], double Info[UMFPACK_INFO]) {
152  return umfpack_dl_symbolic(n_row, n_col, Ap, Ai, Ax, Symbolic, Control, Info);
153 }
154 
155 inline SuiteSparse_long umfpack_symbolic(SuiteSparse_long n_row, SuiteSparse_long n_col, const SuiteSparse_long Ap[],
156  const SuiteSparse_long Ai[], const std::complex<double> Ax[], void **Symbolic,
157  const double Control[UMFPACK_CONTROL], double Info[UMFPACK_INFO]) {
158  return umfpack_zl_symbolic(n_row, n_col, Ap, Ai, &numext::real_ref(Ax[0]), 0, Symbolic, Control, Info);
159 }
160 
161 // Numeric
162 inline int umfpack_numeric(const int Ap[], const int Ai[], const double Ax[], void *Symbolic, void **Numeric,
163  const double Control[UMFPACK_CONTROL], double Info[UMFPACK_INFO]) {
164  return umfpack_di_numeric(Ap, Ai, Ax, Symbolic, Numeric, Control, Info);
165 }
166 
167 inline int umfpack_numeric(const int Ap[], const int Ai[], const std::complex<double> Ax[], void *Symbolic,
168  void **Numeric, const double Control[UMFPACK_CONTROL], double Info[UMFPACK_INFO]) {
169  return umfpack_zi_numeric(Ap, Ai, &numext::real_ref(Ax[0]), 0, Symbolic, Numeric, Control, Info);
170 }
171 inline SuiteSparse_long umfpack_numeric(const SuiteSparse_long Ap[], const SuiteSparse_long Ai[], const double Ax[],
172  void *Symbolic, void **Numeric, const double Control[UMFPACK_CONTROL],
173  double Info[UMFPACK_INFO]) {
174  return umfpack_dl_numeric(Ap, Ai, Ax, Symbolic, Numeric, Control, Info);
175 }
176 
177 inline SuiteSparse_long umfpack_numeric(const SuiteSparse_long Ap[], const SuiteSparse_long Ai[],
178  const std::complex<double> Ax[], void *Symbolic, void **Numeric,
179  const double Control[UMFPACK_CONTROL], double Info[UMFPACK_INFO]) {
180  return umfpack_zl_numeric(Ap, Ai, &numext::real_ref(Ax[0]), 0, Symbolic, Numeric, Control, Info);
181 }
182 
183 // solve
184 inline int umfpack_solve(int sys, const int Ap[], const int Ai[], const double Ax[], double X[], const double B[],
185  void *Numeric, const double Control[UMFPACK_CONTROL], double Info[UMFPACK_INFO]) {
186  return umfpack_di_solve(sys, Ap, Ai, Ax, X, B, Numeric, Control, Info);
187 }
188 
189 inline int umfpack_solve(int sys, const int Ap[], const int Ai[], const std::complex<double> Ax[],
190  std::complex<double> X[], const std::complex<double> B[], void *Numeric,
191  const double Control[UMFPACK_CONTROL], double Info[UMFPACK_INFO]) {
192  return umfpack_zi_solve(sys, Ap, Ai, &numext::real_ref(Ax[0]), 0, &numext::real_ref(X[0]), 0, &numext::real_ref(B[0]),
193  0, Numeric, Control, Info);
194 }
195 
196 inline SuiteSparse_long umfpack_solve(int sys, const SuiteSparse_long Ap[], const SuiteSparse_long Ai[],
197  const double Ax[], double X[], const double B[], void *Numeric,
198  const double Control[UMFPACK_CONTROL], double Info[UMFPACK_INFO]) {
199  return umfpack_dl_solve(sys, Ap, Ai, Ax, X, B, Numeric, Control, Info);
200 }
201 
202 inline SuiteSparse_long umfpack_solve(int sys, const SuiteSparse_long Ap[], const SuiteSparse_long Ai[],
203  const std::complex<double> Ax[], std::complex<double> X[],
204  const std::complex<double> B[], void *Numeric,
205  const double Control[UMFPACK_CONTROL], double Info[UMFPACK_INFO]) {
206  return umfpack_zl_solve(sys, Ap, Ai, &numext::real_ref(Ax[0]), 0, &numext::real_ref(X[0]), 0, &numext::real_ref(B[0]),
207  0, Numeric, Control, Info);
208 }
209 
210 // Get Lunz
211 inline int umfpack_get_lunz(int *lnz, int *unz, int *n_row, int *n_col, int *nz_udiag, void *Numeric, double) {
212  return umfpack_di_get_lunz(lnz, unz, n_row, n_col, nz_udiag, Numeric);
213 }
214 
215 inline int umfpack_get_lunz(int *lnz, int *unz, int *n_row, int *n_col, int *nz_udiag, void *Numeric,
216  std::complex<double>) {
217  return umfpack_zi_get_lunz(lnz, unz, n_row, n_col, nz_udiag, Numeric);
218 }
219 
220 inline SuiteSparse_long umfpack_get_lunz(SuiteSparse_long *lnz, SuiteSparse_long *unz, SuiteSparse_long *n_row,
221  SuiteSparse_long *n_col, SuiteSparse_long *nz_udiag, void *Numeric, double) {
222  return umfpack_dl_get_lunz(lnz, unz, n_row, n_col, nz_udiag, Numeric);
223 }
224 
225 inline SuiteSparse_long umfpack_get_lunz(SuiteSparse_long *lnz, SuiteSparse_long *unz, SuiteSparse_long *n_row,
226  SuiteSparse_long *n_col, SuiteSparse_long *nz_udiag, void *Numeric,
227  std::complex<double>) {
228  return umfpack_zl_get_lunz(lnz, unz, n_row, n_col, nz_udiag, Numeric);
229 }
230 
231 // Get Numeric
232 inline int umfpack_get_numeric(int Lp[], int Lj[], double Lx[], int Up[], int Ui[], double Ux[], int P[], int Q[],
233  double Dx[], int *do_recip, double Rs[], void *Numeric) {
234  return umfpack_di_get_numeric(Lp, Lj, Lx, Up, Ui, Ux, P, Q, Dx, do_recip, Rs, Numeric);
235 }
236 
237 inline int umfpack_get_numeric(int Lp[], int Lj[], std::complex<double> Lx[], int Up[], int Ui[],
238  std::complex<double> Ux[], int P[], int Q[], std::complex<double> Dx[], int *do_recip,
239  double Rs[], void *Numeric) {
240  double &lx0_real = numext::real_ref(Lx[0]);
241  double &ux0_real = numext::real_ref(Ux[0]);
242  double &dx0_real = numext::real_ref(Dx[0]);
243  return umfpack_zi_get_numeric(Lp, Lj, Lx ? &lx0_real : 0, 0, Up, Ui, Ux ? &ux0_real : 0, 0, P, Q, Dx ? &dx0_real : 0,
244  0, do_recip, Rs, Numeric);
245 }
246 inline SuiteSparse_long umfpack_get_numeric(SuiteSparse_long Lp[], SuiteSparse_long Lj[], double Lx[],
247  SuiteSparse_long Up[], SuiteSparse_long Ui[], double Ux[],
248  SuiteSparse_long P[], SuiteSparse_long Q[], double Dx[],
249  SuiteSparse_long *do_recip, double Rs[], void *Numeric) {
250  return umfpack_dl_get_numeric(Lp, Lj, Lx, Up, Ui, Ux, P, Q, Dx, do_recip, Rs, Numeric);
251 }
252 
253 inline SuiteSparse_long umfpack_get_numeric(SuiteSparse_long Lp[], SuiteSparse_long Lj[], std::complex<double> Lx[],
254  SuiteSparse_long Up[], SuiteSparse_long Ui[], std::complex<double> Ux[],
255  SuiteSparse_long P[], SuiteSparse_long Q[], std::complex<double> Dx[],
256  SuiteSparse_long *do_recip, double Rs[], void *Numeric) {
257  double &lx0_real = numext::real_ref(Lx[0]);
258  double &ux0_real = numext::real_ref(Ux[0]);
259  double &dx0_real = numext::real_ref(Dx[0]);
260  return umfpack_zl_get_numeric(Lp, Lj, Lx ? &lx0_real : 0, 0, Up, Ui, Ux ? &ux0_real : 0, 0, P, Q, Dx ? &dx0_real : 0,
261  0, do_recip, Rs, Numeric);
262 }
263 
264 // Get Determinant
265 inline int umfpack_get_determinant(double *Mx, double *Ex, void *NumericHandle, double User_Info[UMFPACK_INFO], int) {
266  return umfpack_di_get_determinant(Mx, Ex, NumericHandle, User_Info);
267 }
268 
269 inline int umfpack_get_determinant(std::complex<double> *Mx, double *Ex, void *NumericHandle,
270  double User_Info[UMFPACK_INFO], int) {
271  double &mx_real = numext::real_ref(*Mx);
272  return umfpack_zi_get_determinant(&mx_real, 0, Ex, NumericHandle, User_Info);
273 }
274 
275 inline SuiteSparse_long umfpack_get_determinant(double *Mx, double *Ex, void *NumericHandle,
276  double User_Info[UMFPACK_INFO], SuiteSparse_long) {
277  return umfpack_dl_get_determinant(Mx, Ex, NumericHandle, User_Info);
278 }
279 
280 inline SuiteSparse_long umfpack_get_determinant(std::complex<double> *Mx, double *Ex, void *NumericHandle,
281  double User_Info[UMFPACK_INFO], SuiteSparse_long) {
282  double &mx_real = numext::real_ref(*Mx);
283  return umfpack_zl_get_determinant(&mx_real, 0, Ex, NumericHandle, User_Info);
284 }
285 
301 template <typename MatrixType_>
302 class UmfPackLU : public SparseSolverBase<UmfPackLU<MatrixType_> > {
303  protected:
305  using Base::m_isInitialized;
306 
307  public:
308  using Base::_solve_impl;
309  typedef MatrixType_ MatrixType;
310  typedef typename MatrixType::Scalar Scalar;
312  typedef typename MatrixType::StorageIndex StorageIndex;
319  enum { ColsAtCompileTime = MatrixType::ColsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime };
320 
321  public:
324 
326 
327  template <typename InputMatrixType>
328  explicit UmfPackLU(const InputMatrixType &matrix) : mp_matrix(matrix) {
329  init();
330  compute(matrix);
331  }
332 
336  }
337 
338  inline Index rows() const { return mp_matrix.rows(); }
339  inline Index cols() const { return mp_matrix.cols(); }
340 
347  eigen_assert(m_isInitialized && "Decomposition is not initialized.");
348  return m_info;
349  }
350 
351  inline const LUMatrixType &matrixL() const {
353  return m_l;
354  }
355 
356  inline const LUMatrixType &matrixU() const {
358  return m_u;
359  }
360 
361  inline const IntColVectorType &permutationP() const {
363  return m_p;
364  }
365 
366  inline const IntRowVectorType &permutationQ() const {
368  return m_q;
369  }
370 
375  template <typename InputMatrixType>
376  void compute(const InputMatrixType &matrix) {
379  grab(matrix.derived());
381  factorize_impl();
382  }
383 
390  template <typename InputMatrixType>
391  void analyzePattern(const InputMatrixType &matrix) {
394 
395  grab(matrix.derived());
396 
398  }
399 
405  inline int umfpackFactorizeReturncode() const {
406  eigen_assert(m_numeric && "UmfPackLU: you must first call factorize()");
407  return m_fact_errorCode;
408  }
409 
416  inline const UmfpackControl &umfpackControl() const { return m_control; }
417 
425 
432  template <typename InputMatrixType>
433  void factorize(const InputMatrixType &matrix) {
434  eigen_assert(m_analysisIsOk && "UmfPackLU: you must first call analyzePattern()");
436 
437  grab(matrix.derived());
438 
439  factorize_impl();
440  }
441 
447 
453  eigen_assert(m_analysisIsOk && "UmfPackLU: you must first call analyzePattern()");
455  }
456 
463  eigen_assert(m_analysisIsOk && "UmfPackLU: you must first call analyzePattern()");
465  }
466 
468  template <typename BDerived, typename XDerived>
470 
471  Scalar determinant() const;
472 
473  void extractData() const;
474 
475  protected:
476  void init() {
478  m_isInitialized = false;
479  m_numeric = 0;
480  m_symbolic = 0;
482 
484  }
485 
487  m_fact_errorCode = umfpack_symbolic(internal::convert_index<StorageIndex>(mp_matrix.rows()),
488  internal::convert_index<StorageIndex>(mp_matrix.cols()),
489  mp_matrix.outerIndexPtr(), mp_matrix.innerIndexPtr(), mp_matrix.valuePtr(),
491 
492  m_isInitialized = true;
494  m_analysisIsOk = true;
495  m_factorizationIsOk = false;
497  }
498 
499  void factorize_impl() {
500  m_fact_errorCode = umfpack_numeric(mp_matrix.outerIndexPtr(), mp_matrix.innerIndexPtr(), mp_matrix.valuePtr(),
502 
503  m_info = m_fact_errorCode == UMFPACK_OK ? Success : NumericalIssue;
504  m_factorizationIsOk = true;
506  }
507 
508  template <typename MatrixDerived>
511  internal::construct_at(&mp_matrix, A.derived());
512  }
513 
514  void grab(const UmfpackMatrixRef &A) {
515  if (&(A.derived()) != &mp_matrix) {
518  }
519  }
520 
521  // cached data to reduce reallocation, etc.
522  mutable LUMatrixType m_l;
526 
527  mutable LUMatrixType m_u;
530 
533 
534  void *m_numeric;
535  void *m_symbolic;
536 
541 
542  private:
543  UmfPackLU(const UmfPackLU &) {}
544 };
545 
546 template <typename MatrixType>
548  if (m_extractedDataAreDirty) {
549  // get size of the data
550  StorageIndex lnz, unz, rows, cols, nz_udiag;
551  umfpack_get_lunz(&lnz, &unz, &rows, &cols, &nz_udiag, m_numeric, Scalar());
552 
553  // allocate data
554  m_l.resize(rows, (std::min)(rows, cols));
555  m_l.resizeNonZeros(lnz);
556 
557  m_u.resize((std::min)(rows, cols), cols);
558  m_u.resizeNonZeros(unz);
559 
560  m_p.resize(rows);
561  m_q.resize(cols);
562 
563  // extract
564  umfpack_get_numeric(m_l.outerIndexPtr(), m_l.innerIndexPtr(), m_l.valuePtr(), m_u.outerIndexPtr(),
565  m_u.innerIndexPtr(), m_u.valuePtr(), m_p.data(), m_q.data(), 0, 0, 0, m_numeric);
566 
567  m_extractedDataAreDirty = false;
568  }
569 }
570 
571 template <typename MatrixType>
573  Scalar det;
574  umfpack_get_determinant(&det, 0, m_numeric, 0, StorageIndex());
575  return det;
576 }
577 
578 template <typename MatrixType>
579 template <typename BDerived, typename XDerived>
581  Index rhsCols = b.cols();
582  eigen_assert((BDerived::Flags & RowMajorBit) == 0 && "UmfPackLU backend does not support non col-major rhs yet");
583  eigen_assert((XDerived::Flags & RowMajorBit) == 0 && "UmfPackLU backend does not support non col-major result yet");
584  eigen_assert(b.derived().data() != x.derived().data() && " Umfpack does not support inplace solve");
585 
586  Scalar *x_ptr = 0;
588  if (x.innerStride() != 1) {
589  x_tmp.resize(x.rows());
590  x_ptr = x_tmp.data();
591  }
592  for (int j = 0; j < rhsCols; ++j) {
593  if (x.innerStride() == 1) x_ptr = &x.col(j).coeffRef(0);
594  StorageIndex errorCode =
595  umfpack_solve(UMFPACK_A, mp_matrix.outerIndexPtr(), mp_matrix.innerIndexPtr(), mp_matrix.valuePtr(), x_ptr,
596  &b.const_cast_derived().col(j).coeffRef(0), m_numeric, m_control.data(), m_umfpackInfo.data());
597  if (x.innerStride() != 1) x.col(j) = x_tmp;
598  if (errorCode != 0) return false;
599  }
600 
601  return true;
602 }
603 
604 } // end namespace Eigen
605 
606 #endif // EIGEN_UMFPACKSUPPORT_H
MatrixXf Q
Definition: HouseholderQR_householderQ.cpp:1
#define eigen_assert(x)
Definition: Macros.h:910
int rows
Definition: Tutorial_commainit_02.cpp:1
int cols
Definition: Tutorial_commainit_02.cpp:1
Scalar * b
Definition: benchVecAdd.cpp:17
SCALAR Scalar
Definition: bench_gemm.cpp:45
NumTraits< Scalar >::Real RealScalar
Definition: bench_gemm.cpp:46
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:52
constexpr EIGEN_DEVICE_FUNC const Scalar * data() const
Definition: PlainObjectBase.h:273
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE void resize(Index rows, Index cols)
Definition: PlainObjectBase.h:294
A base class for sparse solvers.
Definition: SparseSolverBase.h:67
void _solve_impl(const SparseMatrixBase< Rhs > &b, SparseMatrixBase< Dest > &dest) const
Definition: SparseSolverBase.h:104
bool m_isInitialized
Definition: SparseSolverBase.h:110
A sparse LU factorization and solver based on UmfPack.
Definition: UmfPackSupport.h:302
Index cols() const
Definition: UmfPackSupport.h:339
void analyzePattern_impl()
Definition: UmfPackSupport.h:486
UmfPackLU(const UmfPackLU &)
Definition: UmfPackSupport.h:543
const LUMatrixType & matrixL() const
Definition: UmfPackSupport.h:351
Index rows() const
Definition: UmfPackSupport.h:338
Array< double, UMFPACK_CONTROL, 1 > UmfpackControl
Definition: UmfPackSupport.h:322
UmfpackMatrixRef mp_matrix
Definition: UmfPackSupport.h:532
Matrix< int, MatrixType::RowsAtCompileTime, 1 > IntColVectorType
Definition: UmfPackSupport.h:315
int m_analysisIsOk
Definition: UmfPackSupport.h:539
void printUmfpackControl()
Definition: UmfPackSupport.h:446
const IntColVectorType & permutationP() const
Definition: UmfPackSupport.h:361
MatrixType::RealScalar RealScalar
Definition: UmfPackSupport.h:311
bool m_extractedDataAreDirty
Definition: UmfPackSupport.h:540
void compute(const InputMatrixType &matrix)
Definition: UmfPackSupport.h:376
UmfPackLU(const InputMatrixType &matrix)
Definition: UmfPackSupport.h:328
UmfpackMatrixType m_dummy
Definition: UmfPackSupport.h:531
UmfpackInfo m_umfpackInfo
Definition: UmfPackSupport.h:525
Scalar determinant() const
Definition: UmfPackSupport.h:572
const IntRowVectorType & permutationQ() const
Definition: UmfPackSupport.h:366
void factorize(const InputMatrixType &matrix)
Definition: UmfPackSupport.h:433
UmfpackControl & umfpackControl()
Definition: UmfPackSupport.h:424
void factorize_impl()
Definition: UmfPackSupport.h:499
ComputationInfo m_info
Definition: UmfPackSupport.h:537
MatrixType::Scalar Scalar
Definition: UmfPackSupport.h:310
void grab(const UmfpackMatrixRef &A)
Definition: UmfPackSupport.h:514
SparseSolverBase< UmfPackLU< MatrixType_ > > Base
Definition: UmfPackSupport.h:304
StorageIndex m_fact_errorCode
Definition: UmfPackSupport.h:523
void init()
Definition: UmfPackSupport.h:476
IntColVectorType m_p
Definition: UmfPackSupport.h:528
void extractData() const
Definition: UmfPackSupport.h:547
SparseMatrix< Scalar > LUMatrixType
Definition: UmfPackSupport.h:316
int umfpackFactorizeReturncode() const
Definition: UmfPackSupport.h:405
bool _solve_impl(const MatrixBase< BDerived > &b, MatrixBase< XDerived > &x) const
Definition: UmfPackSupport.h:580
int m_factorizationIsOk
Definition: UmfPackSupport.h:538
Matrix< Scalar, Dynamic, 1 > Vector
Definition: UmfPackSupport.h:313
Matrix< int, 1, MatrixType::ColsAtCompileTime > IntRowVectorType
Definition: UmfPackSupport.h:314
MatrixType_ MatrixType
Definition: UmfPackSupport.h:309
ComputationInfo info() const
Reports whether previous computation was successful.
Definition: UmfPackSupport.h:346
Array< double, UMFPACK_INFO, 1 > UmfpackInfo
Definition: UmfPackSupport.h:323
UmfpackControl m_control
Definition: UmfPackSupport.h:524
void grab(const EigenBase< MatrixDerived > &A)
Definition: UmfPackSupport.h:509
void * m_numeric
Definition: UmfPackSupport.h:534
void printUmfpackInfo()
Definition: UmfPackSupport.h:452
const LUMatrixType & matrixU() const
Definition: UmfPackSupport.h:356
@ ColsAtCompileTime
Definition: UmfPackSupport.h:319
@ MaxColsAtCompileTime
Definition: UmfPackSupport.h:319
Ref< const UmfpackMatrixType, StandardCompressedFormat > UmfpackMatrixRef
Definition: UmfPackSupport.h:318
LUMatrixType m_l
Definition: UmfPackSupport.h:522
void analyzePattern(const InputMatrixType &matrix)
Definition: UmfPackSupport.h:391
const UmfpackControl & umfpackControl() const
Definition: UmfPackSupport.h:416
IntRowVectorType m_q
Definition: UmfPackSupport.h:529
~UmfPackLU()
Definition: UmfPackSupport.h:333
SparseMatrix< Scalar, ColMajor, StorageIndex > UmfpackMatrixType
Definition: UmfPackSupport.h:317
UmfPackLU()
Definition: UmfPackSupport.h:325
LUMatrixType m_u
Definition: UmfPackSupport.h:527
MatrixType::StorageIndex StorageIndex
Definition: UmfPackSupport.h:312
void printUmfpackStatus()
Definition: UmfPackSupport.h:462
void * m_symbolic
Definition: UmfPackSupport.h:535
Definition: matrices.h:74
Eigen::Map< Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor >, 0, Eigen::OuterStride<> > matrix(T *data, int rows, int cols, int stride)
Definition: common.h:85
#define min(a, b)
Definition: datatypes.h:22
ComputationInfo
Definition: Constants.h:438
@ NumericalIssue
Definition: Constants.h:442
@ InvalidInput
Definition: Constants.h:447
@ Success
Definition: Constants.h:440
const unsigned int RowMajorBit
Definition: Constants.h:70
#define X
Definition: icosphere.cpp:20
int info
Definition: level2_cplx_impl.h:39
EIGEN_DEVICE_FUNC T * construct_at(T *p, Args &&... args)
Definition: Memory.h:1321
EIGEN_DEVICE_FUNC void destroy_at(T *p)
Definition: Memory.h:1335
EIGEN_DEVICE_FUNC internal::add_const_on_value_type_t< EIGEN_MATHFUNC_RETVAL(real_ref, Scalar)> real_ref(const Scalar &x)
Definition: MathFunctions.h:1051
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:70
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)
Definition: UmfPackSupport.h:232
int umfpack_get_determinant(double *Mx, double *Ex, void *NumericHandle, double User_Info[UMFPACK_INFO], int)
Definition: UmfPackSupport.h:265
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])
Definition: UmfPackSupport.h:184
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:83
void umfpack_report_control(double control[UMFPACK_CONTROL], double, int)
Definition: UmfPackSupport.h:83
void umfpack_free_numeric(void **Numeric, double, int)
Definition: UmfPackSupport.h:98
void umfpack_defaults(double control[UMFPACK_CONTROL], double, int)
Definition: UmfPackSupport.h:33
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])
Definition: UmfPackSupport.h:140
void umfpack_report_status(double control[UMFPACK_CONTROL], int status, double, int)
Definition: UmfPackSupport.h:66
void umfpack_report_info(double control[UMFPACK_CONTROL], double info[UMFPACK_INFO], double, int)
Definition: UmfPackSupport.h:48
void umfpack_free_symbolic(void **Symbolic, double, int)
Definition: UmfPackSupport.h:119
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])
Definition: UmfPackSupport.h:162
int umfpack_get_lunz(int *lnz, int *unz, int *n_row, int *n_col, int *nz_udiag, void *Numeric, double)
Definition: UmfPackSupport.h:211
double Lx
Length of domain in x direction.
Definition: periodic_load.cc:55
double P
Uniform pressure.
Definition: TwenteMeshGluing.cpp:77
Vector< double > Dx(2, 0.0)
Increments in bin.
list x
Definition: plotDoE.py:28
Definition: EigenBase.h:33
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2