7 #include "tbci/cscmatrix.h"
10 #ifdef HAVE_SUPERLU3_INCLUDES
11 # include <superlu/slu_zdefs.h>
13 # include <superlu/slu_util.h>
15 # include "tbci/superlu/util.h"
16 # include "tbci/superlu/zsp_defs.h"
19 #if TBCI_NUMLIB_VERSION >= 20600
20 # define COLPERM_T_DECLARED
21 # include "tbci/solver/superlu.h"
35 bool verbose,
bool symm)
42 unsigned int *asub= M.rowIndexPointer();
43 unsigned int *xa = M.columnPointer();
54 #ifdef HAVE_SUPERLU3_INCLUDES
55 superlu_options_t slu_opt;
57 set_default_options(&slu_opt);
58 slu_opt.ColPerm = permc_spec;
59 slu_opt.SymmetricMode = (yes_no_t)symm;
61 slu_opt.DiagPivotThresh = 0.1;
62 slu_opt.PrintStat = (yes_no_t)verbose;
64 #elif defined(HAVE_UNISTD_H)
75 ABORT(
"Malloc fails for perm_r[].");
77 ABORT(
"Malloc fails for perm_c[].");
79 #if defined(HAVE_UNISTD_H) && !defined(HAVE_SUPERLU3_INCLUDES)
82 savedstdout = dup(STDOUT_FILENO); close(STDOUT_FILENO);
85 #ifndef HAVE_SUPERLU3_INCLUDES
91 #ifdef HAVE_SUPERLU3_INCLUDES
92 zgssv(&slu_opt, &A, perm_c, perm_r, &L, &U, &B, &slu_stat, &info);
96 zgssv(&A, perm_c, perm_r, &L, &U, &B, &info);
98 #if defined(HAVE_UNISTD_H) && !defined(HAVE_SUPERLU3_INCLUDES)
101 dup2(savedstdout, STDOUT_FILENO); close(savedstdout);
106 fprintf(stderr,
"SuperLU: zgssv() error returns INFO= %d\n", info);
110 #ifdef HAVE_SUPERLU3_INCLUDES
116 fprintf(stderr,
"SuperLU: Memory allocation of %i bytes failed!\n",
118 fprintf(stderr,
" L\\U MB %.3f\ttotal MB needed %.3f",
120 #ifdef HAVE_MEM_USAGE_EXPANSIONS
121 fprintf(stderr,
"\texpansions %d\n",
124 fprintf(stderr,
"\n");
127 fprintf(stderr,
"SuperLU: Singular factor U(%i,%i) found!\n", info, info);
137 #ifdef HAVE_SUPERLU3_INCLUDES
144 #if TBCI_NUMLIB_VERSION < 20600
152 bool verbose,
bool symm)
157 rhs, permc_spec, verbose, symm);
void Destroy_SuperMatrix_Store(SuperMatrix *)
const Vector< T > const Vector< T > & x
void zCreate_Dense_Matrix(SuperMatrix *, int, int, doublecomplex *, int, Stype_t, Dtype_t, Mtype_t)
void zgssv(SuperMatrix *, int *, int *, SuperMatrix *, SuperMatrix *, SuperMatrix *, int *)
F_TMatrix< double > lu_solve(const F_Matrix< double > &A, const F_Matrix< double > &B, int overwriteA=0)
#define SUPERLU_FREE(addr)
void zCreate_CompCol_Matrix(SuperMatrix *, int, int, int, doublecomplex *, int *, int *, Stype_t, Dtype_t, Mtype_t)
enums and structs for the SuperMatrix being used in SuperLU
colperm_t
get column permutation vector perm_c[], according to permc_spec: permc_spec = NATURAL(0): use the nat...
void Destroy_CompCol_Matrix(SuperMatrix *)
void get_perm_c(int, SuperMatrix *, int *)
void Destroy_SuperNode_Matrix(SuperMatrix *)
exception class: Use MatErr from matrix.h
Temporary Base Class Idiom: Class TVector is used for temporary variables.
int zQuerySpace(SuperMatrix *, SuperMatrix *, int, mem_usage_t *)
const unsigned TMatrix< T > const Matrix< T > * a