LCOV - code coverage report
Current view: top level - eps/impls/davidson/gd - gd.c (source / functions) Hit Total Coverage
Test: SLEPc Lines: 190 191 99.5 %
Date: 2024-11-21 00:34:55 Functions: 19 19 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       3             :    SLEPc - Scalable Library for Eigenvalue Problem Computations
       4             :    Copyright (c) 2002-, Universitat Politecnica de Valencia, Spain
       5             : 
       6             :    This file is part of SLEPc.
       7             :    SLEPc is distributed under a 2-clause BSD license (see LICENSE).
       8             :    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       9             : */
      10             : /*
      11             :    SLEPc eigensolver: "gd"
      12             : 
      13             :    Method: Generalized Davidson
      14             : 
      15             :    Algorithm:
      16             : 
      17             :        Generalized Davidson with various subspace extraction and
      18             :        restart techniques.
      19             : 
      20             :    References:
      21             : 
      22             :        [1] E.R. Davidson, "Super-matrix methods", Comput. Phys. Commun.
      23             :            53(2):49-60, 1989.
      24             : 
      25             :        [2] E. Romero and J.E. Roman, "A parallel implementation of
      26             :            Davidson methods for large-scale eigenvalue problems in
      27             :            SLEPc", ACM Trans. Math. Software 40(2), Article 13, 2014.
      28             : */
      29             : 
      30             : #include <slepc/private/epsimpl.h>                /*I "slepceps.h" I*/
      31             : #include <../src/eps/impls/davidson/davidson.h>
      32             : 
      33          39 : static PetscErrorCode EPSSetFromOptions_GD(EPS eps,PetscOptionItems *PetscOptionsObject)
      34             : {
      35          39 :   PetscBool      flg,flg2,op,orth;
      36          39 :   PetscInt       opi,opi0;
      37             : 
      38          39 :   PetscFunctionBegin;
      39          39 :   PetscOptionsHeadBegin(PetscOptionsObject,"EPS Generalized Davidson (GD) Options");
      40             : 
      41          39 :     PetscCall(EPSGDGetKrylovStart(eps,&op));
      42          39 :     PetscCall(PetscOptionsBool("-eps_gd_krylov_start","Start the search subspace with a Krylov basis","EPSGDSetKrylovStart",op,&op,&flg));
      43          39 :     if (flg) PetscCall(EPSGDSetKrylovStart(eps,op));
      44             : 
      45          39 :     PetscCall(EPSGDGetBOrth(eps,&orth));
      46          39 :     PetscCall(PetscOptionsBool("-eps_gd_borth","Use B-orthogonalization in the search subspace","EPSGDSetBOrth",op,&op,&flg));
      47          39 :     if (flg) PetscCall(EPSGDSetBOrth(eps,op));
      48             : 
      49          39 :     PetscCall(EPSGDGetBlockSize(eps,&opi));
      50          39 :     PetscCall(PetscOptionsInt("-eps_gd_blocksize","Number of vectors to add to the search subspace","EPSGDSetBlockSize",opi,&opi,&flg));
      51          39 :     if (flg) PetscCall(EPSGDSetBlockSize(eps,opi));
      52             : 
      53          39 :     PetscCall(EPSGDGetRestart(eps,&opi,&opi0));
      54          39 :     PetscCall(PetscOptionsInt("-eps_gd_minv","Size of the search subspace after restarting","EPSGDSetRestart",opi,&opi,&flg));
      55          39 :     PetscCall(PetscOptionsInt("-eps_gd_plusk","Number of eigenvectors saved from the previous iteration when restarting","EPSGDSetRestart",opi0,&opi0,&flg2));
      56          39 :     if (flg || flg2) PetscCall(EPSGDSetRestart(eps,opi,opi0));
      57             : 
      58          39 :     PetscCall(EPSGDGetInitialSize(eps,&opi));
      59          39 :     PetscCall(PetscOptionsInt("-eps_gd_initial_size","Initial size of the search subspace","EPSGDSetInitialSize",opi,&opi,&flg));
      60          39 :     if (flg) PetscCall(EPSGDSetInitialSize(eps,opi));
      61             : 
      62          39 :     PetscCall(PetscOptionsBool("-eps_gd_double_expansion","Use the doble-expansion variant of GD","EPSGDSetDoubleExpansion",PETSC_FALSE,&op,&flg));
      63          39 :     if (flg) PetscCall(EPSGDSetDoubleExpansion(eps,op));
      64             : 
      65          39 :   PetscOptionsHeadEnd();
      66          39 :   PetscFunctionReturn(PETSC_SUCCESS);
      67             : }
      68             : 
      69          64 : static PetscErrorCode EPSSetUp_GD(EPS eps)
      70             : {
      71          64 :   PetscBool      t;
      72          64 :   KSP            ksp;
      73             : 
      74          64 :   PetscFunctionBegin;
      75             :   /* Setup common for all davidson solvers */
      76          64 :   PetscCall(EPSSetUp_XD(eps));
      77             : 
      78             :   /* Check some constraints */
      79          64 :   PetscCall(STGetKSP(eps->st,&ksp));
      80          64 :   PetscCall(PetscObjectTypeCompare((PetscObject)ksp,KSPPREONLY,&t));
      81          64 :   PetscCheck(t,PetscObjectComm((PetscObject)eps),PETSC_ERR_SUP,"EPSGD only works with KSPPREONLY");
      82          64 :   PetscFunctionReturn(PETSC_SUCCESS);
      83             : }
      84             : 
      85           1 : static PetscErrorCode EPSView_GD(EPS eps,PetscViewer viewer)
      86             : {
      87           1 :   PetscBool      isascii,opb;
      88           1 :   PetscInt       opi,opi0;
      89           1 :   PetscBool      borth;
      90           1 :   EPS_DAVIDSON   *data = (EPS_DAVIDSON*)eps->data;
      91             : 
      92           1 :   PetscFunctionBegin;
      93           1 :   PetscCall(PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii));
      94           1 :   if (isascii) {
      95           1 :     if (data->doubleexp) PetscCall(PetscViewerASCIIPrintf(viewer,"  using double expansion variant (GD2)\n"));
      96           1 :     PetscCall(EPSXDGetBOrth_XD(eps,&borth));
      97           1 :     if (borth) PetscCall(PetscViewerASCIIPrintf(viewer,"  search subspace is B-orthogonalized\n"));
      98           1 :     else PetscCall(PetscViewerASCIIPrintf(viewer,"  search subspace is orthogonalized\n"));
      99           1 :     PetscCall(EPSXDGetBlockSize_XD(eps,&opi));
     100           1 :     PetscCall(PetscViewerASCIIPrintf(viewer,"  block size=%" PetscInt_FMT "\n",opi));
     101           1 :     PetscCall(EPSXDGetKrylovStart_XD(eps,&opb));
     102           1 :     if (!opb) PetscCall(PetscViewerASCIIPrintf(viewer,"  type of the initial subspace: non-Krylov\n"));
     103           0 :     else PetscCall(PetscViewerASCIIPrintf(viewer,"  type of the initial subspace: Krylov\n"));
     104           1 :     PetscCall(EPSXDGetRestart_XD(eps,&opi,&opi0));
     105           1 :     PetscCall(PetscViewerASCIIPrintf(viewer,"  size of the subspace after restarting: %" PetscInt_FMT "\n",opi));
     106           1 :     PetscCall(PetscViewerASCIIPrintf(viewer,"  number of vectors after restarting from the previous iteration: %" PetscInt_FMT "\n",opi0));
     107             :   }
     108           1 :   PetscFunctionReturn(PETSC_SUCCESS);
     109             : }
     110             : 
     111          43 : static PetscErrorCode EPSDestroy_GD(EPS eps)
     112             : {
     113          43 :   PetscFunctionBegin;
     114          43 :   PetscCall(PetscFree(eps->data));
     115          43 :   PetscCall(PetscObjectComposeFunction((PetscObject)eps,"EPSGDSetKrylovStart_C",NULL));
     116          43 :   PetscCall(PetscObjectComposeFunction((PetscObject)eps,"EPSGDGetKrylovStart_C",NULL));
     117          43 :   PetscCall(PetscObjectComposeFunction((PetscObject)eps,"EPSGDSetBOrth_C",NULL));
     118          43 :   PetscCall(PetscObjectComposeFunction((PetscObject)eps,"EPSGDGetBOrth_C",NULL));
     119          43 :   PetscCall(PetscObjectComposeFunction((PetscObject)eps,"EPSGDSetBlockSize_C",NULL));
     120          43 :   PetscCall(PetscObjectComposeFunction((PetscObject)eps,"EPSGDGetBlockSize_C",NULL));
     121          43 :   PetscCall(PetscObjectComposeFunction((PetscObject)eps,"EPSGDSetRestart_C",NULL));
     122          43 :   PetscCall(PetscObjectComposeFunction((PetscObject)eps,"EPSGDGetRestart_C",NULL));
     123          43 :   PetscCall(PetscObjectComposeFunction((PetscObject)eps,"EPSGDSetInitialSize_C",NULL));
     124          43 :   PetscCall(PetscObjectComposeFunction((PetscObject)eps,"EPSGDGetInitialSize_C",NULL));
     125          43 :   PetscCall(PetscObjectComposeFunction((PetscObject)eps,"EPSGDSetDoubleExpansion_C",NULL));
     126          43 :   PetscCall(PetscObjectComposeFunction((PetscObject)eps,"EPSGDGetDoubleExpansion_C",NULL));
     127          43 :   PetscFunctionReturn(PETSC_SUCCESS);
     128             : }
     129             : 
     130             : /*@
     131             :    EPSGDSetKrylovStart - Activates or deactivates starting the searching
     132             :    subspace with a Krylov basis.
     133             : 
     134             :    Logically Collective
     135             : 
     136             :    Input Parameters:
     137             : +  eps - the eigenproblem solver context
     138             : -  krylovstart - boolean flag
     139             : 
     140             :    Options Database Key:
     141             : .  -eps_gd_krylov_start - Activates starting the searching subspace with a
     142             :     Krylov basis
     143             : 
     144             :    Level: advanced
     145             : 
     146             : .seealso: EPSGDGetKrylovStart()
     147             : @*/
     148           3 : PetscErrorCode EPSGDSetKrylovStart(EPS eps,PetscBool krylovstart)
     149             : {
     150           3 :   PetscFunctionBegin;
     151           3 :   PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
     152           9 :   PetscValidLogicalCollectiveBool(eps,krylovstart,2);
     153           3 :   PetscTryMethod(eps,"EPSGDSetKrylovStart_C",(EPS,PetscBool),(eps,krylovstart));
     154           3 :   PetscFunctionReturn(PETSC_SUCCESS);
     155             : }
     156             : 
     157             : /*@
     158             :    EPSGDGetKrylovStart - Returns a flag indicating if the search subspace is started with a
     159             :    Krylov basis.
     160             : 
     161             :    Not Collective
     162             : 
     163             :    Input Parameter:
     164             : .  eps - the eigenproblem solver context
     165             : 
     166             :    Output Parameters:
     167             : .  krylovstart - boolean flag indicating if the search subspace is started
     168             :    with a Krylov basis
     169             : 
     170             :    Level: advanced
     171             : 
     172             : .seealso: EPSGDSetKrylovStart()
     173             : @*/
     174          39 : PetscErrorCode EPSGDGetKrylovStart(EPS eps,PetscBool *krylovstart)
     175             : {
     176          39 :   PetscFunctionBegin;
     177          39 :   PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
     178          39 :   PetscAssertPointer(krylovstart,2);
     179          39 :   PetscUseMethod(eps,"EPSGDGetKrylovStart_C",(EPS,PetscBool*),(eps,krylovstart));
     180          39 :   PetscFunctionReturn(PETSC_SUCCESS);
     181             : }
     182             : 
     183             : /*@
     184             :    EPSGDSetBlockSize - Sets the number of vectors to be added to the searching space
     185             :    in every iteration.
     186             : 
     187             :    Logically Collective
     188             : 
     189             :    Input Parameters:
     190             : +  eps - the eigenproblem solver context
     191             : -  blocksize - number of vectors added to the search space in every iteration
     192             : 
     193             :    Options Database Key:
     194             : .  -eps_gd_blocksize - number of vectors added to the search space in every iteration
     195             : 
     196             :    Level: advanced
     197             : 
     198             : .seealso: EPSGDSetKrylovStart()
     199             : @*/
     200           2 : PetscErrorCode EPSGDSetBlockSize(EPS eps,PetscInt blocksize)
     201             : {
     202           2 :   PetscFunctionBegin;
     203           2 :   PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
     204           6 :   PetscValidLogicalCollectiveInt(eps,blocksize,2);
     205           2 :   PetscTryMethod(eps,"EPSGDSetBlockSize_C",(EPS,PetscInt),(eps,blocksize));
     206           2 :   PetscFunctionReturn(PETSC_SUCCESS);
     207             : }
     208             : 
     209             : /*@
     210             :    EPSGDGetBlockSize - Returns the number of vectors to be added to the searching space
     211             :    in every iteration.
     212             : 
     213             :    Not Collective
     214             : 
     215             :    Input Parameter:
     216             : .  eps - the eigenproblem solver context
     217             : 
     218             :    Output Parameter:
     219             : .  blocksize - number of vectors added to the search space in every iteration
     220             : 
     221             :    Level: advanced
     222             : 
     223             : .seealso: EPSGDSetBlockSize()
     224             : @*/
     225          39 : PetscErrorCode EPSGDGetBlockSize(EPS eps,PetscInt *blocksize)
     226             : {
     227          39 :   PetscFunctionBegin;
     228          39 :   PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
     229          39 :   PetscAssertPointer(blocksize,2);
     230          39 :   PetscUseMethod(eps,"EPSGDGetBlockSize_C",(EPS,PetscInt*),(eps,blocksize));
     231          39 :   PetscFunctionReturn(PETSC_SUCCESS);
     232             : }
     233             : 
     234             : /*@
     235             :    EPSGDSetRestart - Sets the number of vectors of the searching space after
     236             :    restarting and the number of vectors saved from the previous iteration.
     237             : 
     238             :    Logically Collective
     239             : 
     240             :    Input Parameters:
     241             : +  eps - the eigenproblem solver context
     242             : .  minv - number of vectors of the searching subspace after restarting
     243             : -  plusk - number of vectors saved from the previous iteration
     244             : 
     245             :    Options Database Keys:
     246             : +  -eps_gd_minv - number of vectors of the searching subspace after restarting
     247             : -  -eps_gd_plusk - number of vectors saved from the previous iteration
     248             : 
     249             :    Note:
     250             :    PETSC_CURRENT can be used to preserve the current value of any of the
     251             :    arguments, and PETSC_DETERMINE to set them to a default value.
     252             : 
     253             :    Level: advanced
     254             : 
     255             : .seealso: EPSGDGetRestart()
     256             : @*/
     257           1 : PetscErrorCode EPSGDSetRestart(EPS eps,PetscInt minv,PetscInt plusk)
     258             : {
     259           1 :   PetscFunctionBegin;
     260           1 :   PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
     261           3 :   PetscValidLogicalCollectiveInt(eps,minv,2);
     262           3 :   PetscValidLogicalCollectiveInt(eps,plusk,3);
     263           1 :   PetscTryMethod(eps,"EPSGDSetRestart_C",(EPS,PetscInt,PetscInt),(eps,minv,plusk));
     264           1 :   PetscFunctionReturn(PETSC_SUCCESS);
     265             : }
     266             : 
     267             : /*@
     268             :    EPSGDGetRestart - Gets the number of vectors of the searching space after
     269             :    restarting and the number of vectors saved from the previous iteration.
     270             : 
     271             :    Not Collective
     272             : 
     273             :    Input Parameter:
     274             : .  eps - the eigenproblem solver context
     275             : 
     276             :    Output Parameters:
     277             : +  minv - number of vectors of the searching subspace after restarting
     278             : -  plusk - number of vectors saved from the previous iteration
     279             : 
     280             :    Level: advanced
     281             : 
     282             : .seealso: EPSGDSetRestart()
     283             : @*/
     284          39 : PetscErrorCode EPSGDGetRestart(EPS eps,PetscInt *minv,PetscInt *plusk)
     285             : {
     286          39 :   PetscFunctionBegin;
     287          39 :   PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
     288          39 :   PetscUseMethod(eps,"EPSGDGetRestart_C",(EPS,PetscInt*,PetscInt*),(eps,minv,plusk));
     289          39 :   PetscFunctionReturn(PETSC_SUCCESS);
     290             : }
     291             : 
     292             : /*@
     293             :    EPSGDSetInitialSize - Sets the initial size of the searching space.
     294             : 
     295             :    Logically Collective
     296             : 
     297             :    Input Parameters:
     298             : +  eps - the eigenproblem solver context
     299             : -  initialsize - number of vectors of the initial searching subspace
     300             : 
     301             :    Options Database Key:
     302             : .  -eps_gd_initial_size - number of vectors of the initial searching subspace
     303             : 
     304             :    Notes:
     305             :    If EPSGDGetKrylovStart() is PETSC_FALSE and the user provides vectors with
     306             :    EPSSetInitialSpace(), up to initialsize vectors will be used; and if the
     307             :    provided vectors are not enough, the solver completes the subspace with
     308             :    random vectors. In the case of EPSGDGetKrylovStart() being PETSC_TRUE, the solver
     309             :    gets the first vector provided by the user or, if not available, a random vector,
     310             :    and expands the Krylov basis up to initialsize vectors.
     311             : 
     312             :    Level: advanced
     313             : 
     314             : .seealso: EPSGDGetInitialSize(), EPSGDGetKrylovStart()
     315             : @*/
     316           1 : PetscErrorCode EPSGDSetInitialSize(EPS eps,PetscInt initialsize)
     317             : {
     318           1 :   PetscFunctionBegin;
     319           1 :   PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
     320           3 :   PetscValidLogicalCollectiveInt(eps,initialsize,2);
     321           1 :   PetscTryMethod(eps,"EPSGDSetInitialSize_C",(EPS,PetscInt),(eps,initialsize));
     322           1 :   PetscFunctionReturn(PETSC_SUCCESS);
     323             : }
     324             : 
     325             : /*@
     326             :    EPSGDGetInitialSize - Returns the initial size of the searching space.
     327             : 
     328             :    Not Collective
     329             : 
     330             :    Input Parameter:
     331             : .  eps - the eigenproblem solver context
     332             : 
     333             :    Output Parameter:
     334             : .  initialsize - number of vectors of the initial searching subspace
     335             : 
     336             :    Notes:
     337             :    If EPSGDGetKrylovStart() is PETSC_FALSE and the user provides vectors with
     338             :    EPSSetInitialSpace(), up to initialsize vectors will be used; and if the
     339             :    provided vectors are not enough, the solver completes the subspace with
     340             :    random vectors. In the case of EPSGDGetKrylovStart() being PETSC_TRUE, the solver
     341             :    gets the first vector provided by the user or, if not available, a random vector,
     342             :    and expands the Krylov basis up to initialsize vectors.
     343             : 
     344             :    Level: advanced
     345             : 
     346             : .seealso: EPSGDSetInitialSize(), EPSGDGetKrylovStart()
     347             : @*/
     348          39 : PetscErrorCode EPSGDGetInitialSize(EPS eps,PetscInt *initialsize)
     349             : {
     350          39 :   PetscFunctionBegin;
     351          39 :   PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
     352          39 :   PetscAssertPointer(initialsize,2);
     353          39 :   PetscUseMethod(eps,"EPSGDGetInitialSize_C",(EPS,PetscInt*),(eps,initialsize));
     354          39 :   PetscFunctionReturn(PETSC_SUCCESS);
     355             : }
     356             : 
     357             : /*@
     358             :    EPSGDSetBOrth - Selects the orthogonalization that will be used in the search
     359             :    subspace in case of generalized Hermitian problems.
     360             : 
     361             :    Logically Collective
     362             : 
     363             :    Input Parameters:
     364             : +  eps   - the eigenproblem solver context
     365             : -  borth - whether to B-orthogonalize the search subspace
     366             : 
     367             :    Options Database Key:
     368             : .  -eps_gd_borth - Set the orthogonalization used in the search subspace
     369             : 
     370             :    Level: advanced
     371             : 
     372             : .seealso: EPSGDGetBOrth()
     373             : @*/
     374           1 : PetscErrorCode EPSGDSetBOrth(EPS eps,PetscBool borth)
     375             : {
     376           1 :   PetscFunctionBegin;
     377           1 :   PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
     378           3 :   PetscValidLogicalCollectiveBool(eps,borth,2);
     379           1 :   PetscTryMethod(eps,"EPSGDSetBOrth_C",(EPS,PetscBool),(eps,borth));
     380           1 :   PetscFunctionReturn(PETSC_SUCCESS);
     381             : }
     382             : 
     383             : /*@
     384             :    EPSGDGetBOrth - Returns the orthogonalization used in the search
     385             :    subspace in case of generalized Hermitian problems.
     386             : 
     387             :    Not Collective
     388             : 
     389             :    Input Parameter:
     390             : .  eps - the eigenproblem solver context
     391             : 
     392             :    Output Parameters:
     393             : .  borth - whether to B-orthogonalize the search subspace
     394             : 
     395             :    Level: advanced
     396             : 
     397             : .seealso: EPSGDSetBOrth()
     398             : @*/
     399          39 : PetscErrorCode EPSGDGetBOrth(EPS eps,PetscBool *borth)
     400             : {
     401          39 :   PetscFunctionBegin;
     402          39 :   PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
     403          39 :   PetscAssertPointer(borth,2);
     404          39 :   PetscUseMethod(eps,"EPSGDGetBOrth_C",(EPS,PetscBool*),(eps,borth));
     405          39 :   PetscFunctionReturn(PETSC_SUCCESS);
     406             : }
     407             : 
     408          12 : static PetscErrorCode EPSGDSetDoubleExpansion_GD(EPS eps,PetscBool doubleexp)
     409             : {
     410          12 :   EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data;
     411             : 
     412          12 :   PetscFunctionBegin;
     413          12 :   data->doubleexp = doubleexp;
     414          12 :   PetscFunctionReturn(PETSC_SUCCESS);
     415             : }
     416             : 
     417             : /*@
     418             :    EPSGDSetDoubleExpansion - Activate the double expansion variant of GD.
     419             : 
     420             :    Logically Collective
     421             : 
     422             :    Input Parameters:
     423             : +  eps - the eigenproblem solver context
     424             : -  doubleexp - the boolean flag
     425             : 
     426             :    Options Database Keys:
     427             : .  -eps_gd_double_expansion - activate the double-expansion variant of GD
     428             : 
     429             :    Notes:
     430             :    In the double expansion variant the search subspace is expanded with K*[A*x B*x]
     431             :    instead of the classic K*r, where K is the preconditioner, x the selected
     432             :    approximate eigenvector and r its associated residual vector.
     433             : 
     434             :    Level: advanced
     435             : 
     436             : .seealso: EPSGDGetDoubleExpansion()
     437             : @*/
     438          12 : PetscErrorCode EPSGDSetDoubleExpansion(EPS eps,PetscBool doubleexp)
     439             : {
     440          12 :   PetscFunctionBegin;
     441          12 :   PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
     442          36 :   PetscValidLogicalCollectiveBool(eps,doubleexp,2);
     443          12 :   PetscTryMethod(eps,"EPSGDSetDoubleExpansion_C",(EPS,PetscBool),(eps,doubleexp));
     444          12 :   PetscFunctionReturn(PETSC_SUCCESS);
     445             : }
     446             : 
     447           1 : static PetscErrorCode EPSGDGetDoubleExpansion_GD(EPS eps,PetscBool *doubleexp)
     448             : {
     449           1 :   EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data;
     450             : 
     451           1 :   PetscFunctionBegin;
     452           1 :   *doubleexp = data->doubleexp;
     453           1 :   PetscFunctionReturn(PETSC_SUCCESS);
     454             : }
     455             : 
     456             : /*@
     457             :    EPSGDGetDoubleExpansion - Gets a flag indicating whether the double
     458             :    expansion variant has been activated or not.
     459             : 
     460             :    Not Collective
     461             : 
     462             :    Input Parameter:
     463             : .  eps - the eigenproblem solver context
     464             : 
     465             :    Output Parameter:
     466             : .  doubleexp - the flag
     467             : 
     468             :    Level: advanced
     469             : 
     470             : .seealso: EPSGDSetDoubleExpansion()
     471             : @*/
     472           1 : PetscErrorCode EPSGDGetDoubleExpansion(EPS eps,PetscBool *doubleexp)
     473             : {
     474           1 :   PetscFunctionBegin;
     475           1 :   PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
     476           1 :   PetscAssertPointer(doubleexp,2);
     477           1 :   PetscUseMethod(eps,"EPSGDGetDoubleExpansion_C",(EPS,PetscBool*),(eps,doubleexp));
     478           1 :   PetscFunctionReturn(PETSC_SUCCESS);
     479             : }
     480             : 
     481          43 : SLEPC_EXTERN PetscErrorCode EPSCreate_GD(EPS eps)
     482             : {
     483          43 :   EPS_DAVIDSON    *data;
     484             : 
     485          43 :   PetscFunctionBegin;
     486          43 :   PetscCall(PetscNew(&data));
     487          43 :   eps->data = (void*)data;
     488             : 
     489          43 :   data->blocksize   = 1;
     490          43 :   data->initialsize = 0;
     491          43 :   data->minv        = 0;
     492          43 :   data->plusk       = PETSC_DETERMINE;
     493          43 :   data->ipB         = PETSC_TRUE;
     494          43 :   data->fix         = 0.0;
     495          43 :   data->krylovstart = PETSC_FALSE;
     496          43 :   data->dynamic     = PETSC_FALSE;
     497             : 
     498          43 :   eps->useds = PETSC_TRUE;
     499          43 :   eps->categ = EPS_CATEGORY_PRECOND;
     500             : 
     501          43 :   eps->ops->solve          = EPSSolve_XD;
     502          43 :   eps->ops->setup          = EPSSetUp_GD;
     503          43 :   eps->ops->setupsort      = EPSSetUpSort_Default;
     504          43 :   eps->ops->setfromoptions = EPSSetFromOptions_GD;
     505          43 :   eps->ops->destroy        = EPSDestroy_GD;
     506          43 :   eps->ops->reset          = EPSReset_XD;
     507          43 :   eps->ops->view           = EPSView_GD;
     508          43 :   eps->ops->backtransform  = EPSBackTransform_Default;
     509          43 :   eps->ops->computevectors = EPSComputeVectors_XD;
     510          43 :   eps->ops->setdefaultst   = EPSSetDefaultST_Precond;
     511             : 
     512          43 :   PetscCall(PetscObjectComposeFunction((PetscObject)eps,"EPSGDSetKrylovStart_C",EPSXDSetKrylovStart_XD));
     513          43 :   PetscCall(PetscObjectComposeFunction((PetscObject)eps,"EPSGDGetKrylovStart_C",EPSXDGetKrylovStart_XD));
     514          43 :   PetscCall(PetscObjectComposeFunction((PetscObject)eps,"EPSGDSetBOrth_C",EPSXDSetBOrth_XD));
     515          43 :   PetscCall(PetscObjectComposeFunction((PetscObject)eps,"EPSGDGetBOrth_C",EPSXDGetBOrth_XD));
     516          43 :   PetscCall(PetscObjectComposeFunction((PetscObject)eps,"EPSGDSetBlockSize_C",EPSXDSetBlockSize_XD));
     517          43 :   PetscCall(PetscObjectComposeFunction((PetscObject)eps,"EPSGDGetBlockSize_C",EPSXDGetBlockSize_XD));
     518          43 :   PetscCall(PetscObjectComposeFunction((PetscObject)eps,"EPSGDSetRestart_C",EPSXDSetRestart_XD));
     519          43 :   PetscCall(PetscObjectComposeFunction((PetscObject)eps,"EPSGDGetRestart_C",EPSXDGetRestart_XD));
     520          43 :   PetscCall(PetscObjectComposeFunction((PetscObject)eps,"EPSGDSetInitialSize_C",EPSXDSetInitialSize_XD));
     521          43 :   PetscCall(PetscObjectComposeFunction((PetscObject)eps,"EPSGDGetInitialSize_C",EPSXDGetInitialSize_XD));
     522          43 :   PetscCall(PetscObjectComposeFunction((PetscObject)eps,"EPSGDSetDoubleExpansion_C",EPSGDSetDoubleExpansion_GD));
     523          43 :   PetscCall(PetscObjectComposeFunction((PetscObject)eps,"EPSGDGetDoubleExpansion_C",EPSGDGetDoubleExpansion_GD));
     524          43 :   PetscFunctionReturn(PETSC_SUCCESS);
     525             : }

Generated by: LCOV version 1.14