| Line 32... |
Line 32... |
typedef struct {
|
typedef struct {
|
PetscInt bs, /* common number of approximated eigenpairs obtained */
|
PetscInt bs, /* common number of approximated eigenpairs obtained */
|
real_max_size_V,
|
real_max_size_V,
|
/* real max size of V */
|
/* real max size of V */
|
min_size_V, /* restart with this number of eigenvectors */
|
min_size_V, /* restart with this number of eigenvectors */
|
plusk; /* when restart, save plusk vectors from last iteration */
|
plusk, /* when restart, save plusk vectors from last iteration */
|
|
mpd; /* max size of the searching subspace */
|
Vec *real_V, /* real start vectors V */
|
Vec *real_V, /* real start vectors V */
|
*new_cY; /* new left converged eigenvectors from the last iter */
|
*new_cY; /* new left converged eigenvectors from the last iter */
|
void
|
void
|
*old_updateV_data;
|
*old_updateV_data;
|
/* old updateV data */
|
/* old updateV data */
|
| Line 53... |
Line 54... |
} dvdManagV_basic;
|
} dvdManagV_basic;
|
|
|
#undef __FUNCT__
|
#undef __FUNCT__
|
#define __FUNCT__ "dvd_managementV_basic"
|
#define __FUNCT__ "dvd_managementV_basic"
|
PetscErrorCode dvd_managementV_basic(dvdDashboard *d, dvdBlackboard *b,
|
PetscErrorCode dvd_managementV_basic(dvdDashboard *d, dvdBlackboard *b,
|
PetscInt bs, PetscInt max_size_V,
|
PetscInt bs, PetscInt max_size_V,
|
PetscInt min_size_V, PetscInt plusk,
|
PetscInt mpd, PetscInt min_size_V,
|
PetscTruth harm)
|
PetscInt plusk, PetscTruth harm)
|
{
|
{
|
PetscErrorCode ierr;
|
PetscErrorCode ierr;
|
dvdManagV_basic *data;
|
dvdManagV_basic *data;
|
PetscInt max_conv = max_size_V;
|
|
PetscInt i;
|
PetscInt i;
|
|
|
PetscFunctionBegin;
|
PetscFunctionBegin;
|
|
|
/* Setting configuration constrains */
|
/* Setting configuration constrains */
|
|
mpd = PetscMin(mpd, max_size_V);
|
|
min_size_V = PetscMin(min_size_V, mpd-bs);
|
|
b->max_size_X = PetscMax(b->max_size_X, PetscMax(bs, min_size_V));
|
b->max_size_auxV = PetscMax(PetscMax(b->max_size_auxV,
|
b->max_size_auxV = PetscMax(PetscMax(b->max_size_auxV,
|
max_conv /* updateV_conv_gen */ ),
|
b->max_size_X /* updateV_conv_gen */ ),
|
2 /* testConv */ );
|
2 /* testConv */ );
|
b->max_size_X = PetscMax(b->max_size_X, PetscMax(bs, min_size_V));
|
|
b->max_size_auxS = PetscMax(PetscMax(PetscMax(b->max_size_auxS,
|
b->max_size_auxS = PetscMax(PetscMax(PetscMax(b->max_size_auxS,
|
max_size_V*max_conv /* YtWx */ ),
|
max_size_V*b->max_size_X /* YtWx */ ),
|
max_size_V*2 /* SlepcDenseOrth */ ),
|
max_size_V*2 /* SlepcDenseOrth */ ),
|
max_size_V*b->max_size_X /* testConv:res_0 */ );
|
max_size_V*b->max_size_X /* testConv:res_0 */ );
|
b->max_size_V = max_size_V;
|
b->max_size_V = mpd;
|
b->own_vecs+= max_size_V*(harm==PETSC_TRUE?2:1); /* V, W? */
|
b->own_vecs+= max_size_V*(harm==PETSC_TRUE?2:1); /* V, W? */
|
b->own_scalars+= b->max_size_V*2 /* eigr, eigr */ +
|
b->own_scalars+= max_size_V*2 /* eigr, eigr */ +
|
b->max_size_V /* nR */ +
|
max_size_V /* nR */ +
|
b->max_size_V /* nX */ +
|
max_size_V /* nX */ +
|
b->max_size_V /* errest */ +
|
max_size_V /* errest */ +
|
2*b->max_size_V*b->max_size_V*(harm==PETSC_TRUE?2:1)
|
2*b->max_size_V*b->max_size_V*(harm==PETSC_TRUE?2:1)
|
/* MTX,MTY?,oldU,oldV? */;
|
/* MTX,MTY?,oldU,oldV? */;
|
// b->max_size_oldX = plusk;
|
// b->max_size_oldX = plusk;
|
|
|
/* Setup the step */
|
/* Setup the step */
|
if (b->state >= DVD_STATE_CONF) {
|
if (b->state >= DVD_STATE_CONF) {
|
ierr = PetscMalloc(sizeof(dvdManagV_basic), &data); CHKERRQ(ierr);
|
ierr = PetscMalloc(sizeof(dvdManagV_basic), &data); CHKERRQ(ierr);
|
| Line 93... |
Line 95... |
data->real_V = b->free_vecs; b->free_vecs+= max_size_V;
|
data->real_V = b->free_vecs; b->free_vecs+= max_size_V;
|
data->bs = bs;
|
data->bs = bs;
|
data->plusk = plusk;
|
data->plusk = plusk;
|
data->new_cY = PETSC_NULL;
|
data->new_cY = PETSC_NULL;
|
data->size_new_cY = 0;
|
data->size_new_cY = 0;
|
|
data->mpd = mpd;
|
|
|
d->V = data->real_V;
|
d->V = data->real_V;
|
d->max_size_V = data->real_max_size_V;
|
d->max_size_V = data->real_max_size_V;
|
d->cX = data->real_V;
|
d->cX = data->real_V;
|
d->eigr = b->free_scalars; b->free_scalars+= b->max_size_V;
|
d->eigr = b->free_scalars; b->free_scalars+= max_size_V;
|
d->eigi = b->free_scalars; b->free_scalars+= b->max_size_V;
|
d->eigi = b->free_scalars; b->free_scalars+= max_size_V;
|
#ifdef PETSC_USE_COMPLEX
|
#ifdef PETSC_USE_COMPLEX
|
for(i=0; i<b->max_size_V; i++) d->eigi[i] = 0.0;
|
for(i=0; i<max_size_V; i++) d->eigi[i] = 0.0;
|
#endif
|
#endif
|
d->nR = (PetscReal*)b->free_scalars;
|
d->nR = (PetscReal*)b->free_scalars;
|
b->free_scalars = (PetscScalar*)(d->nR + b->max_size_V);
|
b->free_scalars = (PetscScalar*)(d->nR + max_size_V);
|
for(i=0; i<b->max_size_V; i++) d->nR[i] = PETSC_MAX;
|
for(i=0; i<max_size_V; i++) d->nR[i] = PETSC_MAX;
|
d->nX = (PetscReal*)b->free_scalars;
|
d->nX = (PetscReal*)b->free_scalars;
|
b->free_scalars = (PetscScalar*)(d->nX + b->max_size_V);
|
b->free_scalars = (PetscScalar*)(d->nX + max_size_V);
|
d->errest = (PetscReal*)b->free_scalars;
|
d->errest = (PetscReal*)b->free_scalars;
|
b->free_scalars = (PetscScalar*)(d->errest + b->max_size_V);
|
b->free_scalars = (PetscScalar*)(d->errest + max_size_V);
|
d->ceigr = d->eigr;
|
d->ceigr = d->eigr;
|
d->ceigi = d->eigi;
|
d->ceigi = d->eigi;
|
d->MTX = b->free_scalars; b->free_scalars+= b->max_size_V*b->max_size_V;
|
d->MTX = b->free_scalars; b->free_scalars+= b->max_size_V*b->max_size_V;
|
data->oldU = b->free_scalars; b->free_scalars+= b->max_size_V*b->max_size_V;
|
data->oldU = b->free_scalars; b->free_scalars+= b->max_size_V*b->max_size_V;
|
data->ldoldU = 0;
|
data->ldoldU = 0;
|
| Line 146... |
Line 149... |
PetscTruth restart;
|
PetscTruth restart;
|
dvdManagV_basic *data = (dvdManagV_basic*)d->updateV_data;
|
dvdManagV_basic *data = (dvdManagV_basic*)d->updateV_data;
|
|
|
PetscFunctionBegin;
|
PetscFunctionBegin;
|
|
|
restart = (d->size_V + data->bs > d->max_size_V)?PETSC_TRUE:PETSC_FALSE;
|
/* Take into account the possibility of conjugate eigenpairs */
|
|
#if defined(PETSC_USE_COMPLEX)
|
|
#define ONE 0
|
|
#else
|
|
#define ONE 1
|
|
#endif
|
|
|
|
restart = (d->size_V + data->bs + ONE > PetscMin(data->mpd,d->max_size_V))?
|
|
PETSC_TRUE:PETSC_FALSE;
|
|
|
|
#undef ONE
|
|
|
/* Check old isRestarting function */
|
/* Check old isRestarting function */
|
if ((restart == PETSC_FALSE) && (data->old_isRestarting))
|
if ((restart == PETSC_FALSE) && (data->old_isRestarting))
|
restart = data->old_isRestarting(d);
|
restart = data->old_isRestarting(d);
|
|
|