| Line 109... |
Line 109... |
|
|
if (st->shift_matrix == ST_MATMODE_SHELL) {
|
if (st->shift_matrix == ST_MATMODE_SHELL) {
|
ierr = STMatShellCreate(st,&P);CHKERRQ(ierr);
|
ierr = STMatShellCreate(st,&P);CHKERRQ(ierr);
|
//TODO: set the apply and apply transpose to st->mat
|
//TODO: set the apply and apply transpose to st->mat
|
destroyP = PETSC_TRUE;
|
destroyP = PETSC_TRUE;
|
} else if (!(PetscAbsScalar(st->sigma) < PETSC_REAL_MAX) && st->B) {
|
} else if (!(PetscAbsScalar(st->sigma) < PETSC_MAX_REAL) && st->B) {
|
P = st->B;
|
P = st->B;
|
destroyP = PETSC_FALSE;
|
destroyP = PETSC_FALSE;
|
} else if (st->sigma == 0.0) {
|
} else if (st->sigma == 0.0) {
|
P = st->A;
|
P = st->A;
|
destroyP = PETSC_FALSE;
|
destroyP = PETSC_FALSE;
|
} else if (PetscAbsScalar(st->sigma) < PETSC_REAL_MAX) {
|
} else if (PetscAbsScalar(st->sigma) < PETSC_MAX_REAL) {
|
if (st->shift_matrix == ST_MATMODE_INPLACE) {
|
if (st->shift_matrix == ST_MATMODE_INPLACE) {
|
P = st->A;
|
P = st->A;
|
destroyP = PETSC_FALSE;
|
destroyP = PETSC_FALSE;
|
} else {
|
} else {
|
ierr = MatDuplicate(st->A, MAT_COPY_VALUES, &P); CHKERRQ(ierr);
|
ierr = MatDuplicate(st->A, MAT_COPY_VALUES, &P); CHKERRQ(ierr);
|
| Line 149... |
Line 149... |
ierr = KSPSetOperators(st->ksp,setmat?P:PETSC_NULL,P,DIFFERENT_NONZERO_PATTERN);CHKERRQ(ierr);
|
ierr = KSPSetOperators(st->ksp,setmat?P:PETSC_NULL,P,DIFFERENT_NONZERO_PATTERN);CHKERRQ(ierr);
|
|
|
if (destroyP) {
|
if (destroyP) {
|
ierr = MatDestroy(P); CHKERRQ(ierr);
|
ierr = MatDestroy(P); CHKERRQ(ierr);
|
} else if (st->shift_matrix == ST_MATMODE_INPLACE && builtP) {
|
} else if (st->shift_matrix == ST_MATMODE_INPLACE && builtP) {
|
if (st->sigma != 0.0 && PetscAbsScalar(st->sigma) < PETSC_REAL_MAX) {
|
if (st->sigma != 0.0 && PetscAbsScalar(st->sigma) < PETSC_MAX_REAL) {
|
if (st->B) {
|
if (st->B) {
|
ierr = MatAXPY(st->A,st->sigma,st->B,st->str);CHKERRQ(ierr);
|
ierr = MatAXPY(st->A,st->sigma,st->B,st->str);CHKERRQ(ierr);
|
} else {
|
} else {
|
ierr = MatShift(st->A,st->sigma);CHKERRQ(ierr);
|
ierr = MatShift(st->A,st->sigma);CHKERRQ(ierr);
|
}
|
}
|