Actual source code: primme.c

  1: /*
  2:        This file implements a wrapper to the PRIMME library

  4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  6:    Copyright (c) 2002-2012, Universitat Politecnica de Valencia, Spain

  8:    This file is part of SLEPc.
  9:       
 10:    SLEPc is free software: you can redistribute it and/or modify it under  the
 11:    terms of version 3 of the GNU Lesser General Public License as published by
 12:    the Free Software Foundation.

 14:    SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY 
 15:    WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS 
 16:    FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for 
 17:    more details.

 19:    You  should have received a copy of the GNU Lesser General  Public  License
 20:    along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
 21:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 22: */

 24: #include <petscsys.h>
 25: #include <slepc-private/epsimpl.h>    /*I "slepceps.h" I*/
 26: #include <slepc-private/stimpl.h>

 28: PetscErrorCode EPSSolve_PRIMME(EPS);

 30: EXTERN_C_BEGIN
 31: #include <primme.h>
 32: EXTERN_C_END

 34: typedef struct {
 35:   primme_params primme;           /* param struc */
 36:   primme_preset_method method;    /* primme method */
 37:   Mat       A;                    /* problem matrix */
 38:   EPS       eps;                  /* EPS current context */
 39:   KSP       ksp;                  /* linear solver and preconditioner */
 40:   Vec       x,y;                  /* auxiliary vectors */
 41:   PetscReal target;               /* a copy of eps's target */
 42: } EPS_PRIMME;

 44: EPSPRIMMEMethod methodN[] = {
 45:   EPS_PRIMME_DYNAMIC,
 46:   EPS_PRIMME_DEFAULT_MIN_TIME,
 47:   EPS_PRIMME_DEFAULT_MIN_MATVECS,
 48:   EPS_PRIMME_ARNOLDI,
 49:   EPS_PRIMME_GD,
 50:   EPS_PRIMME_GD_PLUSK,
 51:   EPS_PRIMME_GD_OLSEN_PLUSK,
 52:   EPS_PRIMME_JD_OLSEN_PLUSK,
 53:   EPS_PRIMME_RQI,
 54:   EPS_PRIMME_JDQR,
 55:   EPS_PRIMME_JDQMR,
 56:   EPS_PRIMME_JDQMR_ETOL,
 57:   EPS_PRIMME_SUBSPACE_ITERATION,
 58:   EPS_PRIMME_LOBPCG_ORTHOBASIS,
 59:   EPS_PRIMME_LOBPCG_ORTHOBASISW
 60: };

 62: static void multMatvec_PRIMME(void *in,void *out,int *blockSize,primme_params *primme);
 63: static void applyPreconditioner_PRIMME(void *in,void *out,int *blockSize,struct primme_params *primme);

 65: void par_GlobalSumDouble(void *sendBuf,void *recvBuf,int *count,primme_params *primme)
 66: {
 68:   MPI_Allreduce((double*)sendBuf,(double*)recvBuf,*count,MPI_DOUBLE,MPI_SUM,((PetscObject)(primme->commInfo))->comm);CHKERRABORT(((PetscObject)(primme->commInfo))->comm,ierr);
 69: }

 73: PetscErrorCode EPSSetUp_PRIMME(EPS eps)
 74: {
 76:   PetscMPIInt    numProcs,procID;
 77:   EPS_PRIMME     *ops = (EPS_PRIMME*)eps->data;
 78:   primme_params  *primme = &ops->primme;
 79:   PetscBool      t;

 82:   MPI_Comm_size(((PetscObject)eps)->comm,&numProcs);
 83:   MPI_Comm_rank(((PetscObject)eps)->comm,&procID);
 84: 
 85:   /* Check some constraints and set some default values */
 86:   if (!eps->max_it) eps->max_it = PetscMax(1000,eps->n);
 87:   STGetOperators(eps->OP,&ops->A,PETSC_NULL);
 88:   if (!ops->A) SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_ARG_WRONGSTATE,"The problem matrix has to be specified first");
 89:   if (!eps->ishermitian) SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_SUP,"PRIMME is only available for Hermitian problems");
 90:   if (eps->isgeneralized) SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_SUP,"PRIMME is not available for generalized problems");
 91:   if (eps->arbit_func) SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_SUP,"Arbitrary selection of eigenpairs not supported in this solver");
 92:   if (!eps->which) eps->which = EPS_LARGEST_REAL;

 94:   /* Change the default sigma to inf if necessary */
 95:   if (eps->which == EPS_LARGEST_MAGNITUDE || eps->which == EPS_LARGEST_REAL ||
 96:       eps->which == EPS_LARGEST_IMAGINARY) {
 97:     STSetDefaultShift(eps->OP,3e300);
 98:   }

