| Line 131... |
Line 131... |
EPS_BLOPEX *blopex = (EPS_BLOPEX *)eps->data;
|
EPS_BLOPEX *blopex = (EPS_BLOPEX *)eps->data;
|
PetscTruth isPrecond, isPreonly;
|
PetscTruth isPrecond, isPreonly;
|
|
|
PetscFunctionBegin;
|
PetscFunctionBegin;
|
if (!eps->ishermitian) {
|
if (!eps->ishermitian) {
|
SETERRQ(PETSC_ERR_SUP,"blopex only works for hermitian problems");
|
SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_SUP,"blopex only works for hermitian problems");
|
}
|
}
|
if (!eps->which) eps->which = EPS_SMALLEST_REAL;
|
if (!eps->which) eps->which = EPS_SMALLEST_REAL;
|
if (eps->which!=EPS_SMALLEST_REAL) {
|
if (eps->which!=EPS_SMALLEST_REAL) {
|
SETERRQ(1,"Wrong value of eps->which");
|
SETERRQ(((PetscObject)eps)->comm,1,"Wrong value of eps->which");
|
}
|
}
|
|
|
/* Change the default sigma to inf if necessary */
|
/* Change the default sigma to inf if necessary */
|
if (eps->which == EPS_LARGEST_MAGNITUDE || eps->which == EPS_LARGEST_REAL ||
|
if (eps->which == EPS_LARGEST_MAGNITUDE || eps->which == EPS_LARGEST_REAL ||
|
eps->which == EPS_LARGEST_IMAGINARY) {
|
eps->which == EPS_LARGEST_IMAGINARY) {
|
ierr = STSetDefaultShift(eps->OP, 3e300); CHKERRQ(ierr);
|
ierr = STSetDefaultShift(eps->OP, 3e300); CHKERRQ(ierr);
|
}
|
}
|
|
|
ierr = STSetUp(eps->OP); CHKERRQ(ierr);
|
ierr = STSetUp(eps->OP); CHKERRQ(ierr);
|
ierr = PetscTypeCompare((PetscObject)eps->OP, STPRECOND, &isPrecond); CHKERRQ(ierr);
|
ierr = PetscTypeCompare((PetscObject)eps->OP, STPRECOND, &isPrecond); CHKERRQ(ierr);
|
if (!isPrecond) SETERRQ(PETSC_ERR_SUP, "blopex only works with precond spectral transformation");
|
if (!isPrecond) SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_SUP, "blopex only works with STPRECOND");
|
ierr = STGetKSP(eps->OP, &blopex->ksp); CHKERRQ(ierr);
|
ierr = STGetKSP(eps->OP, &blopex->ksp); CHKERRQ(ierr);
|
ierr = PetscTypeCompare((PetscObject)blopex->ksp, KSPPREONLY, &isPreonly); CHKERRQ(ierr);
|
ierr = PetscTypeCompare((PetscObject)blopex->ksp, KSPPREONLY, &isPreonly); CHKERRQ(ierr);
|
if (!isPreonly)
|
if (!isPreonly)
|
SETERRQ(PETSC_ERR_SUP, "blopex only works with preonly ksp of the spectral transformation");
|
SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_SUP, "blopex only works with KSPPREONLY");
|
|
|
eps->ncv = eps->nev = PetscMin(eps->nev,eps->n);
|
eps->ncv = eps->nev = PetscMin(eps->nev,eps->n);
|
if (eps->mpd) PetscInfo(eps,"Warning: parameter mpd ignored\n");
|
if (eps->mpd) PetscInfo(eps,"Warning: parameter mpd ignored\n");
|
if (!eps->max_it) eps->max_it = PetscMax(100,2*eps->n/eps->ncv);
|
if (!eps->max_it) eps->max_it = PetscMax(100,2*eps->n/eps->ncv);
|
|
|
| Line 185... |
Line 185... |
if (eps->extraction) {
|
if (eps->extraction) {
|
ierr = PetscInfo(eps,"Warning: extraction type ignored\n");CHKERRQ(ierr);
|
ierr = PetscInfo(eps,"Warning: extraction type ignored\n");CHKERRQ(ierr);
|
}
|
}
|
|
|
/* dispatch solve method */
|
/* dispatch solve method */
|
if (eps->leftvecs) SETERRQ(PETSC_ERR_SUP,"Left vectors not supported in this solver");
|
if (eps->leftvecs) SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_SUP,"Left vectors not supported in this solver");
|
eps->ops->solve = EPSSolve_BLOPEX;
|
eps->ops->solve = EPSSolve_BLOPEX;
|
PetscFunctionReturn(0);
|
PetscFunctionReturn(0);
|
}
|
}
|
|
|
#undef __FUNCT__
|
#undef __FUNCT__
|
| Line 212... |
Line 212... |
eps->isgeneralized?eps:PETSC_NULL,eps->isgeneralized?OperatorBMultiVector:PETSC_NULL,
|
eps->isgeneralized?eps:PETSC_NULL,eps->isgeneralized?OperatorBMultiVector:PETSC_NULL,
|
eps,Precond_FnMultiVector,blopex->Y,
|
eps,Precond_FnMultiVector,blopex->Y,
|
blopex->blap_fn,blopex->tol,eps->max_it,0,&its,
|
blopex->blap_fn,blopex->tol,eps->max_it,0,&its,
|
eps->eigr,PETSC_NULL,0,eps->errest,PETSC_NULL,0);
|
eps->eigr,PETSC_NULL,0,eps->errest,PETSC_NULL,0);
|
#endif
|
#endif
|
if (info>0) SETERRQ1(PETSC_ERR_LIB,"Error in blopex (code=%d)",info);
|
if (info>0) SETERRQ1(((PetscObject)eps)->comm,PETSC_ERR_LIB,"Error in blopex (code=%d)",info);
|
|
|
eps->its = its;
|
eps->its = its;
|
eps->nconv = eps->ncv;
|
eps->nconv = eps->ncv;
|
if (info==-1) eps->reason = EPS_DIVERGED_ITS;
|
if (info==-1) eps->reason = EPS_DIVERGED_ITS;
|
else eps->reason = EPS_CONVERGED_TOL;
|
else eps->reason = EPS_CONVERGED_TOL;
|