11 #include "mkl_pardiso.h"
12 #include "mkl_types.h"
40 MKL_INT
n, *ia, *ja, maxfct, mnum;
102 pardisoinit(Bsol_data->pt, &mtype, Bsol_data->iparm);
106 for ( i = 0; i < 64; i++ )
108 Bsol_data->iparm[i] = 0;
110 for ( i = 0; i < 64; i++ )
112 Bsol_data->pt[i] = 0;
115 Bsol_data->iparm[0] = 1;
116 Bsol_data->iparm[1] = 2;
117 Bsol_data->iparm[3] = 0;
118 Bsol_data->iparm[4] = 0;
119 Bsol_data->iparm[5] = 0;
120 Bsol_data->iparm[6] = 0;
121 Bsol_data->iparm[7] = 2;
122 Bsol_data->iparm[8] = 0;
123 Bsol_data->iparm[9] = 13;
124 Bsol_data->iparm[10] = 1;
125 Bsol_data->iparm[11] = 0;
126 Bsol_data->iparm[12] = 0;
128 Bsol_data->iparm[13] = 0;
129 Bsol_data->iparm[14] = 0;
130 Bsol_data->iparm[15] = 0;
131 Bsol_data->iparm[16] = 0;
132 Bsol_data->iparm[17] = -1;
133 Bsol_data->iparm[18] = -1;
134 Bsol_data->iparm[19] = 0;
138 Bsol_data->iparm[34] = 1;
142 Bsol_data->iparm[7] = 0;
144 Bsol_data->iparm[26] = 1;
151 pardiso(Bsol_data->pt, &maxfct, &mnum, &mtype, &phase, &n, a, ia, ja,
152 &idum, &nrhs, Bsol_data->iparm, &msglvl, &ddum, &ddum, &error);
156 printf (
"\nERROR during symbolic factorization: %d", error);
168 pardiso(Bsol_data->pt, &maxfct, &mnum, &mtype, &phase, &n, a, ia, ja,
169 &idum, &nrhs, Bsol_data->iparm, &msglvl, &ddum, &ddum, &error);
173 printf (
"\nERROR during numerical factorization: %d", error);
180 *data = (
void *) Bsol_data;
191 void BSolDirect(
double *b,
double *x,
void *data) {
204 csrMat *U = &Bsol_data->U;
205 MKL_INT n = U->
nrows;
215 pardiso(Bsol_data->pt, &maxfct, &mnum, &mtype, &phase, &n, a, ia, ja,
216 &idum, &nrhs, Bsol_data->iparm, &msglvl, b, x, &error);
219 printf (
"\nERROR during solution: %d", error);
245 void LTSolDirect(
double *b,
double *x,
void *data) {
258 csrMat *U = &Bsol_data->U;
259 MKL_INT n = U->
nrows;
266 pardiso(Bsol_data->pt, &maxfct, &mnum, &mtype, &phase, &n, a, ia, ja,
267 &idum, &nrhs, Bsol_data->iparm, &msglvl, b, x, &error);
270 printf (
"\nERROR during solution: %d", error);
293 csrMat *U = &Bsol_data->U;
294 MKL_INT n = U->
nrows;
302 pardiso(Bsol_data->pt, &maxfct, &mnum, &mtype, &phase, &n, &ddum, ia, ja,
303 &idum, &nrhs, Bsol_data->iparm, &msglvl, &ddum, &ddum, &error);
307 printf (
"\nERROR during termination: %d", error);
330 complex
double *zk,
void **data) {
332 int i, j, nrow, ncol, nnzUB, nnzUC, *map;
333 csrMat *B, UC, eye, UA, UB;
336 MKL_INT *UCp, *UCi, n;
343 MKL_INT maxfct = num;
378 matadd(1.0, 0.0, &UA, &UB, &UC, NULL, map);
389 for (i = 0; i < num; i++) {
394 double zkr = creal(zk[i]);
395 double zkc = cimag(zk[i]);
397 Malloc(UCz, nnzUC, MKL_Complex16);
399 for (j = 0; j < nnzUC; j++) {
400 UCz[j].real = UCx[j];
405 for (j = 0; j < nnzUB; j++) {
409 CHKERR(!(p >= 0 && p < nnzUC));
410 UCz[p].real -= zkr * v;
411 UCz[p].imag -= zkc * v;
418 pardisoinit(ASBdata->pt, &mtype, ASBdata->iparm);
421 ASBdata->iparm[34] = 1;
425 ASBdata->iparm[7] = 0;
427 ASBdata->iparm[26] = 1;
434 pardiso(ASBdata->pt, &maxfct, &mnum, &mtype, &phase, &n, UCz, UCp, UCi,
435 &idum, &nrhs, ASBdata->iparm, &msglvl, &ddum, &ddum, &error);
439 printf (
"\nERROR during symbolic factorization: %d", error);
446 memcpy(ASBdata->pt, ASBdata0->pt, 64*
sizeof(
void*));
447 memcpy(ASBdata->iparm, ASBdata0->iparm, 64*
sizeof(MKL_INT));
454 pardiso(ASBdata->pt, &maxfct, &mnum, &mtype, &phase, &n, UCz, UCp, UCi,
455 &idum, &nrhs, ASBdata->iparm, &msglvl, &ddum, &ddum, &error);
459 printf (
"\nERROR during numerical factorization: %d", error);
464 ASBdata->maxfct = maxfct;
465 ASBdata->mnum = mnum;
470 Malloc(ASBdata->
b, nrow, MKL_Complex16);
471 Malloc(ASBdata->
x, nrow, MKL_Complex16);
502 double *xz,
void *data) {
515 MKL_Complex16 *b = sol_data->
b;
516 MKL_Complex16 *x = sol_data->
x;
519 for (i = 0; i < n; i++) {
529 pardiso(sol_data->pt, &sol_data->maxfct, &sol_data->mnum, &mtype, &phase,
530 &sol_data->
n, sol_data->a, sol_data->ia, sol_data->ja,
531 &idum, &nrhs, sol_data->iparm, &msglvl, b, x, &error);
535 printf (
"\nERROR during solution: %d", error);
560 for (i = 0; i < n; i++) {
581 for (i=0; i<num; i++) {
589 pardiso(sol_data->pt, &sol_data->maxfct, &sol_data->mnum, &mtype, &phase,
590 &sol_data->
n, sol_data->a, sol_data->ia, sol_data->ja,
591 &idum, &nrhs, sol_data->iparm, &msglvl, &ddum, &ddum, &error);
595 printf (
"\nERROR during termination: %d", error);
void triuCsr(csrMat *A, csrMat *U)
void ASIGMABSolDirect(int n, double *br, double *bi, double *xr, double *xz, void *data)
complex linear solver routine passed to evsl
int SetupASIGMABSolDirect(csrMat *A, csrMat *BB, int num, complex double *zk, void **data)
setup CXsparse solver for A - SIGMA B
int SetupBSolDirect(csrMat *B, void **data)
Setup the B-sol by computing the Cholesky factorization of B.
void FreeASIGMABSolDirect(int num, void **data)
free the data needed by CXSparse
void FreeBSolDirectData(void *data)
Free solver data.
void free_csr(csrMat *csr)
memory deallocation for csr matrix
This file contains function prototypes and constant definitions internally used in EVSL...
int speye(int n, csrMat *A)
return an identity matrix of dimension n
#define Malloc(base, nmem, type)
evslStat evslstat
global statistics of EVSL
struct _ASBSolDataDirect ASBSolDataDirect
sparse matrix format: the compressed sparse row (CSR) format, 0-based
void LTSolDirect(double *b, double *x, void *data)
Solver function of L^{T} x = L^{-T}*b.
int matadd(double alp, double bet, csrMat *A, csrMat *B, csrMat *C, int *mapA, int *mapB)
matrix addition C = alp * A + bet * B
struct _BSolDataDirect BSolDataDirect
void BSolDirect(double *b, double *x, void *data)
Solver function of B.
Definitions used for direct solver interface.
double evsl_timer()
evsl timer for mac