100:   /* Avoid setting the automatic shift when a target is set */
101:   STSetDefaultShift(eps->OP,0.0);

103:   STSetUp(eps->OP);
104:   PetscObjectTypeCompare((PetscObject)eps->OP,STPRECOND,&t);
105:   if (!t) SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_SUP,"PRIMME only works with STPRECOND");

107:   /* Transfer SLEPc options to PRIMME options */
108:   primme->n = eps->n;
109:   primme->nLocal = eps->nloc;
110:   primme->numEvals = eps->nev;
111:   primme->matrix = ops;
112:   primme->commInfo = eps;
113:   primme->maxMatvecs = eps->max_it;
114:   primme->eps = eps->tol==PETSC_DEFAULT?SLEPC_DEFAULT_TOL:eps->tol;
115:   primme->numProcs = numProcs;
116:   primme->procID = procID;
117:   primme->printLevel = 0;
118:   primme->correctionParams.precondition = 1;

120:   if (!eps->which) eps->which = EPS_LARGEST_REAL;
121:   switch(eps->which) {
122:     case EPS_LARGEST_REAL:
123:       primme->target = primme_largest;
124:       break;
125:     case EPS_SMALLEST_REAL:
126:       primme->target = primme_smallest;
127:       break;
128:     case EPS_TARGET_MAGNITUDE:
129:     case EPS_TARGET_REAL:
130:       primme->target = primme_closest_abs;
131:       primme->numTargetShifts = 1;
132:       ops->target = PetscRealPart(eps->target);
133:       primme->targetShifts = &ops->target;
134:       break;
135:     default:
136:       SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_SUP,"'which' value does not supported by PRIMME");
137:       break;
138:   }
139: 
140:   if (primme_set_method(ops->method,primme) < 0)
141:     SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_SUP,"PRIMME method not valid");
142: 
143:   /* If user sets ncv, maxBasisSize is modified. If not, ncv is set as maxBasisSize */
144:   if (eps->ncv) primme->maxBasisSize = eps->ncv;
145:   else eps->ncv = primme->maxBasisSize;
146:   if (eps->ncv < eps->nev+primme->maxBlockSize)
147:     SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_SUP,"PRIMME needs ncv >= nev+maxBlockSize");
148:   if (eps->mpd) { PetscInfo(eps,"Warning: parameter mpd ignored\n"); }

150:   if (eps->extraction) { PetscInfo(eps,"Warning: extraction type ignored\n"); }

152:   /* Set workspace */
153:   EPSAllocateSolution(eps);

155:   /* Setup the preconditioner */
156:   ops->eps = eps;
157:   if (primme->correctionParams.precondition) {
158:     STGetKSP(eps->OP,&ops->ksp);
159:     PetscObjectTypeCompare((PetscObject)ops->ksp,KSPPREONLY,&t);
160:     if (!t) SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_SUP,"PRIMME only works with KSPPREONLY");
161:     primme->preconditioner = PETSC_NULL;
162:     primme->applyPreconditioner = applyPreconditioner_PRIMME;
163:   }

165:   /* Prepare auxiliary vectors */
166:   VecCreateMPIWithArray(((PetscObject)eps)->comm,1,eps->nloc,eps->n,PETSC_NULL,&ops->x);
167:   VecCreateMPIWithArray(((PetscObject)eps)->comm,1,eps->nloc,eps->n,PETSC_NULL,&ops->y);
168: 
169:   /* dispatch solve method */
170:   if (eps->leftvecs) SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_SUP,"Left vectors not supported in this solver");
171:   eps->ops->solve = EPSSolve_PRIMME;
172:   return(0);
173: }

