11 const int *row_ptr,
const int *col_ind,
const int *diag_ind,
double *nnz_data)
13 int idx, jdx, kdx, ldx, mdx, row, col;
14 int st, ed, ijdx, kjdx, ijed, kjed;
17 lapack_int info, *ipiv;
20 ipiv = (lapack_int *)malloc(
sizeof(lapack_int)*
nvars);
22 for (idx=0; idx<neles; idx++) {
26 for (kdx=st; kdx<ed; kdx++) {
27 ldx = diag_ind[col_ind[kdx]];
28 cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans,
nvars,
nvars,
nvars, 1.0, \
34 ijed = row_ptr[idx+1];
35 kjed = row_ptr[col_ind[kdx] + 1];
37 while (kjdx < kjed && ijdx < ijed) {
38 if (col_ind[ijdx] == col_ind[kjdx]) {
45 else if (col_ind[ijdx] < col_ind[kjdx]) ijdx++;
50 for (jdx=0; jdx<mdx; jdx++) {
53 cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans,
nvars,
nvars,
nvars, -1.0, \
58 if (info != 0) printf(
"Lapack dgetrf function error\n");
60 if (info != 0) printf(
"Lapack dgetrf function error\n");
72 sparse_status_t status;
73 struct matrix_descr ldescr, udescr;
77 ldescr.type = SPARSE_MATRIX_TYPE_BLOCK_TRIANGULAR;
78 ldescr.mode = SPARSE_FILL_MODE_LOWER;
79 ldescr.diag = SPARSE_DIAG_UNIT;
82 udescr.type = SPARSE_MATRIX_TYPE_BLOCK_TRIANGULAR;
83 udescr.mode = SPARSE_FILL_MODE_UPPER;
84 udescr.diag = SPARSE_DIAG_NON_UNIT;
86 status = mkl_sparse_d_trsv(SPARSE_OPERATION_NON_TRANSPOSE, 1.0, op, ldescr, b, b);
88 status = mkl_sparse_d_trsv(SPARSE_OPERATION_NON_TRANSPOSE, 1.0, op, udescr, b, b);
97 double *nnz_data,
double *b)
99 int idx, jdx, kdx, row, col;
100 int dd, st, ed, cind;
104 for (idx=0; idx<neles; idx++) {
110 for (jdx=st; jdx<dd; jdx++) {
114 &b[cind*
nvars], 1, 1.0, arr, 1);
121 for (idx=neles-1; idx>-1; idx--) {
127 for (jdx=(dd+1); jdx<ed; jdx++) {
131 &b[cind*
nvars], 1, 1.0, arr, 1);
135 arr, 1, 1.0, &b[idx*
nvars], 1);
ucfd_precon_status_t ilu0_prepare_bsr(const int neles, const int nvars, const int *row_ptr, const int *col_ind, const int *diag_ind, double *nnz_data)
ucfd_precon_status_t ilu0_sweep_bsr_mkl(sparse_matrix_t op, double *b)
ucfd_precon_status_t ilu0_sweep_bsr(const int neles, const int nvars, const int *row_ptr, const int *col_ind, const int *diag_ind, double *nnz_data, double *b)
@ UCFD_PRECON_SPARSE_FAILED