7#include "tbci/cscmatrix.h"
8#include "tbci/std_cplx.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_stdcplx.h"
34 bool verbose,
bool symm)
41 unsigned int *asub= M.rowIndexPointer();
42 unsigned int *xa = M.columnPointer();
52#ifdef HAVE_SUPERLU3_INCLUDES
53 superlu_options_t slu_opt;
55 set_default_options(&slu_opt);
56 slu_opt.ColPerm = permc_spec;
57 slu_opt.SymmetricMode = (yes_no_t)symm;
59 slu_opt.DiagPivotThresh = 0.1;
60 slu_opt.PrintStat = (yes_no_t)verbose;
62#elif defined(HAVE_UNISTD_H)
73 ABORT(
"Malloc fails for perm_r[].");
75 ABORT(
"Malloc fails for perm_c[].");
77#if defined(HAVE_UNISTD_H) && !defined(HAVE_SUPERLU3_INCLUDES)
80 savedstdout = dup(STDOUT_FILENO); close(STDOUT_FILENO);
83#ifndef HAVE_SUPERLU3_INCLUDES
89#ifdef HAVE_SUPERLU3_INCLUDES
90 zgssv(&slu_opt, &A, perm_c, perm_r, &L, &
U, &B, &slu_stat, &info);
94 zgssv(&A, perm_c, perm_r, &L, &
U, &B, &info);
96#if defined(HAVE_UNISTD_H) && !defined(HAVE_SUPERLU3_INCLUDES)
99 int newout = dup(savedstdout); close(savedstdout);
100 if (newout != STDOUT_FILENO)
101 fprintf(stderr,
"Could not reopen stdout (%i)\n", newout);
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);
const Vector< T > const Vector< T > & x
exception class: Use MatErr from matrix.h
Temporary Base Class Idiom: Class TVector is used for temporary variables.
void get_perm_c(int, SuperMatrix *, int *)
void Destroy_SuperMatrix_Store(SuperMatrix *)
void Destroy_CompCol_Matrix(SuperMatrix *)
void Destroy_SuperNode_Matrix(SuperMatrix *)
const unsigned TMatrix< T > const Matrix< T > * a
colperm_t
get column permutation vector perm_c[], according to permc_spec: permc_spec = NATURAL(0): use the nat...
NAMESPACE_TBCI int lu_solve(CSCMatrix< CPLX__ complex< double > > &M, Vector< CPLX__ complex< double > > &x, const Vector< CPLX__ complex< double > > &rhs, colperm_t permc_spec, bool verbose, bool symm)
SuperLU solver wrapper for std::complex numbers.
enums and structs for the SuperMatrix being used in SuperLU
#define SUPERLU_FREE(addr)
int zQuerySpace(SuperMatrix *, SuperMatrix *, int, mem_usage_t *)
void zCreate_CompCol_Matrix(SuperMatrix *, int, int, int, doublecomplex *, int *, int *, Stype_t, Dtype_t, Mtype_t)
void zCreate_Dense_Matrix(SuperMatrix *, int, int, doublecomplex *, int, Stype_t, Dtype_t, Mtype_t)
void zgssv(SuperMatrix *, int *, int *, SuperMatrix *, SuperMatrix *, SuperMatrix *, int *)