10 #ifdef CHOLMOD_USE_LONG
11 #define CHOLMOD(name) cholmod_l_ ## name
13 #define CHOLMOD(name) cholmod_ ## name
35 cholmod_sparse *B = NULL;
36 Malloc(B, 1, cholmod_sparse);
40 #ifdef CHOLMOD_USE_LONG
45 for (i=0; i<B->nrow+1; i++) {
49 for (i=0; i<B->nzmax; i++) {
63 #ifdef CHOLMOD_USE_LONG
64 B->itype = CHOLMOD_LONG;
66 B->itype = CHOLMOD_INT;
68 B->xtype = CHOLMOD_REAL;
69 B->dtype = CHOLMOD_DOUBLE;
86 B->xtype = CHOLMOD_REAL;
87 B->dtype = CHOLMOD_DOUBLE;
94 cholmod_dense* arr_to_cholmod_dense_alloc(
int m,
int n,
double *A) {
95 cholmod_dense *B = NULL;
96 Malloc(B, 1, cholmod_dense);
103 B->xtype = CHOLMOD_REAL;
104 B->dtype = CHOLMOD_DOUBLE;
148 cholmod_sparse *Bcholmod;
149 cholmod_common *cc = &Bsol_data->
cm;
162 CHOLMOD(check_sparse)(Bcholmod, cc);
165 LB =
CHOLMOD(analyze)(Bcholmod, cc);
169 CHOLMOD(factorize)(Bcholmod, LB, cc);
178 #ifdef CHOLMOD_USE_LONG
190 *data = (
void *) Bsol_data;
200 cholmod_common *cc = &data->
cm;
250 double *xz,
void *data) {
251 void* Numeric = data;
252 double Control[UMFPACK_CONTROL];
253 umfpack_zl_defaults(Control);
254 Control[UMFPACK_IRSTEP] = 0;
255 umfpack_zl_solve(UMFPACK_A, NULL, NULL, NULL, NULL, xr, xz, br, bi,
256 Numeric, Control, NULL);
273 complex
double *zk,
void **data) {
274 int i, j, nrow, ncol, nnzB, nnzC, *map, status;
280 double *Cx, *Cz, zkr1;
281 void *Symbolic=NULL, *Numeric=NULL;
303 matadd(1.0, 0.0, A, B, &C, NULL, map);
309 for (i=0; i<nrow+1; i++) {
312 for (i=0; i<nnzC; i++) {
319 for (i=0; i<num; i++) {
321 double zkr = creal(zk[i]);
322 double zkc = cimag(zk[i]);
325 for (j=0; j<nnzB; j++) {
329 Cx[p] -= (zkr - zkr1) * v;
335 status = umfpack_zl_symbolic(nrow, ncol, Cp, Ci, Cx, Cz, &Symbolic,
338 printf(
"umfpack_zl_symbolic failed, %d\n", status);
343 double Control[UMFPACK_CONTROL], Info[UMFPACK_INFO];
344 Control[UMFPACK_PRL] = 0;
345 status = umfpack_zl_numeric(Cp, Ci, Cx, Cz, Symbolic, &Numeric, Control, Info);
346 umfpack_zl_report_info(Control, Info);
348 printf(
"umfpack_zl_numeric failed and exit, %d\n", status);
359 umfpack_zl_free_symbolic(&Symbolic);
382 for (i=0; i<num; i++) {
383 umfpack_zl_free_numeric(&data[i]);
void arr_to_cholmod_dense(int m, int n, double *A, cholmod_dense *B)
wrap an array in cholmod dense (no copying)
void BSolDirect(double *b, double *x, void *data)
Solver function of B.
cholmod_dense * cholmod_W
void FreeASIGMABSolDirect(int num, void **data)
free the data needed by UMFpack
struct _BSolDataDirect BSolDataDirect
cholmod_sparse * csrMat_to_cholmod_sparse(csrMat *A, int stype)
Create cholmod_sparse matrix just as a wrapper of a csrMat This will be useful for the B matrix...
#define Calloc(base, nmem, type)
void free_csr(csrMat *csr)
memory deallocation for csr matrix
This file contains function prototypes and constant definitions internally used in EVSL...
int SetupBSolDirect(csrMat *B, void **data)
Setup the B-sol by computing the Cholesky factorization of B.
int speye(int n, csrMat *A)
return an identity matrix of dimension n
#define Malloc(base, nmem, type)
void LTSolDirect(double *b, double *x, void *data)
Solver function of L^{T} x = L^{-T}*b.
evslStat evslstat
global statistics of EVSL
cholmod_dense * cholmod_E
sparse matrix format: the compressed sparse row (CSR) format, 0-based
int SetupASIGMABSolDirect(csrMat *A, csrMat *BB, int num, complex double *zk, void **data)
setup the default solver for A - SIGMA B
int matadd(double alp, double bet, csrMat *A, csrMat *B, csrMat *C, int *mapA, int *mapB)
matrix addition C = alp * A + bet * B
cholmod_dense * cholmod_Y
Definitions used for direct solver interface.
void ASIGMABSolDirect(int n, double *br, double *bi, double *xr, double *xz, void *data)
default complex linear solver routine passed to evsl
double evsl_timer()
evsl timer for mac
void FreeBSolDirectData(void *vdata)
Free solver data.