12 pLU(pMatrix->clone()),
13 pIPiv(
TArray1<int>::create(pMatrix->shape(0)))
31 return std::make_shared<TSolverLapackLU<T>>(a);
37 void sgetrf_(
int *n,
int *m,
float *a,
int *lda,
int* ipiv,
int *info);
38 void sgetrs_(
char *trans,
int *n,
const int *nrhs,
float*a,
int* lda,
int *ipiv ,
float *b,
int *ldb,
int *info );
39 void sgetri_(
int *n,
float*a,
int* lda,
int *ipiv ,
float *work,
int *lwork,
int *info );
40 void dgetrf_(
int *n,
int *m,
double *a,
int *lda,
int* ipiv,
int *info);
41 void dgetrs_(
char *trans,
int *n,
const int *nrhs,
double*a,
int* lda,
int *ipiv ,
double *b,
int *ldb,
int *info );
42 void dgetri_(
int *n,
double*a,
int* lda,
int *ipiv ,
double *work,
int *lwork,
int *info );
55 snprintf(errormsg,80,
"numcxx::TSolverLapackLU::update: dgetrf error %d\n",info);
56 throw std::runtime_error(errormsg);
64 char trans[2]={
'T',
'\0'};
72 snprintf(errormsg,80,
"numcxx::TSolverLapackLU::update: dgetrs error %d\n",info);
73 throw std::runtime_error(errormsg);
88 snprintf(errormsg,80,
"numcxx::TSolverLapackLU::update: sgetrf error %d\n",info);
89 throw std::runtime_error(errormsg);
98 throw std::runtime_error(
"numcxx: TSolverLapackLU created without smartpointer");
107 char trans[2]={
'T',
'\0'};
115 snprintf(errormsg,80,
"numcxx::TSolverLapackLU::update: sgetrs error %d\n",info);
116 throw std::runtime_error(errormsg);
127 auto pInverse=std::make_shared<TMatrix<double>>(*pLU);
140 snprintf(errormsg,80,
"numcxx::TSolverLapackLU::calculate_inverse: dgetri error %d\n",info);
141 throw std::runtime_error(errormsg);
150 auto pInverse=std::make_shared<TMatrix<float>>(*pLU);
163 snprintf(errormsg,80,
"numcxx::TSolverLapackLU::calculate_inverse: sgetri error %d\n",info);
164 throw std::runtime_error(errormsg);
const std::shared_ptr< TMatrix< T > > pMatrix
std::shared_ptr< TMatrix< T > > calculate_inverse()
Calculate inverse of matrix A from its LU factors.
static std::shared_ptr< TSolverLapackLU< T > > create(const std::shared_ptr< TMatrix< T >> pMatrix)
Static wrapper around constructor.
void dgetrs_(char *trans, int *n, const int *nrhs, double *a, int *lda, int *ipiv, double *b, int *ldb, int *info)
void solve(TArray< T > &Sol, const TArray< T > &Rhs) const
Solve LU factorized system.
TArray is the common template base class for arrays and dense matrices of the numcxx project...
void update()
Perform computation of LU factorization using actual state of matrix.
Base class for linear solvers and preconditioners.
TSolverLapackLU()
Default constructor for swig.
One dimensional array class.
void dgetri_(int *n, double *a, int *lda, int *ipiv, double *work, int *lwork, int *info)
void dgetrf_(int *n, int *m, double *a, int *lda, int *ipiv, int *info)
const std::shared_ptr< TArray1< int > > pIPiv
TArray< T > & assign(TArray< T > &A, const EXPR &expr, const EXPR *x=0)
const std::shared_ptr< TMatrix< T > > pLU
void sgetrs_(char *trans, int *n, const int *nrhs, float *a, int *lda, int *ipiv, float *b, int *ldb, int *info)
T * data() const
Obtain C-pointer of data array.
void sgetri_(int *n, float *a, int *lda, int *ipiv, float *work, int *lwork, int *info)
void sgetrf_(int *n, int *m, float *a, int *lda, int *ipiv, int *info)