Discussion:
[petsc-users] [SLEPc] any restriction on the calling order of EPS functions?
Denis Davydov
2015-10-27 13:15:11 UTC
Permalink
Dear developers,

I wonder if there are any restriction (apart from obvious) on the calling order of EPS functions?
Is the following logic correct:

once I create EPS object (and specified it’s type)
ierr = EPSCreate (mpi_communicator, eps);
ierr = EPSSetType (eps, const_cast<char *>(EPSKRYLOVSCHUR)); // some solver, doesn’t matter which
ierr = EPSGetST(eps, st);
ierr = STSetType (st, const_cast<char *>(STSHIFT));

I can execute the following in arbitrary order:
ierr = EPSSetOperators (eps, *opA, PETSC_NULL);
ierr = EPSSetProblemType (eps, GHEP);
ierr = EPSSetInitialVector (eps, *initial_vector);
int ierr = EPSSetTarget (eps, *target_eigenvalue );
ierr = EPSSetWhichEigenpairs (eps, set_which);
ierr = EPSSetConvergenceTest (eps, EPS_CONV_ABS);
ierr = EPSSetDimensions (eps, n_eigenpairs, PETSC_DECIDE, PETSC_DECIDE);
int ierr = STSetMatMode(st,SHELL );

and solve:
ierr = EPSSetFromOptions (eps);
ierr = EPSSolve (eps);


Kind regards,
Denis
Hong
2015-10-27 14:38:17 UTC
Permalink
Denis:
Your code looks fine to me. There are examples under
slepc/src/eps/examples/tutorials
using ST with SHELL, e.g., ex10.c

Hong

Dear developers,
Post by Denis Davydov
I wonder if there are any restriction (apart from obvious) on the calling
order of EPS functions?
once I create EPS object (and specified it’s type)
ierr = EPSCreate (mpi_communicator, eps);
ierr = EPSSetType (eps, const_cast<char *>(EPSKRYLOVSCHUR)); // some
solver, doesn’t matter which
ierr = EPSGetST(eps, st);
ierr = STSetType (st, const_cast<char *>(STSHIFT));
ierr = EPSSetOperators (eps, *opA, PETSC_NULL);
ierr = EPSSetProblemType (eps, GHEP);
ierr = EPSSetInitialVector (eps, *initial_vector);
int ierr = EPSSetTarget (eps, *target_eigenvalue );
ierr = EPSSetWhichEigenpairs (eps, set_which);
ierr = EPSSetConvergenceTest (eps, EPS_CONV_ABS);
ierr = EPSSetDimensions (eps, n_eigenpairs, PETSC_DECIDE,
PETSC_DECIDE);
int ierr = STSetMatMode(st,SHELL );
ierr = EPSSetFromOptions (eps);
ierr = EPSSolve (eps);
Kind regards,
Denis
Jose E. Roman
2015-10-27 14:39:02 UTC
Permalink
Yes, in principle you can set options in any order. Let us know if anything does not work for you.

Jose
Post by Denis Davydov
Dear developers,
I wonder if there are any restriction (apart from obvious) on the calling order of EPS functions?
once I create EPS object (and specified it’s type)
ierr = EPSCreate (mpi_communicator, eps);
ierr = EPSSetType (eps, const_cast<char *>(EPSKRYLOVSCHUR)); // some solver, doesn’t matter which
ierr = EPSGetST(eps, st);
ierr = STSetType (st, const_cast<char *>(STSHIFT));
ierr = EPSSetOperators (eps, *opA, PETSC_NULL);
ierr = EPSSetProblemType (eps, GHEP);
ierr = EPSSetInitialVector (eps, *initial_vector);
int ierr = EPSSetTarget (eps, *target_eigenvalue );
ierr = EPSSetWhichEigenpairs (eps, set_which);
ierr = EPSSetConvergenceTest (eps, EPS_CONV_ABS);
ierr = EPSSetDimensions (eps, n_eigenpairs, PETSC_DECIDE, PETSC_DECIDE);
int ierr = STSetMatMode(st,SHELL );
ierr = EPSSetFromOptions (eps);
ierr = EPSSolve (eps);
Kind regards,
Denis
Denis Davydov
2015-10-27 15:01:15 UTC
Permalink
Thanks Jose and Hong for the prompt reply.
I will let you know if I encounter any issues due to calling function in different order.

Kind regards,
Denis
Post by Jose E. Roman
Yes, in principle you can set options in any order. Let us know if anything does not work for you.
Jose
Loading...