177: PetscErrorCode EPSSolve_PRIMME(EPS eps)
178: {
180:   EPS_PRIMME     *ops = (EPS_PRIMME *)eps->data;
181:   PetscScalar    *a;
182: #if defined(PETSC_USE_COMPLEX)
183:   PetscInt       i;
184:   PetscReal      *evals;
185: #endif

188:   /* Reset some parameters left from previous runs */
189:   ops->primme.aNorm    = 0.0;
190:   ops->primme.initSize = eps->nini;
191:   ops->primme.iseed[0] = -1;

193:   /* Call PRIMME solver */
194:   VecGetArray(eps->V[0],&a);
195: #if !defined(PETSC_USE_COMPLEX)
196:   dprimme(eps->eigr,a,eps->errest,&ops->primme);
197: #else
198:   /* PRIMME returns real eigenvalues, but SLEPc works with complex ones */
199:   PetscMalloc(eps->ncv*sizeof(PetscReal),&evals);
200:   zprimme(evals,(Complex_Z*)a,eps->errest,&ops->primme);
201:   for (i=0;i<eps->ncv;i++)
202:     eps->eigr[i] = evals[i];
203:   PetscFree(evals);
204: #endif
205:   VecRestoreArray(eps->V[0],&a);
206: 
207:   switch(ierr) {
208:     case 0: /* Successful */
209:       break;

211:     case -1:
212:       SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_SUP,"PRIMME: Failed to open output file");
213:       break;

215:     case -2:
216:       SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_SUP,"PRIMME: Insufficient integer or real workspace allocated");
217:       break;

219:     case -3:
220:       SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_SUP,"PRIMME: main_iter encountered a problem");
221:       break;

223:     default:
224:       SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_SUP,"PRIMME: some parameters wrong configured");
225:       break;
226:   }

228:   eps->nconv = ops->primme.initSize >= 0 ? ops->primme.initSize : 0;
229:   eps->reason = eps->ncv >= eps->nev ? EPS_CONVERGED_TOL : EPS_DIVERGED_ITS;
230:   eps->its = ops->primme.stats.numOuterIterations;
231:   eps->OP->applys = ops->primme.stats.numMatvecs;
232:   return(0);
233: }

237: static void multMatvec_PRIMME(void *in,void *out,int *blockSize,primme_params *primme)
238: {
240:   PetscInt       i,N = primme->n;
241:   EPS_PRIMME     *ops = (EPS_PRIMME *)primme->matrix;
242:   Vec            x = ops->x,y = ops->y;
243:   Mat            A = ops->A;

246:   for (i=0;i<*blockSize;i++) {
247:     /* build vectors using 'in' an 'out' workspace */
248:     VecPlaceArray(x,(PetscScalar*)in+N*i);CHKERRABORT(((PetscObject)A)->comm,ierr);
249:     VecPlaceArray(y,(PetscScalar*)out+N*i);CHKERRABORT(((PetscObject)A)->comm,ierr);

251:     MatMult(A,x,y);CHKERRABORT(((PetscObject)A)->comm,ierr);
252: 
253:     VecResetArray(x);CHKERRABORT(((PetscObject)A)->comm,ierr);
254:     VecResetArray(y);CHKERRABORT(((PetscObject)A)->comm,ierr);
255:   }
256:   PetscFunctionReturnVoid();
257: }

261: static void applyPreconditioner_PRIMME(void *in,void *out,int *blockSize,struct primme_params *primme)
262: {
264:   PetscInt       i,N = primme->n,lits;
265:   EPS_PRIMME     *ops = (EPS_PRIMME *)primme->matrix;
266:   Vec            x = ops->x,y = ops->y;
267: 
269:   for (i=0;i<*blockSize;i++) {
270:     /* build vectors using 'in' an 'out' workspace */
271:     VecPlaceArray(x,(PetscScalar*)in+N*i);CHKERRABORT(((PetscObject)ops->ksp)->comm,ierr);
272:     VecPlaceArray(y,(PetscScalar*)out+N*i);CHKERRABORT(((PetscObject)ops->ksp)->comm,ierr);

274:     KSPSolve(ops->ksp,x,y);CHKERRABORT(((PetscObject)ops->ksp)->comm,ierr);
275:     KSPGetIterationNumber(ops->ksp,&lits);CHKERRABORT(((PetscObject)ops->ksp)->comm,ierr);
276:     ops->eps->OP->lineariterations+= lits;
277: 
278:     VecResetArray(x);CHKERRABORT(((PetscObject)ops->ksp)->comm,ierr);
279:     VecResetArray(y);CHKERRABORT(((PetscObject)ops->ksp)->comm,ierr);
280:   }
281:   PetscFunctionReturnVoid();
282: }

