| Line 29... |
Line 29... |
#undef __FUNCT__
|
#undef __FUNCT__
|
#define __FUNCT__ "EPSSetUp_TRLAN"
|
#define __FUNCT__ "EPSSetUp_TRLAN"
|
PetscErrorCode EPSSetUp_TRLAN(EPS eps)
|
PetscErrorCode EPSSetUp_TRLAN(EPS eps)
|
{
|
{
|
PetscErrorCode ierr;
|
PetscErrorCode ierr;
|
PetscInt n;
|
|
EPS_TRLAN *tr = (EPS_TRLAN *)eps->data;
|
EPS_TRLAN *tr = (EPS_TRLAN *)eps->data;
|
|
|
PetscFunctionBegin;
|
PetscFunctionBegin;
|
ierr = VecGetSize(eps->vec_initial,&n);CHKERRQ(ierr);
|
|
if (eps->ncv) {
|
if (eps->ncv) {
|
if (eps->ncv<eps->nev) SETERRQ(1,"The value of ncv must be at least nev");
|
if (eps->ncv<eps->nev) SETERRQ(1,"The value of ncv must be at least nev");
|
}
|
}
|
else eps->ncv = eps->nev;
|
else eps->ncv = eps->nev;
|
if (eps->mpd) PetscInfo(eps,"Warning: parameter mpd ignored\n");
|
if (eps->mpd) PetscInfo(eps,"Warning: parameter mpd ignored\n");
|
if (!eps->max_it) eps->max_it = PetscMax(1000,n);
|
if (!eps->max_it) eps->max_it = PetscMax(1000,eps->n);
|
|
|
if (!eps->ishermitian)
|
if (!eps->ishermitian)
|
SETERRQ(PETSC_ERR_SUP,"Requested method is only available for Hermitian problems");
|
SETERRQ(PETSC_ERR_SUP,"Requested method is only available for Hermitian problems");
|
|
|
if (eps->isgeneralized)
|
if (eps->isgeneralized)
|
SETERRQ(PETSC_ERR_SUP,"Requested method is not available for generalized problems");
|
SETERRQ(PETSC_ERR_SUP,"Requested method is not available for generalized problems");
|
|
|
tr->restart = 0;
|
tr->restart = 0;
|
ierr = VecGetLocalSize(eps->vec_initial,&n); CHKERRQ(ierr);
|
|
tr->maxlan = PetscBLASIntCast(eps->nev+PetscMin(eps->nev,6));
|
tr->maxlan = PetscBLASIntCast(eps->nev+PetscMin(eps->nev,6));
|
if (tr->maxlan+1-eps->ncv<=0) { tr->lwork = PetscBLASIntCast(tr->maxlan*(tr->maxlan+10)); }
|
if (tr->maxlan+1-eps->ncv<=0) { tr->lwork = PetscBLASIntCast(tr->maxlan*(tr->maxlan+10)); }
|
else { tr->lwork = PetscBLASIntCast(n*(tr->maxlan+1-eps->ncv) + tr->maxlan*(tr->maxlan+10)); }
|
else { tr->lwork = PetscBLASIntCast(eps->nloc*(tr->maxlan+1-eps->ncv) + tr->maxlan*(tr->maxlan+10)); }
|
ierr = PetscMalloc(tr->lwork*sizeof(PetscReal),&tr->work);CHKERRQ(ierr);
|
ierr = PetscMalloc(tr->lwork*sizeof(PetscReal),&tr->work);CHKERRQ(ierr);
|
|
|
if (eps->extraction) {
|
if (eps->extraction) {
|
ierr = PetscInfo(eps,"Warning: extraction type ignored\n");CHKERRQ(ierr);
|
ierr = PetscInfo(eps,"Warning: extraction type ignored\n");CHKERRQ(ierr);
|
}
|
}
|
| Line 91... |
Line 88... |
#undef __FUNCT__
|
#undef __FUNCT__
|
#define __FUNCT__ "EPSSolve_TRLAN"
|
#define __FUNCT__ "EPSSolve_TRLAN"
|
PetscErrorCode EPSSolve_TRLAN(EPS eps)
|
PetscErrorCode EPSSolve_TRLAN(EPS eps)
|
{
|
{
|
PetscErrorCode ierr;
|
PetscErrorCode ierr;
|
PetscInt i,nn;
|
PetscInt i;
|
PetscBLASInt ipar[32], n, lohi, stat, ncv;
|
PetscBLASInt ipar[32], n, lohi, stat, ncv;
|
EPS_TRLAN *tr = (EPS_TRLAN *)eps->data;
|
EPS_TRLAN *tr = (EPS_TRLAN *)eps->data;
|
PetscScalar *pV;
|
PetscScalar *pV;
|
|
|
PetscFunctionBegin;
|
PetscFunctionBegin;
|
|
|
ncv = PetscBLASIntCast(eps->ncv);
|
ncv = PetscBLASIntCast(eps->ncv);
|
ierr = VecGetLocalSize(eps->vec_initial,&nn); CHKERRQ(ierr);
|
n = PetscBLASIntCast(eps->nloc);
|
n = PetscBLASIntCast(nn);
|
|
|
|
if (eps->which==EPS_LARGEST_REAL) lohi = 1;
|
if (eps->which==EPS_LARGEST_REAL) lohi = 1;
|
else if (eps->which==EPS_SMALLEST_REAL) lohi = -1;
|
else if (eps->which==EPS_SMALLEST_REAL) lohi = -1;
|
else SETERRQ(1,"Wrong value of eps->which");
|
else SETERRQ(1,"Wrong value of eps->which");
|
|
|