diff --git a/src/ksp/ksp/impls/cheby/cheby.c b/src/ksp/ksp/impls/cheby/cheby.c index 180d817..380f346 100644 --- a/src/ksp/ksp/impls/cheby/cheby.c +++ b/src/ksp/ksp/impls/cheby/cheby.c @@ -23,7 +23,7 @@ static PetscErrorCode KSPSetUp_Chebyshev(KSP ksp) PetscFunctionBegin; ierr = KSPSetWorkVecs(ksp,3);CHKERRQ(ierr); - if (cheb->emin == 0. || cheb->emax == 0.) { /* We need to estimate eigenvalues */ + if ((cheb->emin == 0. || cheb->emax == 0.) && !cheb->kspest) { /* We need to estimate eigenvalues */ ierr = KSPChebyshevEstEigSet(ksp,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE);CHKERRQ(ierr); } PetscFunctionReturn(0); @@ -289,6 +289,11 @@ static PetscErrorCode KSPSetFromOptions_Chebyshev(PetscOptions *PetscOptionsObje } } + /* We need to estimate eigenvalues; need to set this here so that KSPSetFromOptions() is called on the estimator */ + if ((cheb->emin == 0. || cheb->emax == 0.) && !cheb->kspest) { + ierr = KSPChebyshevEstEigSet(ksp,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE);CHKERRQ(ierr); + } + if (cheb->kspest) { PetscBool estrand = PETSC_FALSE; ierr = PetscOptionsBool("-ksp_chebyshev_esteig_random","Use Random right hand side for eigenvalue estimation","KSPChebyshevEstEigSetRandom",estrand,&estrand,NULL);CHKERRQ(ierr);