286: PetscErrorCode EPSReset_PRIMME(EPS eps)
287: {
289:   EPS_PRIMME     *ops = (EPS_PRIMME *)eps->data;

292:   primme_Free(&ops->primme);
293:   VecDestroy(&ops->x);
294:   VecDestroy(&ops->y);
295:   EPSFreeSolution(eps);
296:   return(0);
297: }

301: PetscErrorCode EPSDestroy_PRIMME(EPS eps)
302: {

306:   PetscFree(eps->data);
307:   PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSPRIMMESetBlockSize_C","",PETSC_NULL);
308:   PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSPRIMMESetMethod_C","",PETSC_NULL);
309:   PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSPRIMMEGetBlockSize_C","",PETSC_NULL);
310:   PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSPRIMMEGetMethod_C","",PETSC_NULL);
311:   return(0);
312: }

316: PetscErrorCode EPSView_PRIMME(EPS eps,PetscViewer viewer)
317: {
318:   PetscErrorCode  ierr;
319:   PetscBool       isascii;
320:   primme_params   *primme = &((EPS_PRIMME *)eps->data)->primme;
321:   EPSPRIMMEMethod methodn;
322:   PetscMPIInt     rank;

325:   PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);
326:   if (!isascii) SETERRQ1(((PetscObject)eps)->comm,1,"Viewer type %s not supported for EPSPRIMME",((PetscObject)viewer)->type_name);
327: 
328:   PetscViewerASCIIPrintf(viewer,"  PRIMME: block size=%d\n",primme->maxBlockSize);
329:   EPSPRIMMEGetMethod(eps,&methodn);
330:   PetscViewerASCIIPrintf(viewer,"  PRIMME: solver method: %s\n",EPSPRIMMEMethods[methodn]);

332:   /* Display PRIMME params */
333:   MPI_Comm_rank(((PetscObject)eps)->comm,&rank);
334:   if (!rank) primme_display_params(*primme);
335:   return(0);
336: }

340: PetscErrorCode EPSSetFromOptions_PRIMME(EPS eps)
341: {
342:   PetscErrorCode  ierr;
343:   EPS_PRIMME      *ctx = (EPS_PRIMME *)eps->data;
344:   PetscInt        bs;
345:   EPSPRIMMEMethod meth;
346:   PetscBool       flg;

349:   PetscOptionsHead("EPS PRIMME Options");
350:   PetscOptionsInt("-eps_primme_block_size","Maximum block size","EPSPRIMMESetBlockSize",ctx->primme.maxBlockSize,&bs,&flg);
351:   if (flg) { EPSPRIMMESetBlockSize(eps,bs); }
352:   PetscOptionsEnum("-eps_primme_method","Method for solving the eigenproblem","EPSPRIMMESetMethod",EPSPRIMMEMethods,(PetscEnum)ctx->method,(PetscEnum*)&meth,&flg);
353:   if (flg) { EPSPRIMMESetMethod(eps,meth); }
354:   PetscOptionsTail();
355:   return(0);
356: }

358: EXTERN_C_BEGIN
361: PetscErrorCode EPSPRIMMESetBlockSize_PRIMME(EPS eps,PetscInt bs)
362: {
363:   EPS_PRIMME *ops = (EPS_PRIMME*)eps->data;

366:   if (bs == PETSC_DEFAULT) ops->primme.maxBlockSize = 1;
367:   else if (bs <= 0) SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_ARG_OUTOFRANGE,"PRIMME: block size must be positive");
368:   else ops->primme.maxBlockSize = bs;
369:   return(0);
370: }
371: EXTERN_C_END

