41 umfpack_di_free_numeric(&
Numeric);
50 return std::make_shared<TSolverUMFPACK<T>>(
pA);
58 throw std::runtime_error(
"numcxx: TSolverUMFPACK created without smartpointer");
64 if (Matrix.
empty())
return;
66 throw std::runtime_error(
"numcxx: forgot flush() after sparse pattern changed");
68 int n=Matrix.
shape(0);
69 int nia=Matrix.
pIA->size();
70 int nja=Matrix.
pJA->size();
80 double *control=
nullptr;
87 status=umfpack_di_symbolic (n, n, Matrix.
pIA->data(), Matrix.
pJA->data(), Matrix.
pA->data(), &
Symbolic, 0, 0);
91 snprintf(errormsg,80,
"numcxx::TSolverUMFPACK::update: umfpack_di_symbolic error %d\n",status);
92 throw std::runtime_error(errormsg);
98 umfpack_di_free_numeric(&
Numeric);
101 status =umfpack_di_numeric (Matrix.
pIA->data(), Matrix.
pJA->data(), Matrix.
pA->data(),
Symbolic, &
Numeric, control, 0) ;
105 snprintf(errormsg,80,
"numcxx::TSolverUMFPACK::update: umfpack_di_numeric error %d\n",status);
106 throw std::runtime_error(errormsg);
119 double *control=
nullptr;
121 status=umfpack_di_solve (UMFPACK_At,
pIA->data(),
pJA->data(),
pA->data(), Sol.
data(), Rhs.
data(),
Numeric, control, 0 ) ;
125 snprintf(errormsg,80,
"numcxx::TSolverUMFPACK::update: umfpack_di_solve error %d\n",status);
126 throw std::runtime_error(errormsg);
static std::shared_ptr< TSolverUMFPACK< T > > create(const std::shared_ptr< TSparseMatrix< T >> pA)
Create LU factorization class.
std::shared_ptr< TArray1< int > > pJA
Column indices.
std::shared_ptr< TArray1< int > > pIA
Row pointer of matrix.
Sparse matrix class using CRS storage scheme.
const std::shared_ptr< TSparseMatrix< T > > pMatrix
The corresponding matrix.
TArray is the common template base class for arrays and dense matrices of the numcxx project...
size_t size() const
Obtain size of array.
void solve(TArray< T > &Sol, const TArray< T > &Rhs)
Solve LU factorized system.
bool pattern_changed() const
Check if pattern has changed after last solver update.
std::shared_ptr< TArray1< int > > pJA
Column indices.
std::shared_ptr< TArray1< T > > pA
Entries.
index shape(int idim) const
Return the shape od the matrix.
void resize(size_t n)
Resize array.
std::shared_ptr< TArray1< T > > pA
Entries.
void * Numeric
Pointer to numeric factorization data.
void * Symbolic
Pointer to symbolic factorization data.
std::shared_ptr< TArray1< int > > pIA
Row pointers.
void update()
Perform actual computation of LU factorization.
T * data() const
Obtain C-pointer of data array.