19#include "fasp_functs.h"
52 SuperMatrix A, L, U, B;
56 int nrhs = 1, info, m = ptrA->
row, n = ptrA->
col, nnz = ptrA->
nnz;
58 if (prtlvl >
PRINT_NONE) printf(
"superlu: nr=%d, nc=%d, nnz=%d\n", m, n, nnz);
60 REAL start_time, end_time;
70 dCreate_CompCol_Matrix(&A, m, n, nnz, tempA.
val, tempA.
JA, tempA.
IA, SLU_NR, SLU_D,
74 dCreate_Dense_Matrix(&B, m, nrhs, tempb.
val, m, SLU_DN, SLU_D, SLU_GE);
76 if (!(perm_r = intMalloc(m))) ABORT(
"Malloc fails for perm_r[].");
77 if (!(perm_c = intMalloc(n))) ABORT(
"Malloc fails for perm_c[].");
80 superlu_options_t options;
81 set_default_options(&options);
82 options.ColPerm = COLAMD;
89 dgssv(&options, &A, perm_c, perm_r, &L, &U, &B, &stat, &info);
91 DNformat* BB = (DNformat*)B.Store;
92 u->
val = (
double*)BB->nzval;
101 SUPERLU_FREE(perm_r);
102 SUPERLU_FREE(perm_c);
103 Destroy_CompCol_Matrix(&A);
104 Destroy_SuperMatrix_Store(&B);
105 Destroy_SuperNode_Matrix(&L);
106 Destroy_CompCol_Matrix(&U);
113 printf(
"### ERROR: SuperLU is not available!\n");
void fasp_cputime(const char *message, const REAL cputime)
Print CPU walltime.
void fasp_gettime(REAL *time)
Get system time.
dvector fasp_dvec_create(const INT m)
Create dvector data space of REAL type.
void fasp_dvec_cp(const dvector *x, dvector *y)
Copy dvector x to dvector y.
dCSRmat fasp_dcsr_create(const INT m, const INT n, const INT nnz)
Create CSR sparse matrix data memory space.
void fasp_dcsr_cp(const dCSRmat *A, dCSRmat *B)
copy a dCSRmat to a new one B=A
int fasp_solver_superlu(dCSRmat *ptrA, dvector *b, dvector *u, const SHORT prtlvl)
Solve Au=b by SuperLU.
Main header file for the FASP project.
#define SHORT
FASP integer and floating point numbers.
#define FASP_SUCCESS
Definition of return status and error messages.
#define PRINT_NONE
Print level for all subroutines – not including DEBUG output.
#define ERROR_SOLVER_EXIT
Sparse matrix of REAL type in CSR format.
INT col
column of matrix A, n
REAL * val
nonzero entries of A
INT row
row number of matrix A, m
INT * IA
integer array of row pointers, the size is m+1
INT nnz
number of nonzero entries
INT * JA
integer array of column indexes, the size is nnz
Vector with n entries of REAL type.
REAL * val
actual vector entries