375: /*@
376:    EPSPRIMMESetBlockSize - The maximum block size the code will try to use. 
377:    The user should set
378:    this based on the architecture specifics of the target computer, 
379:    as well as any a priori knowledge of multiplicities. The code does 
380:    NOT require BlockSize > 1 to find multiple eigenvalues.  For some 
381:    methods, keeping BlockSize = 1 yields the best overall performance.

383:    Collective on EPS

385:    Input Parameters:
386: +  eps - the eigenproblem solver context
387: -  bs - block size

389:    Options Database Key:
390: .  -eps_primme_block_size - Sets the max allowed block size value

392:    Notes:
393:    If the block size is not set, the value established by primme_initialize
394:    is used.

396:    Level: advanced
397: .seealso: EPSPRIMMEGetBlockSize()
398: @*/
399: PetscErrorCode EPSPRIMMESetBlockSize(EPS eps,PetscInt bs)
400: {

406:   PetscTryMethod(eps,"EPSPRIMMESetBlockSize_C",(EPS,PetscInt),(eps,bs));
407:   return(0);
408: }

410: EXTERN_C_BEGIN
413: PetscErrorCode EPSPRIMMEGetBlockSize_PRIMME(EPS eps,PetscInt *bs)
414: {
415:   EPS_PRIMME *ops = (EPS_PRIMME*)eps->data;

418:   if (bs) *bs = ops->primme.maxBlockSize;
419:   return(0);
420: }
421: EXTERN_C_END

425: /*@
426:    EPSPRIMMEGetBlockSize - Get the maximum block size the code will try to use. 

428:    Collective on EPS

430:    Input Parameters:
431: .  eps - the eigenproblem solver context
432:     
433:    Output Parameters:  
434: .  bs - returned block size 

436:    Level: advanced
437: .seealso: EPSPRIMMESetBlockSize()
438: @*/
439: PetscErrorCode EPSPRIMMEGetBlockSize(EPS eps,PetscInt *bs)
440: {

445:   PetscTryMethod(eps,"EPSPRIMMEGetBlockSize_C",(EPS,PetscInt*),(eps,bs));
446:   return(0);
447: }

449: EXTERN_C_BEGIN
452: PetscErrorCode EPSPRIMMESetMethod_PRIMME(EPS eps,EPSPRIMMEMethod method)
453: {
454:   EPS_PRIMME *ops = (EPS_PRIMME*)eps->data;

457:   if (method == PETSC_DEFAULT) ops->method = DEFAULT_MIN_TIME;
458:   else ops->method = (primme_preset_method)method;
459:   return(0);
460: }
461: EXTERN_C_END

465: /*@
466:    EPSPRIMMESetMethod - Sets the method for the PRIMME library.

468:    Collective on EPS

470:    Input Parameters:
471: +  eps - the eigenproblem solver context
472: -  method - method that will be used by PRIMME. It must be one of:
473:     EPS_PRIMME_DYNAMIC, EPS_PRIMME_DEFAULT_MIN_TIME(EPS_PRIMME_JDQMR_ETOL),
474:     EPS_PRIMME_DEFAULT_MIN_MATVECS(EPS_PRIMME_GD_OLSEN_PLUSK), EPS_PRIMME_ARNOLDI,
475:     EPS_PRIMME_GD, EPS_PRIMME_GD_PLUSK, EPS_PRIMME_GD_OLSEN_PLUSK, 
476:     EPS_PRIMME_JD_OLSEN_PLUSK, EPS_PRIMME_RQI, EPS_PRIMME_JDQR, EPS_PRIMME_JDQMR, 
477:     EPS_PRIMME_JDQMR_ETOL, EPS_PRIMME_SUBSPACE_ITERATION,
478:     EPS_PRIMME_LOBPCG_ORTHOBASIS, EPS_PRIMME_LOBPCG_ORTHOBASISW

480:    Options Database Key:
481: .  -eps_primme_set_method - Sets the method for the PRIMME library.

483:    Note:
484:    If not set, the method defaults to EPS_PRIMME_DEFAULT_MIN_TIME.

486:    Level: advanced

488: .seealso: EPSPRIMMEGetMethod(), EPSPRIMMEMethod
489: @*/
490: PetscErrorCode EPSPRIMMESetMethod(EPS eps,EPSPRIMMEMethod method)
491: {

497:   PetscTryMethod(eps,"EPSPRIMMESetMethod_C",(EPS,EPSPRIMMEMethod),(eps,method));
498:   return(0);
499: }

