Subversion Repositories slepc-dev

Rev

Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2555 Rev 2575
/*
/*
  SLEPc eigensolver: "gd"
  SLEPc eigensolver: "gd"
 
 
   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
   SLEPc - Scalable Library for Eigenvalue Problem Computations
   SLEPc - Scalable Library for Eigenvalue Problem Computations
   Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
   Copyright (c) 2002-2011, Universitat Politecnica de Valencia, Spain
 
 
   This file is part of SLEPc.
   This file is part of SLEPc.
     
     
   SLEPc is free software: you can redistribute it and/or modify it under  the
   SLEPc is free software: you can redistribute it and/or modify it under  the
   terms of version 3 of the GNU Lesser General Public License as published by
   terms of version 3 of the GNU Lesser General Public License as published by
   the Free Software Foundation.
   the Free Software Foundation.
 
 
   SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
   SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
   WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
   WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
   FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
   FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
   more details.
   more details.
 
 
   You  should have received a copy of the GNU Lesser General  Public  License
   You  should have received a copy of the GNU Lesser General  Public  License
   along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
   along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
*/
 
 
#include "private/epsimpl.h"                /*I "slepceps.h" I*/
#include "private/epsimpl.h"                /*I "slepceps.h" I*/
#include <../src/eps/impls/davidson/common/davidson.h>
#include <../src/eps/impls/davidson/common/davidson.h>
 
 
PetscErrorCode EPSSetUp_GD(EPS eps);
PetscErrorCode EPSSetUp_GD(EPS eps);
PetscErrorCode EPSDestroy_GD(EPS eps);
PetscErrorCode EPSDestroy_GD(EPS eps);
 
 
EXTERN_C_BEGIN
EXTERN_C_BEGIN
#undef __FUNCT__  
#undef __FUNCT__  
#define __FUNCT__ "EPSSetFromOptions_GD"
#define __FUNCT__ "EPSSetFromOptions_GD"
PetscErrorCode EPSSetFromOptions_GD(EPS eps)
PetscErrorCode EPSSetFromOptions_GD(EPS eps)
{
{
  PetscErrorCode ierr;
  PetscErrorCode ierr;
  PetscBool      flg,op;
  PetscBool      flg,op;
  PetscInt       opi,opi0;
  PetscInt       opi,opi0;
 
 
  PetscFunctionBegin;
  PetscFunctionBegin;
  ierr = PetscOptionsHead("EPS Generalized Davidson (GD) Options");CHKERRQ(ierr);
  ierr = PetscOptionsHead("EPS Generalized Davidson (GD) Options");CHKERRQ(ierr);
 
 
  ierr = EPSGDGetKrylovStart(eps,&op);CHKERRQ(ierr);
  ierr = EPSGDGetKrylovStart(eps,&op);CHKERRQ(ierr);
  ierr = PetscOptionsBool("-eps_gd_krylov_start","Start the searching subspace with a krylov basis","EPSGDSetKrylovStart",op,&op,&flg);CHKERRQ(ierr);
  ierr = PetscOptionsBool("-eps_gd_krylov_start","Start the searching subspace with a krylov basis","EPSGDSetKrylovStart",op,&op,&flg);CHKERRQ(ierr);
  if(flg) { ierr = EPSGDSetKrylovStart(eps,op);CHKERRQ(ierr); }
  if(flg) { ierr = EPSGDSetKrylovStart(eps,op);CHKERRQ(ierr); }
 
 
  ierr = EPSGDGetBOrth(eps,&op);CHKERRQ(ierr);
  ierr = EPSGDGetBOrth(eps,&op);CHKERRQ(ierr);
  ierr = PetscOptionsBool("-eps_gd_borth","B-orthogonalize the searching subspace basis","EPSGDSetBOrth",op,&op,&flg);CHKERRQ(ierr);
  ierr = PetscOptionsBool("-eps_gd_borth","B-orthogonalize the searching subspace basis","EPSGDSetBOrth",op,&op,&flg);CHKERRQ(ierr);
  if(flg) { ierr = EPSGDSetBOrth(eps,op);CHKERRQ(ierr); }
  if(flg) { ierr = EPSGDSetBOrth(eps,op);CHKERRQ(ierr); }
 
 
  ierr = EPSGDGetBlockSize(eps,&opi);CHKERRQ(ierr);
  ierr = EPSGDGetBlockSize(eps,&opi);CHKERRQ(ierr);
  ierr = PetscOptionsInt("-eps_gd_blocksize","Number vectors add to the searching subspace","EPSGDSetBlockSize",opi,&opi,&flg);CHKERRQ(ierr);
  ierr = PetscOptionsInt("-eps_gd_blocksize","Number vectors add to the searching subspace","EPSGDSetBlockSize",opi,&opi,&flg);CHKERRQ(ierr);
  if(flg) { ierr = EPSGDSetBlockSize(eps,opi);CHKERRQ(ierr); }
  if(flg) { ierr = EPSGDSetBlockSize(eps,opi);CHKERRQ(ierr); }
 
 
  ierr = EPSGDGetRestart(eps,&opi,&opi0);CHKERRQ(ierr);
  ierr = EPSGDGetRestart(eps,&opi,&opi0);CHKERRQ(ierr);
  ierr = PetscOptionsInt("-eps_gd_minv","Set the size of the searching subspace after restarting","EPSGDSetRestart",opi,&opi,&flg);CHKERRQ(ierr);
  ierr = PetscOptionsInt("-eps_gd_minv","Set the size of the searching subspace after restarting","EPSGDSetRestart",opi,&opi,&flg);CHKERRQ(ierr);
  if(flg) { ierr = EPSGDSetRestart(eps,opi,opi0);CHKERRQ(ierr); }
  if(flg) { ierr = EPSGDSetRestart(eps,opi,opi0);CHKERRQ(ierr); }
 
 
  ierr = PetscOptionsInt("-eps_gd_plusk","Set the number of saved eigenvectors from the previous iteration when restarting","EPSGDSetRestart",opi0,&opi0,&flg);CHKERRQ(ierr);
  ierr = PetscOptionsInt("-eps_gd_plusk","Set the number of saved eigenvectors from the previous iteration when restarting","EPSGDSetRestart",opi0,&opi0,&flg);CHKERRQ(ierr);
  if(flg) { ierr = EPSGDSetRestart(eps,opi,opi0);CHKERRQ(ierr); }
  if(flg) { ierr = EPSGDSetRestart(eps,opi,opi0);CHKERRQ(ierr); }
 
 
  ierr = EPSGDGetInitialSize(eps,&opi);CHKERRQ(ierr);
  ierr = EPSGDGetInitialSize(eps,&opi);CHKERRQ(ierr);
  ierr = PetscOptionsInt("-eps_gd_initial_size","Set the initial size of the searching subspace","EPSGDSetInitialSize",opi,&opi,&flg);CHKERRQ(ierr);
  ierr = PetscOptionsInt("-eps_gd_initial_size","Set the initial size of the searching subspace","EPSGDSetInitialSize",opi,&opi,&flg);CHKERRQ(ierr);
  if(flg) { ierr = EPSGDSetInitialSize(eps,opi);CHKERRQ(ierr); }
  if(flg) { ierr = EPSGDSetInitialSize(eps,opi);CHKERRQ(ierr); }
 
 
  ierr = PetscOptionsTail();CHKERRQ(ierr);
  ierr = PetscOptionsTail();CHKERRQ(ierr);
  PetscFunctionReturn(0);
  PetscFunctionReturn(0);
}  
}  
EXTERN_C_END
EXTERN_C_END
 
 
#undef __FUNCT__  
#undef __FUNCT__  
#define __FUNCT__ "EPSSetUp_GD"
#define __FUNCT__ "EPSSetUp_GD"
PetscErrorCode EPSSetUp_GD(EPS eps)
PetscErrorCode EPSSetUp_GD(EPS eps)
{
{
  PetscErrorCode ierr;
  PetscErrorCode ierr;
  PetscBool      t;
  PetscBool      t;
  KSP            ksp;
  KSP            ksp;
 
 
  PetscFunctionBegin;
  PetscFunctionBegin;
  /* Setup common for all davidson solvers */
  /* Setup common for all davidson solvers */
  ierr = EPSSetUp_Davidson(eps);CHKERRQ(ierr);
  ierr = EPSSetUp_Davidson(eps);CHKERRQ(ierr);
 
 
  /* Check some constraints */
  /* Check some constraints */
  ierr = STSetUp(eps->OP);CHKERRQ(ierr);
  ierr = STSetUp(eps->OP);CHKERRQ(ierr);
  ierr = STGetKSP(eps->OP,&ksp);CHKERRQ(ierr);
  ierr = STGetKSP(eps->OP,&ksp);CHKERRQ(ierr);
  ierr = PetscTypeCompare((PetscObject)ksp,KSPPREONLY,&t);CHKERRQ(ierr);
  ierr = PetscTypeCompare((PetscObject)ksp,KSPPREONLY,&t);CHKERRQ(ierr);
  if (!t) SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_SUP,"EPSGD only works with KSPPREONLY");
  if (!t) SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_SUP,"EPSGD only works with KSPPREONLY");
  PetscFunctionReturn(0);
  PetscFunctionReturn(0);
}
}
 
 
EXTERN_C_BEGIN
EXTERN_C_BEGIN
#undef __FUNCT__  
#undef __FUNCT__  
#define __FUNCT__ "EPSCreate_GD"
#define __FUNCT__ "EPSCreate_GD"
PetscErrorCode EPSCreate_GD(EPS eps)
PetscErrorCode EPSCreate_GD(EPS eps)
{
{
  PetscErrorCode  ierr;
  PetscErrorCode  ierr;
 
 
  PetscFunctionBegin;
  PetscFunctionBegin;
  /* Load the Davidson solver */
  /* Load the Davidson solver */
  ierr = EPSCreate_Davidson(eps);CHKERRQ(ierr);
  ierr = EPSCreate_Davidson(eps);CHKERRQ(ierr);
 
 
  /* Overload the GD properties */
  /* Overload the GD properties */
  eps->ops->setfromoptions       = EPSSetFromOptions_GD;
  eps->ops->setfromoptions       = EPSSetFromOptions_GD;
  eps->ops->setup                = EPSSetUp_GD;
  eps->ops->setup                = EPSSetUp_GD;
  eps->ops->destroy              = EPSDestroy_GD;
  eps->ops->destroy              = EPSDestroy_GD;
 
 
  ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDSetKrylovStart_C","EPSDavidsonSetKrylovStart_Davidson",EPSDavidsonSetKrylovStart_Davidson);CHKERRQ(ierr);
  ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDSetKrylovStart_C","EPSDavidsonSetKrylovStart_Davidson",EPSDavidsonSetKrylovStart_Davidson);CHKERRQ(ierr);
  ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDGetKrylovStart_C","EPSDavidsonGetKrylovStart_Davidson",EPSDavidsonGetKrylovStart_Davidson);CHKERRQ(ierr);
  ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDGetKrylovStart_C","EPSDavidsonGetKrylovStart_Davidson",EPSDavidsonGetKrylovStart_Davidson);CHKERRQ(ierr);
  ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDSetBOrth_C","EPSDavidsonSetBOrth_Davidson",EPSDavidsonSetBOrth_Davidson);CHKERRQ(ierr);
  ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDSetBOrth_C","EPSDavidsonSetBOrth_Davidson",EPSDavidsonSetBOrth_Davidson);CHKERRQ(ierr);
  ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDGetBOrth_C","EPSDavidsonGetBOrth_Davidson",EPSDavidsonGetBOrth_Davidson);CHKERRQ(ierr);
  ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDGetBOrth_C","EPSDavidsonGetBOrth_Davidson",EPSDavidsonGetBOrth_Davidson);CHKERRQ(ierr);
  ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDSetBlockSize_C","EPSDavidsonSetBlockSize_Davidson",EPSDavidsonSetBlockSize_Davidson);CHKERRQ(ierr);
  ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDSetBlockSize_C","EPSDavidsonSetBlockSize_Davidson",EPSDavidsonSetBlockSize_Davidson);CHKERRQ(ierr);
  ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDGetBlockSize_C","EPSDavidsonGetBlockSize_Davidson",EPSDavidsonGetBlockSize_Davidson);CHKERRQ(ierr);
  ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDGetBlockSize_C","EPSDavidsonGetBlockSize_Davidson",EPSDavidsonGetBlockSize_Davidson);CHKERRQ(ierr);
  ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDSetRestart_C","EPSDavidsonSetRestart_Davidson",EPSDavidsonSetRestart_Davidson);CHKERRQ(ierr);
  ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDSetRestart_C","EPSDavidsonSetRestart_Davidson",EPSDavidsonSetRestart_Davidson);CHKERRQ(ierr);
  ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDGetRestart_C","EPSDavidsonGetRestart_Davidson",EPSDavidsonGetRestart_Davidson);CHKERRQ(ierr);
  ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDGetRestart_C","EPSDavidsonGetRestart_Davidson",EPSDavidsonGetRestart_Davidson);CHKERRQ(ierr);
  ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDSetInitialSize_C","EPSDavidsonSetInitialSize_Davidson",EPSDavidsonSetInitialSize_Davidson);CHKERRQ(ierr);
  ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDSetInitialSize_C","EPSDavidsonSetInitialSize_Davidson",EPSDavidsonSetInitialSize_Davidson);CHKERRQ(ierr);
  ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDGetInitialSize_C","EPSDavidsonGetInitialSize_Davidson",EPSDavidsonGetInitialSize_Davidson);CHKERRQ(ierr);
  ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDGetInitialSize_C","EPSDavidsonGetInitialSize_Davidson",EPSDavidsonGetInitialSize_Davidson);CHKERRQ(ierr);
  PetscFunctionReturn(0);
  PetscFunctionReturn(0);
}
}
EXTERN_C_END
EXTERN_C_END
 
 
#undef __FUNCT__  
#undef __FUNCT__  
#define __FUNCT__ "EPSDestroy_GD"
#define __FUNCT__ "EPSDestroy_GD"
PetscErrorCode EPSDestroy_GD(EPS eps)
PetscErrorCode EPSDestroy_GD(EPS eps)
{
{
  PetscErrorCode  ierr;
  PetscErrorCode  ierr;
 
 
  PetscFunctionBegin;
  PetscFunctionBegin;
  ierr = PetscFree(eps->data);CHKERRQ(ierr);
  ierr = PetscFree(eps->data);CHKERRQ(ierr);
  ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDSetKrylovStart_C","",PETSC_NULL);CHKERRQ(ierr);
  ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDSetKrylovStart_C","",PETSC_NULL);CHKERRQ(ierr);
  ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDGetKrylovStart_C","",PETSC_NULL);CHKERRQ(ierr);
  ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDGetKrylovStart_C","",PETSC_NULL);CHKERRQ(ierr);
  ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDSetBOrth_C","",PETSC_NULL);CHKERRQ(ierr);
  ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDSetBOrth_C","",PETSC_NULL);CHKERRQ(ierr);
  ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDGetBOrth_C","",PETSC_NULL);CHKERRQ(ierr);
  ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDGetBOrth_C","",PETSC_NULL);CHKERRQ(ierr);
  ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDSetBlockSize_C","",PETSC_NULL);CHKERRQ(ierr);
  ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDSetBlockSize_C","",PETSC_NULL);CHKERRQ(ierr);
  ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDGetBlockSize_C","",PETSC_NULL);CHKERRQ(ierr);
  ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDGetBlockSize_C","",PETSC_NULL);CHKERRQ(ierr);
  ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDSetRestart_C","",PETSC_NULL);CHKERRQ(ierr);
  ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDSetRestart_C","",PETSC_NULL);CHKERRQ(ierr);
  ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDGetRestart_C","",PETSC_NULL);CHKERRQ(ierr);
  ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDGetRestart_C","",PETSC_NULL);CHKERRQ(ierr);
  ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDSetInitialSize_C","",PETSC_NULL);CHKERRQ(ierr);
  ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDSetInitialSize_C","",PETSC_NULL);CHKERRQ(ierr);
  ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDGetInitialSize_C","",PETSC_NULL);CHKERRQ(ierr);
  ierr = PetscObjectComposeFunctionDynamic((PetscObject)eps,"EPSGDGetInitialSize_C","",PETSC_NULL);CHKERRQ(ierr);
  PetscFunctionReturn(0);
  PetscFunctionReturn(0);
}
}
 
 
#undef __FUNCT__  
#undef __FUNCT__  
#define __FUNCT__ "EPSGDSetKrylovStart"
#define __FUNCT__ "EPSGDSetKrylovStart"
/*@
/*@
   EPSGDSetKrylovStart - Activates or deactivates starting the searching
   EPSGDSetKrylovStart - Activates or deactivates starting the searching
   subspace with a Krylov basis.
   subspace with a Krylov basis.
 
 
   Logically Collective on EPS
   Logically Collective on EPS
 
 
   Input Parameters:
   Input Parameters:
+  eps - the eigenproblem solver context
+  eps - the eigenproblem solver context
-  krylovstart - boolean flag
-  krylovstart - boolean flag
 
 
   Options Database Key:
   Options Database Key:
.  -eps_gd_krylov_start - Activates starting the searching subspace with a
.  -eps_gd_krylov_start - Activates starting the searching subspace with a
    Krylov basis
    Krylov basis
   
   
   Level: advanced
   Level: advanced
 
 
.seealso: EPSGDGetKrylovStart()
.seealso: EPSGDGetKrylovStart()
@*/
@*/
PetscErrorCode EPSGDSetKrylovStart(EPS eps,PetscBool krylovstart)
PetscErrorCode EPSGDSetKrylovStart(EPS eps,PetscBool krylovstart)
{
{
  PetscErrorCode ierr;
  PetscErrorCode ierr;
 
 
  PetscFunctionBegin;
  PetscFunctionBegin;
  PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
  PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
  PetscValidLogicalCollectiveBool(eps,krylovstart,2);
  PetscValidLogicalCollectiveBool(eps,krylovstart,2);
  ierr = PetscTryMethod(eps,"EPSGDSetKrylovStart_C",(EPS,PetscBool),(eps,krylovstart));CHKERRQ(ierr);
  ierr = PetscTryMethod(eps,"EPSGDSetKrylovStart_C",(EPS,PetscBool),(eps,krylovstart));CHKERRQ(ierr);
  PetscFunctionReturn(0);
  PetscFunctionReturn(0);
}
}
 
 
#undef __FUNCT__  
#undef __FUNCT__  
#define __FUNCT__ "EPSGDGetKrylovStart"
#define __FUNCT__ "EPSGDGetKrylovStart"
/*@
/*@
   EPSGDGetKrylovStart - Returns a flag indicating if the search subspace is started with a
   EPSGDGetKrylovStart - Returns a flag indicating if the search subspace is started with a
   Krylov basis.
   Krylov basis.
 
 
   Not Collective
   Not Collective
 
 
   Input Parameter:
   Input Parameter:
.  eps - the eigenproblem solver context
.  eps - the eigenproblem solver context
 
 
   Output Parameters:
   Output Parameters:
.  krylovstart - boolean flag indicating if the search subspace is started
.  krylovstart - boolean flag indicating if the search subspace is started
   with a Krylov basis
   with a Krylov basis
 
 
   Level: advanced
   Level: advanced
 
 
.seealso: EPSGDGetKrylovStart()
.seealso: EPSGDGetKrylovStart()
@*/
@*/
PetscErrorCode EPSGDGetKrylovStart(EPS eps,PetscBool *krylovstart)
PetscErrorCode EPSGDGetKrylovStart(EPS eps,PetscBool *krylovstart)
{
{
  PetscErrorCode ierr;
  PetscErrorCode ierr;
 
 
  PetscFunctionBegin;
  PetscFunctionBegin;
  PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
  PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
  PetscValidPointer(krylovstart,2);
  PetscValidPointer(krylovstart,2);
  ierr = PetscTryMethod(eps,"EPSGDGetKrylovStart_C",(EPS,PetscBool*),(eps,krylovstart));CHKERRQ(ierr);
  ierr = PetscTryMethod(eps,"EPSGDGetKrylovStart_C",(EPS,PetscBool*),(eps,krylovstart));CHKERRQ(ierr);
  PetscFunctionReturn(0);
  PetscFunctionReturn(0);
}
}
 
 
#undef __FUNCT__  
#undef __FUNCT__  
#define __FUNCT__ "EPSGDSetBlockSize"
#define __FUNCT__ "EPSGDSetBlockSize"
/*@
/*@
   EPSGDSetBlockSize - Sets the number of vectors to be added to the searching space
   EPSGDSetBlockSize - Sets the number of vectors to be added to the searching space
   in every iteration.
   in every iteration.
 
 
   Logically Collective on EPS
   Logically Collective on EPS
 
 
   Input Parameters:
   Input Parameters:
+  eps - the eigenproblem solver context
+  eps - the eigenproblem solver context
-  blocksize - number of vectors added to the search space in every iteration
-  blocksize - number of vectors added to the search space in every iteration
 
 
   Options Database Key:
   Options Database Key:
.  -eps_gd_blocksize - number of vectors added to the search space in every iteration
.  -eps_gd_blocksize - number of vectors added to the search space in every iteration
   
   
   Level: advanced
   Level: advanced
 
 
.seealso: EPSGDSetKrylovStart()
.seealso: EPSGDSetKrylovStart()
@*/
@*/
PetscErrorCode EPSGDSetBlockSize(EPS eps,PetscInt blocksize)
PetscErrorCode EPSGDSetBlockSize(EPS eps,PetscInt blocksize)
{
{
  PetscErrorCode ierr;
  PetscErrorCode ierr;
 
 
  PetscFunctionBegin;
  PetscFunctionBegin;
  PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
  PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
  PetscValidLogicalCollectiveInt(eps,blocksize,2);
  PetscValidLogicalCollectiveInt(eps,blocksize,2);
  ierr = PetscTryMethod(eps,"EPSGDSetBlockSize_C",(EPS,PetscInt),(eps,blocksize));CHKERRQ(ierr);
  ierr = PetscTryMethod(eps,"EPSGDSetBlockSize_C",(EPS,PetscInt),(eps,blocksize));CHKERRQ(ierr);
  PetscFunctionReturn(0);
  PetscFunctionReturn(0);
}
}
 
 
#undef __FUNCT__  
#undef __FUNCT__  
#define __FUNCT__ "EPSGDGetBlockSize"
#define __FUNCT__ "EPSGDGetBlockSize"
/*@
/*@
   EPSGDGetBlockSize - Returns the number of vectors to be added to the searching space
   EPSGDGetBlockSize - Returns the number of vectors to be added to the searching space
   in every iteration.
   in every iteration.
 
 
   Not Collective
   Not Collective
 
 
   Input Parameter:
   Input Parameter:
.  eps - the eigenproblem solver context
.  eps - the eigenproblem solver context
 
 
   Output Parameter:
   Output Parameter:
.  blocksize - number of vectors added to the search space in every iteration
.  blocksize - number of vectors added to the search space in every iteration
 
 
   Level: advanced
   Level: advanced
 
 
.seealso: EPSGDSetBlockSize()
.seealso: EPSGDSetBlockSize()
@*/
@*/
PetscErrorCode EPSGDGetBlockSize(EPS eps,PetscInt *blocksize)
PetscErrorCode EPSGDGetBlockSize(EPS eps,PetscInt *blocksize)
{
{
  PetscErrorCode ierr;
  PetscErrorCode ierr;
 
 
  PetscFunctionBegin;
  PetscFunctionBegin;
  PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
  PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
  PetscValidIntPointer(blocksize,2);
  PetscValidIntPointer(blocksize,2);
  ierr = PetscTryMethod(eps,"EPSGDGetBlockSize_C",(EPS,PetscInt*),(eps,blocksize));CHKERRQ(ierr);
  ierr = PetscTryMethod(eps,"EPSGDGetBlockSize_C",(EPS,PetscInt*),(eps,blocksize));CHKERRQ(ierr);
  PetscFunctionReturn(0);
  PetscFunctionReturn(0);
}
}
 
 
#undef __FUNCT__  
#undef __FUNCT__  
#define __FUNCT__ "EPSGDGetRestart"
#define __FUNCT__ "EPSGDGetRestart"
/*@
/*@
   EPSGDGetRestart - Gets the number of vectors of the searching space after
   EPSGDGetRestart - Gets the number of vectors of the searching space after
   restarting and the number of vectors saved from the previous iteration.
   restarting and the number of vectors saved from the previous iteration.
 
 
   Not Collective
   Not Collective
 
 
   Input Parameter:
   Input Parameter:
.  eps - the eigenproblem solver context
.  eps - the eigenproblem solver context
 
 
   Output Parameter:
   Output Parameter:
+  minv - number of vectors of the searching subspace after restarting
+  minv - number of vectors of the searching subspace after restarting
-  plusk - number of vectors saved from the previous iteration  
-  plusk - number of vectors saved from the previous iteration  
 
 
   Level: advanced
   Level: advanced
 
 
.seealso: EPSGDSetRestart()
.seealso: EPSGDSetRestart()
@*/
@*/
PetscErrorCode EPSGDGetRestart(EPS eps,PetscInt *minv,PetscInt *plusk)
PetscErrorCode EPSGDGetRestart(EPS eps,PetscInt *minv,PetscInt *plusk)
{
{
  PetscErrorCode ierr;
  PetscErrorCode ierr;
 
 
  PetscFunctionBegin;
  PetscFunctionBegin;
  PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
  PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
  PetscValidIntPointer(minv,2);
  PetscValidIntPointer(minv,2);
  PetscValidIntPointer(plusk,3);
  PetscValidIntPointer(plusk,3);
  ierr = PetscTryMethod(eps,"EPSGDGetRestart_C",(EPS,PetscInt*,PetscInt*),(eps,minv,plusk));CHKERRQ(ierr);
  ierr = PetscTryMethod(eps,"EPSGDGetRestart_C",(EPS,PetscInt*,PetscInt*),(eps,minv,plusk));CHKERRQ(ierr);
  PetscFunctionReturn(0);
  PetscFunctionReturn(0);
}
}
 
 
#undef __FUNCT__  
#undef __FUNCT__  
#define __FUNCT__ "EPSGDSetRestart"
#define __FUNCT__ "EPSGDSetRestart"
/*@
/*@
   EPSGDSetRestart - Sets the number of vectors of the searching space after
   EPSGDSetRestart - Sets the number of vectors of the searching space after
   restarting and the number of vectors saved from the previous iteration.
   restarting and the number of vectors saved from the previous iteration.
 
 
   Logically Collective on EPS
   Logically Collective on EPS
 
 
   Input Parameters:
   Input Parameters:
+  eps - the eigenproblem solver context
+  eps - the eigenproblem solver context
.  minv - number of vectors of the searching subspace after restarting
.  minv - number of vectors of the searching subspace after restarting
-  plusk - number of vectors saved from the previous iteration  
-  plusk - number of vectors saved from the previous iteration  
 
 
   Options Database Keys:
   Options Database Keys:
+  -eps_gd_minv - number of vectors of the searching subspace after restarting
+  -eps_gd_minv - number of vectors of the searching subspace after restarting
-  -eps_gd_plusk - number of vectors saved from the previous iteration  
-  -eps_gd_plusk - number of vectors saved from the previous iteration  
   
   
   Level: advanced
   Level: advanced
 
 
.seealso: EPSGDSetRestart()
.seealso: EPSGDSetRestart()
@*/
@*/
PetscErrorCode EPSGDSetRestart(EPS eps,PetscInt minv,PetscInt plusk)
PetscErrorCode EPSGDSetRestart(EPS eps,PetscInt minv,PetscInt plusk)
{
{
  PetscErrorCode ierr;
  PetscErrorCode ierr;
 
 
  PetscFunctionBegin;
  PetscFunctionBegin;
  PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
  PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
  PetscValidLogicalCollectiveInt(eps,minv,2);
  PetscValidLogicalCollectiveInt(eps,minv,2);
  PetscValidLogicalCollectiveInt(eps,plusk,2);
  PetscValidLogicalCollectiveInt(eps,plusk,2);
  ierr = PetscTryMethod(eps,"EPSGDSetRestart_C",(EPS,PetscInt,PetscInt),(eps,minv,plusk));CHKERRQ(ierr);
  ierr = PetscTryMethod(eps,"EPSGDSetRestart_C",(EPS,PetscInt,PetscInt),(eps,minv,plusk));CHKERRQ(ierr);
  PetscFunctionReturn(0);
  PetscFunctionReturn(0);
}
}
 
 
#undef __FUNCT__  
#undef __FUNCT__  
#define __FUNCT__ "EPSGDGetInitialSize"
#define __FUNCT__ "EPSGDGetInitialSize"
/*@
/*@
   EPSGDGetInitialSize - Returns the initial size of the searching space.
   EPSGDGetInitialSize - Returns the initial size of the searching space.
 
 
   Not Collective
   Not Collective
 
 
   Input Parameter:
   Input Parameter:
.  eps - the eigenproblem solver context
.  eps - the eigenproblem solver context
 
 
   Output Parameter:
   Output Parameter:
.  initialsize - number of vectors of the initial searching subspace
.  initialsize - number of vectors of the initial searching subspace
 
 
   Notes:
   Notes:
   If EPSGDGetKrylovStart is PETSC_FALSE and the user provides vectors with
   If EPSGDGetKrylovStart is PETSC_FALSE and the user provides vectors with
   EPSSetInitialSpace, up to initialsize vectors will be used; and if the
   EPSSetInitialSpace, up to initialsize vectors will be used; and if the
   provided vectors are not enough, the solver completes the subspace with
   provided vectors are not enough, the solver completes the subspace with
   random vectors. In the case of EPSGDGetKrylovStart being PETSC_TRUE, the solver
   random vectors. In the case of EPSGDGetKrylovStart being PETSC_TRUE, the solver
   gets the first vector provided by the user or, if not available, a random vector,
   gets the first vector provided by the user or, if not available, a random vector,
   and expands the Krylov basis up to initialsize vectors.
   and expands the Krylov basis up to initialsize vectors.
 
 
   Level: advanced
   Level: advanced
 
 
.seealso: EPSGDSetInitialSize(), EPSGDGetKrylovStart()
.seealso: EPSGDSetInitialSize(), EPSGDGetKrylovStart()
@*/
@*/
PetscErrorCode EPSGDGetInitialSize(EPS eps,PetscInt *initialsize)
PetscErrorCode EPSGDGetInitialSize(EPS eps,PetscInt *initialsize)
{
{
  PetscErrorCode ierr;
  PetscErrorCode ierr;
 
 
  PetscFunctionBegin;
  PetscFunctionBegin;
  PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
  PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
  PetscValidIntPointer(initialsize,2);
  PetscValidIntPointer(initialsize,2);
  ierr = PetscTryMethod(eps,"EPSGDGetInitialSize_C",(EPS,PetscInt*),(eps,initialsize));CHKERRQ(ierr);
  ierr = PetscTryMethod(eps,"EPSGDGetInitialSize_C",(EPS,PetscInt*),(eps,initialsize));CHKERRQ(ierr);
  PetscFunctionReturn(0);
  PetscFunctionReturn(0);
}
}
 
 
#undef __FUNCT__  
#undef __FUNCT__  
#define __FUNCT__ "EPSGDSetInitialSize"
#define __FUNCT__ "EPSGDSetInitialSize"
/*@
/*@
   EPSGDSetInitialSize - Sets the initial size of the searching space.
   EPSGDSetInitialSize - Sets the initial size of the searching space.
 
 
   Logically Collective on EPS
   Logically Collective on EPS
 
 
   Input Parameters:
   Input Parameters:
+  eps - the eigenproblem solver context
+  eps - the eigenproblem solver context
-  initialsize - number of vectors of the initial searching subspace
-  initialsize - number of vectors of the initial searching subspace
 
 
   Options Database Key:
   Options Database Key:
.  -eps_gd_initial_size - number of vectors of the initial searching subspace
.  -eps_gd_initial_size - number of vectors of the initial searching subspace
   
   
   Notes:
   Notes:
   If EPSGDGetKrylovStart is PETSC_FALSE and the user provides vectors with
   If EPSGDGetKrylovStart is PETSC_FALSE and the user provides vectors with
   EPSSetInitialSpace, up to initialsize vectors will be used; and if the
   EPSSetInitialSpace, up to initialsize vectors will be used; and if the
   provided vectors are not enough, the solver completes the subspace with
   provided vectors are not enough, the solver completes the subspace with
   random vectors. In the case of EPSGDGetKrylovStart being PETSC_TRUE, the solver
   random vectors. In the case of EPSGDGetKrylovStart being PETSC_TRUE, the solver
   gets the first vector provided by the user or, if not available, a random vector,
   gets the first vector provided by the user or, if not available, a random vector,
   and expands the Krylov basis up to initialsize vectors.
   and expands the Krylov basis up to initialsize vectors.
 
 
   Level: advanced
   Level: advanced
 
 
.seealso: EPSGDGetInitialSize(), EPSGDGetKrylovStart()
.seealso: EPSGDGetInitialSize(), EPSGDGetKrylovStart()
@*/
@*/
PetscErrorCode EPSGDSetInitialSize(EPS eps,PetscInt initialsize)
PetscErrorCode EPSGDSetInitialSize(EPS eps,PetscInt initialsize)
{
{
  PetscErrorCode ierr;
  PetscErrorCode ierr;
 
 
  PetscFunctionBegin;
  PetscFunctionBegin;
  PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
  PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
  PetscValidLogicalCollectiveInt(eps,initialsize,2);
  PetscValidLogicalCollectiveInt(eps,initialsize,2);
  ierr = PetscTryMethod(eps,"EPSGDSetInitialSize_C",(EPS,PetscInt),(eps,initialsize));CHKERRQ(ierr);
  ierr = PetscTryMethod(eps,"EPSGDSetInitialSize_C",(EPS,PetscInt),(eps,initialsize));CHKERRQ(ierr);
  PetscFunctionReturn(0);
  PetscFunctionReturn(0);
}
}
 
 
#undef __FUNCT__  
#undef __FUNCT__  
#define __FUNCT__ "EPSGDSetBOrth"
#define __FUNCT__ "EPSGDSetBOrth"
/*@
/*@
   EPSGDSetBOrth - Activates or deactivates the B-orthogonalizetion of the searching
   EPSGDSetBOrth - Activates or deactivates the B-orthogonalizetion of the searching
   subspace in case of generalized Hermitian problems.
   subspace in case of generalized Hermitian problems.
 
 
   Logically Collective on EPS
   Logically Collective on EPS
 
 
   Input Parameters:
   Input Parameters:
+  eps - the eigenproblem solver context
+  eps - the eigenproblem solver context
-  borth - boolean flag
-  borth - boolean flag
 
 
   Options Database Key:
   Options Database Key:
.  -eps_gd_borth - Activates the B-orthogonalization of the searching subspace
.  -eps_gd_borth - Activates the B-orthogonalization of the searching subspace
   
   
   Level: advanced
   Level: advanced
 
 
.seealso: EPSGDGetBOrth()
.seealso: EPSGDGetBOrth()
@*/
@*/
PetscErrorCode EPSGDSetBOrth(EPS eps,PetscBool borth)
PetscErrorCode EPSGDSetBOrth(EPS eps,PetscBool borth)
{
{
  PetscErrorCode ierr;
  PetscErrorCode ierr;
 
 
  PetscFunctionBegin;
  PetscFunctionBegin;
  PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
  PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
  PetscValidLogicalCollectiveBool(eps,borth,2);
  PetscValidLogicalCollectiveBool(eps,borth,2);
  ierr = PetscTryMethod(eps,"EPSGDSetBOrth_C",(EPS,PetscBool),(eps,borth));CHKERRQ(ierr);
  ierr = PetscTryMethod(eps,"EPSGDSetBOrth_C",(EPS,PetscBool),(eps,borth));CHKERRQ(ierr);
  PetscFunctionReturn(0);
  PetscFunctionReturn(0);
}
}
 
 
#undef __FUNCT__  
#undef __FUNCT__  
#define __FUNCT__ "EPSGDGetBOrth"
#define __FUNCT__ "EPSGDGetBOrth"
/*@
/*@
   EPSGDGetBOrth - Returns a flag indicating if the search subspace basis is
   EPSGDGetBOrth - Returns a flag indicating if the search subspace basis is
   B-orthogonalized.
   B-orthogonalized.
 
 
   Not Collective
   Not Collective
 
 
   Input Parameter:
   Input Parameter:
.  eps - the eigenproblem solver context
.  eps - the eigenproblem solver context
 
 
   Output Parameters:
   Output Parameters:
.  borth - the boolean flag
.  borth - the boolean flag
 
 
   Level: advanced
   Level: advanced
 
 
.seealso: EPSGDGetKrylovStart()
.seealso: EPSGDGetKrylovStart()
@*/
@*/
PetscErrorCode EPSGDGetBOrth(EPS eps,PetscBool *borth)
PetscErrorCode EPSGDGetBOrth(EPS eps,PetscBool *borth)
{
{
  PetscErrorCode ierr;
  PetscErrorCode ierr;
 
 
  PetscFunctionBegin;
  PetscFunctionBegin;
  PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
  PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
  PetscValidPointer(borth,2);
  PetscValidPointer(borth,2);
  ierr = PetscTryMethod(eps,"EPSGDGetBOrth_C",(EPS,PetscBool*),(eps,borth));CHKERRQ(ierr);
  ierr = PetscTryMethod(eps,"EPSGDGetBOrth_C",(EPS,PetscBool*),(eps,borth));CHKERRQ(ierr);
  PetscFunctionReturn(0);
  PetscFunctionReturn(0);
}
}