| Line 33... |
Line 33... |
/**** Solver options ****/
|
/**** Solver options ****/
|
PetscInt blocksize, /* block size */
|
PetscInt blocksize, /* block size */
|
initialsize, /* initial size of V */
|
initialsize, /* initial size of V */
|
minv, /* size of V after restarting */
|
minv, /* size of V after restarting */
|
plusk; /* keep plusk eigenvectors from the last iteration */
|
plusk; /* keep plusk eigenvectors from the last iteration */
|
PetscBool ipB; /* true if V'B*V=I */
|
PetscBool ipB; /* true if B-ortho is used */
|
|
PetscBool ipBindef; /* true if V'*B*V != I */
|
PetscInt method; /* method for improving the approximate solution */
|
PetscInt method; /* method for improving the approximate solution */
|
PetscReal fix; /* the fix parameter */
|
PetscReal fix; /* the fix parameter */
|
PetscBool krylovstart; /* true if the starting subspace is a Krylov basis */
|
PetscBool krylovstart; /* true if the starting subspace is a Krylov basis */
|
PetscBool dynamic; /* true if dynamic stopping criterion is used */
|
PetscBool dynamic; /* true if dynamic stopping criterion is used */
|
PetscInt cX_in_proj, /* converged vectors in the projected problem */
|
PetscInt cX_in_proj, /* converged vectors in the projected problem */
|
cX_in_impr; /* converged vectors in the projector */
|
cX_in_impr; /* converged vectors in the projector */
|
|
Method_t scheme; /* method employed: GD, JD or GD2 */
|
|
|
/**** Solver data ****/
|
/**** Solver data ****/
|
dvdDashboard ddb;
|
dvdDashboard ddb;
|
|
|
/**** Things to destroy ****/
|
/**** Things to destroy ****/
|
| Line 83... |
Line 85... |
ierr = EPSDavidsonSetInitialSize_Davidson(eps,5);CHKERRQ(ierr);
|
ierr = EPSDavidsonSetInitialSize_Davidson(eps,5);CHKERRQ(ierr);
|
ierr = EPSDavidsonSetFix_Davidson(eps,0.01);CHKERRQ(ierr);
|
ierr = EPSDavidsonSetFix_Davidson(eps,0.01);CHKERRQ(ierr);
|
ierr = EPSDavidsonSetBOrth_Davidson(eps,PETSC_TRUE);CHKERRQ(ierr);
|
ierr = EPSDavidsonSetBOrth_Davidson(eps,PETSC_TRUE);CHKERRQ(ierr);
|
ierr = EPSDavidsonSetConstantCorrectionTolerance_Davidson(eps,PETSC_TRUE);CHKERRQ(ierr);
|
ierr = EPSDavidsonSetConstantCorrectionTolerance_Davidson(eps,PETSC_TRUE);CHKERRQ(ierr);
|
ierr = EPSDavidsonSetWindowSizes_Davidson(eps,0,0);CHKERRQ(ierr);
|
ierr = EPSDavidsonSetWindowSizes_Davidson(eps,0,0);CHKERRQ(ierr);
|
|
data->ipBindef = PETSC_FALSE;
|
PetscFunctionReturn(0);
|
PetscFunctionReturn(0);
|
}
|
}
|
|
|
#undef __FUNCT__
|
#undef __FUNCT__
|
#define __FUNCT__ "EPSSetUp_Davidson"
|
#define __FUNCT__ "EPSSetUp_Davidson"
|
| Line 133... |
Line 136... |
if (!(min_size_V+bs <= eps->mpd))
|
if (!(min_size_V+bs <= eps->mpd))
|
SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_SUP,"The value of minv must be less than mpd minus blocksize");
|
SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_SUP,"The value of minv must be less than mpd minus blocksize");
|
ierr = EPSDavidsonGetInitialSize_Davidson(eps,&initv);CHKERRQ(ierr);
|
ierr = EPSDavidsonGetInitialSize_Davidson(eps,&initv);CHKERRQ(ierr);
|
if (eps->mpd < initv)
|
if (eps->mpd < initv)
|
SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_SUP,"The initv has to be less or equal than mpd");
|
SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_SUP,"The initv has to be less or equal than mpd");
|
|
|
|
ierr = PetscOptionsGetBool(PETSC_NULL,"-eps_dvd_indef",&data->ipBindef,&t);CHKERRQ(ierr);
|
|
|
/* Davidson solvers do not support left eigenvectors */
|
/* Davidson solvers do not support left eigenvectors */
|
if (eps->leftvecs) SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_SUP,"Left vectors not supported in this solver");
|
if (eps->leftvecs) SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_SUP,"Left vectors not supported in this solver");
|
|
|
/* Set STPrecond as the default ST */
|
/* Set STPrecond as the default ST */
|
| Line 177... |
Line 182... |
(ispositive? DVD_MAT_POS_DEF : 0);
|
(ispositive? DVD_MAT_POS_DEF : 0);
|
ipB = (dvd->B && data->ipB && DVD_IS(dvd->sB,DVD_MAT_POS_DEF))?PETSC_TRUE:PETSC_FALSE;
|
ipB = (dvd->B && data->ipB && DVD_IS(dvd->sB,DVD_MAT_POS_DEF))?PETSC_TRUE:PETSC_FALSE;
|
data->ipB = ipB;
|
data->ipB = ipB;
|
dvd->correctXnorm = ipB;
|
dvd->correctXnorm = ipB;
|
dvd->sEP = ((!eps->isgeneralized || (eps->isgeneralized && ipB))? DVD_EP_STD : 0) |
|
dvd->sEP = ((!eps->isgeneralized || (eps->isgeneralized && ipB))? DVD_EP_STD : 0) |
|
(ispositive? DVD_EP_HERMITIAN : 0);
|
(ispositive? DVD_EP_HERMITIAN : 0) |
|
|
((data->ipBindef && ipB) ? DVD_EP_INDEFINITE : 0);
|
dvd->nev = eps->nev;
|
dvd->nev = eps->nev;
|
dvd->which = eps->which;
|
dvd->which = eps->which;
|
dvd->withTarget = PETSC_TRUE;
|
dvd->withTarget = PETSC_TRUE;
|
switch(eps->which) {
|
switch(eps->which) {
|
case EPS_TARGET_MAGNITUDE:
|
case EPS_TARGET_MAGNITUDE:
|
| Line 279... |
Line 285... |
ierr = dvd_schm_basic_preconf(dvd,&b,eps->mpd,min_size_V,bs,
|
ierr = dvd_schm_basic_preconf(dvd,&b,eps->mpd,min_size_V,bs,
|
initv,
|
initv,
|
PetscAbs(eps->nini),
|
PetscAbs(eps->nini),
|
plusk,harm,
|
plusk,harm,
|
ksp,init,eps->trackall,
|
ksp,init,eps->trackall,
|
ipB?DVD_ORTHOV_BOneMV:DVD_ORTHOV_I,cX_in_proj,cX_in_impr);
|
ipB?DVD_ORTHOV_BOneMV:DVD_ORTHOV_I,cX_in_proj,cX_in_impr,
|
|
data->scheme);
|
CHKERRQ(ierr);
|
CHKERRQ(ierr);
|
|
|
/* Allocate memory */
|
/* Allocate memory */
|
nvecs = b.max_size_auxV + b.own_vecs;
|
nvecs = b.max_size_auxV + b.own_vecs;
|
nscalars = b.own_scalars + b.max_size_auxS;
|
nscalars = b.own_scalars + b.max_size_auxS;
|
| Line 306... |
Line 313... |
initv,
|
initv,
|
PetscAbs(eps->nini),plusk,
|
PetscAbs(eps->nini),plusk,
|
eps->ip,harm,dvd->withTarget,
|
eps->ip,harm,dvd->withTarget,
|
target,ksp,
|
target,ksp,
|
fix,init,eps->trackall,
|
fix,init,eps->trackall,
|
ipB?DVD_ORTHOV_BOneMV:DVD_ORTHOV_I,cX_in_proj,cX_in_impr,dynamic);
|
ipB?DVD_ORTHOV_BOneMV:DVD_ORTHOV_I,cX_in_proj,cX_in_impr,dynamic,
|
|
data->scheme);
|
CHKERRQ(ierr);
|
CHKERRQ(ierr);
|
|
|
/* Associate the eigenvalues to the EPS */
|
/* Associate the eigenvalues to the EPS */
|
eps->eigr = dvd->real_eigr;
|
eps->eigr = dvd->real_eigr;
|
eps->eigi = dvd->real_eigi;
|
eps->eigi = dvd->real_eigi;
|
| Line 619... |
Line 627... |
*pwindow = data->cX_in_impr;
|
*pwindow = data->cX_in_impr;
|
*qwindow = data->cX_in_proj;
|
*qwindow = data->cX_in_proj;
|
PetscFunctionReturn(0);
|
PetscFunctionReturn(0);
|
}
|
}
|
|
|
|
#undef __FUNCT__
|
|
#define __FUNCT__ "EPSDavidsonSetMethod_Davidson"
|
|
PetscErrorCode EPSDavidsonSetMethod_Davidson(EPS eps,Method_t method)
|
|
{
|
|
EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data;
|
|
|
|
PetscFunctionBegin;
|
|
data->scheme = method;
|
|
PetscFunctionReturn(0);
|
|
}
|
|
|
|
#undef __FUNCT__
|
|
#define __FUNCT__ "EPSDavidsonGetMethod_Davidson"
|
|
PetscErrorCode EPSDavidsonGetMethod_Davidson(EPS eps,Method_t *method)
|
|
{
|
|
EPS_DAVIDSON *data = (EPS_DAVIDSON*)eps->data;
|
|
|
|
PetscFunctionBegin;
|
|
*method = data->scheme;
|
|
PetscFunctionReturn(0);
|
|
}
|
|
|
#undef __FUNCT__
|
#undef __FUNCT__
|
#define __FUNCT__ "EPSComputeVectors_Davidson"
|
#define __FUNCT__ "EPSComputeVectors_Davidson"
|
/*
|
/*
|
EPSComputeVectors_Davidson - Compute eigenvectors from the vectors
|
EPSComputeVectors_Davidson - Compute eigenvectors from the vectors
|