501: EXTERN_C_BEGIN
504: PetscErrorCode EPSPRIMMEGetMethod_PRIMME(EPS eps,EPSPRIMMEMethod *method)
505: {
506:   EPS_PRIMME *ops = (EPS_PRIMME*)eps->data;

509:   if (method) *method = (EPSPRIMMEMethod)ops->method;
510:   return(0);
511: }
512: EXTERN_C_END

516: /*@C
517:     EPSPRIMMEGetMethod - Gets the method for the PRIMME library.

519:     Mon Collective on EPS

521:    Input Parameters:
522: .  eps - the eigenproblem solver context
523:     
524:    Output Parameters: 
525: .  method - method that will be used by PRIMME. It must be one of:
526:     EPS_PRIMME_DYNAMIC, EPS_PRIMME_DEFAULT_MIN_TIME(EPS_PRIMME_JDQMR_ETOL),
527:     EPS_PRIMME_DEFAULT_MIN_MATVECS(EPS_PRIMME_GD_OLSEN_PLUSK), EPS_PRIMME_ARNOLDI,
528:     EPS_PRIMME_GD, EPS_PRIMME_GD_PLUSK, EPS_PRIMME_GD_OLSEN_PLUSK, 
529:     EPS_PRIMME_JD_OLSEN_PLUSK, EPS_PRIMME_RQI, EPS_PRIMME_JDQR, EPS_PRIMME_JDQMR, 
530:     EPS_PRIMME_JDQMR_ETOL, EPS_PRIMME_SUBSPACE_ITERATION,
531:     EPS_PRIMME_LOBPCG_ORTHOBASIS, EPS_PRIMME_LOBPCG_ORTHOBASISW

533:     Level: advanced

535: .seealso: EPSPRIMMESetMethod(), EPSPRIMMEMethod
536: @*/
537: PetscErrorCode EPSPRIMMEGetMethod(EPS eps, EPSPRIMMEMethod *method)
538: {

543:   PetscTryMethod(eps,"EPSPRIMMEGetMethod_C",(EPS,EPSPRIMMEMethod*),(eps,method));
544:   return(0);
545: }

547: EXTERN_C_BEGIN
550: PetscErrorCode EPSCreate_PRIMME(EPS eps)
551: {
553:   EPS_PRIMME     *primme;

556:   STSetType(eps->OP,STPRECOND);
557:   STPrecondSetKSPHasMat(eps->OP,PETSC_TRUE);

559:   PetscNewLog(eps,EPS_PRIMME,&primme);
560:   eps->data                      = (void*)primme;
561:   eps->ops->setup                = EPSSetUp_PRIMME;
562:   eps->ops->setfromoptions       = EPSSetFromOptions_PRIMME;
563:   eps->ops->destroy              = EPSDestroy_PRIMME;
564:   eps->ops->reset                = EPSReset_PRIMME;
565:   eps->ops->view                 = EPSView_PRIMME;
566:   eps->ops->backtransform        = EPSBackTransform_Default;
567:   eps->ops->computevectors       = EPSComputeVectors_Default;

569:   primme_initialize(&primme->primme);
570:   primme->primme.matrixMatvec = multMatvec_PRIMME;
571:   primme->primme.globalSumDouble = par_GlobalSumDouble;
572:   primme->method = (primme_preset_method)EPS_PRIMME_DEFAULT_MIN_TIME;

574:   PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSPRIMMESetBlockSize_C","EPSPRIMMESetBlockSize_PRIMME",EPSPRIMMESetBlockSize_PRIMME);
575:   PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSPRIMMESetMethod_C","EPSPRIMMESetMethod_PRIMME",EPSPRIMMESetMethod_PRIMME);
576:   PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSPRIMMEGetBlockSize_C","EPSPRIMMEGetBlockSize_PRIMME",EPSPRIMMEGetBlockSize_PRIMME);
577:   PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSPRIMMEGetMethod_C","EPSPRIMMEGetMethod_PRIMME",EPSPRIMMEGetMethod_PRIMME);
578:   return(0);
579: }
580: EXTERN_C_END