7 #include "tbci/cscmatrix.h" 9 #ifdef HAVE_SUPERLU3_INCLUDES 10 # include <superlu/slu_ddefs.h> 12 # include <superlu/slu_util.h> 14 # include "tbci/superlu/util.h" 15 # include "tbci/superlu/dsp_defs.h" 18 #if TBCI_NUMLIB_VERSION >= 20600 19 # define COLPERM_T_DECLARED 20 # include "tbci/solver/superlu.h" 33 bool verbose,
bool symm)
51 #ifdef HAVE_SUPERLU3_INCLUDES 52 superlu_options_t slu_opt;
54 set_default_options(&slu_opt);
55 slu_opt.ColPerm = permc_spec;
56 slu_opt.SymmetricMode = (yes_no_t)symm;
58 slu_opt.DiagPivotThresh = 0.1;
59 slu_opt.PrintStat = (yes_no_t)verbose;
61 #elif defined(HAVE_UNISTD_H) 70 ABORT(
"Malloc fails for perm_r[].");
72 ABORT(
"Malloc fails for perm_c[].");
74 #if defined(HAVE_UNISTD_H) && !defined(HAVE_SUPERLU3_INCLUDES) 77 savedstdout = dup(STDOUT_FILENO); close(STDOUT_FILENO);
80 #ifndef HAVE_SUPERLU3_INCLUDES 86 #ifdef HAVE_SUPERLU3_INCLUDES 87 dgssv(&slu_opt, &A, perm_c, perm_r, &L, &
U, &B, &slu_stat, &info);
91 dgssv(&A, perm_c, perm_r, &L, &
U, &B, &info);
93 #if defined(HAVE_UNISTD_H) && !defined(HAVE_SUPERLU3_INCLUDES) 96 int newout = dup(savedstdout); close(savedstdout);
97 if (newout != STDOUT_FILENO)
98 fprintf(stderr,
"Could not reopen stdout (%i)\n", newout);
103 fprintf(stderr,
"SuperLU: dgssv() error returns INFO= %d\n", info);
107 #ifdef HAVE_SUPERLU3_INCLUDES 113 fprintf(stderr,
"SuperLU: Memory allocation of %i bytes failed!\n",
115 fprintf(stderr,
" L\\U MB %.3f\ttotal MB needed %.3f",
117 #ifdef HAVE_MEM_USAGE_EXPANSIONS 118 fprintf(stderr,
"\texpansions %d\n",
121 fprintf(stderr,
"\n");
124 fprintf(stderr,
"SuperLU: Singular factor U(%i,%i) found!\n", info, info);
134 #ifdef HAVE_SUPERLU3_INCLUDES 141 #if TBCI_NUMLIB_VERSION < 20600 149 bool verbose,
bool symm)
void Destroy_SuperMatrix_Store(SuperMatrix *)
WEAK(TVector< double > lu_solve(CSCMatrix< double > &M, const Vector< double > &rhs, colperm_t permc_spec, bool verbose, bool symm))
The symbol was part of the library before, so keep it as weak symbol for copmatibility reasons...
unsigned long size() const
unsigned int columns() const
unsigned int size() const
unsigned int * columnPointer()
#define SUPERLU_FREE(addr)
void dgssv(SuperMatrix *, int *, int *, SuperMatrix *, SuperMatrix *, SuperMatrix *, int *)
enums and structs for the SuperMatrix being used in SuperLU
const Vector< T > const Vector< T > & x
void dCreate_CompCol_Matrix(SuperMatrix *, int, int, int, double *, int *, int *, Stype_t, Dtype_t, Mtype_t)
colperm_t
get column permutation vector perm_c[], according to permc_spec: permc_spec = NATURAL(0): use the nat...
void dCreate_Dense_Matrix(SuperMatrix *, int, int, double *, int, Stype_t, Dtype_t, Mtype_t)
void Destroy_CompCol_Matrix(SuperMatrix *)
unsigned int * rowIndexPointer()
void get_perm_c(int, SuperMatrix *, int *)
void Destroy_SuperNode_Matrix(SuperMatrix *)
int dQuerySpace(SuperMatrix *, SuperMatrix *, int, mem_usage_t *)
exception class: Use MatErr from matrix.h
Temporary Base Class Idiom: Class TVector is used for temporary variables.
unsigned int rows() const
query matrix dimensions
const unsigned TMatrix< T > const Matrix< T > * a
NAMESPACE_TBCI int lu_solve(CSCMatrix< double > &M, Vector< double > &x, const Vector< double > &rhs, colperm_t permc_spec, bool verbose, bool symm)