| Line 100... |
Line 100... |
size_cX, /* last value of d->size_cX */
|
size_cX, /* last value of d->size_cX */
|
old_size_X; /* last number of improved vectors */
|
old_size_X; /* last number of improved vectors */
|
PetscBLASInt
|
PetscBLASInt
|
*iXKZPivots; /* array of pivots */
|
*iXKZPivots; /* array of pivots */
|
} dvdImprovex_jd;
|
} dvdImprovex_jd;
|
|
|
#define _Ceil(A,B) ((A)/(B)+((A)%(B)==0?0:1))
|
|
#define FromIntToScalar(S) ((PetscInt)_Ceil((S)*sizeof(PetscBLASInt),sizeof(PetscScalar)))
|
|
|
|
#undef __FUNCT__
|
#undef __FUNCT__
|
#define __FUNCT__ "dvd_improvex_jd"
|
#define __FUNCT__ "dvd_improvex_jd"
|
PetscErrorCode dvd_improvex_jd(dvdDashboard *d, dvdBlackboard *b, KSP ksp,
|
PetscErrorCode dvd_improvex_jd(dvdDashboard *d, dvdBlackboard *b, KSP ksp,
|
PetscInt max_bs, PetscInt cX_impr, PetscBool dynamic)
|
PetscInt max_bs, PetscInt cX_impr, PetscBool dynamic)
|
{
|
{
|
PetscErrorCode ierr;
|
PetscErrorCode ierr;
|
dvdImprovex_jd *data;
|
dvdImprovex_jd *data;
|
PetscBool useGD, herm = DVD_IS(d->sEP, DVD_EP_HERMITIAN)?PETSC_TRUE:PETSC_FALSE, std_probl = DVD_IS(d->sEP, DVD_EP_STD)?PETSC_TRUE:PETSC_FALSE;
|
PetscBool useGD, herm = DVD_IS(d->sEP, DVD_EP_HERMITIAN)||DVD_IS(d->sEP, DVD_EP_INDEFINITE)?PETSC_TRUE:PETSC_FALSE, std_probl = DVD_IS(d->sEP, DVD_EP_STD)?PETSC_TRUE:PETSC_FALSE;
|
PC pc;
|
PC pc;
|
PetscInt size_P,s=1;
|
PetscInt size_P,s=1;
|
|
|
PetscFunctionBegin;
|
PetscFunctionBegin;
|
|
|
| Line 328... |
Line 325... |
n = PetscMin(PetscMin(data->size_X, max_size_D), r_e-r_s);
|
n = PetscMin(PetscMin(data->size_X, max_size_D), r_e-r_s);
|
if (n == 0) SETERRQ(PETSC_COMM_SELF,1, "n == 0!\n");
|
if (n == 0) SETERRQ(PETSC_COMM_SELF,1, "n == 0!\n");
|
if (data->size_X < r_e-r_s) SETERRQ(PETSC_COMM_SELF,1, "size_X < r_e-r_s!\n");
|
if (data->size_X < r_e-r_s) SETERRQ(PETSC_COMM_SELF,1, "size_X < r_e-r_s!\n");
|
|
|
/* Compute the eigenvectors of the selected pairs */
|
/* Compute the eigenvectors of the selected pairs */
|
if (DVD_IS(d->sEP, DVD_EP_HERMITIAN)) {
|
if (DVD_IS(d->sEP, DVD_EP_HERMITIAN)||DVD_IS(d->sEP,DVD_EP_INDEFINITE)) {
|
pX = d->pX;
|
pX = d->pX;
|
pY = d->pY?d->pY:d->pX;
|
pY = d->pY?d->pY:d->pX;
|
ldpX = d->ldpX;
|
ldpX = d->ldpX;
|
} else {
|
} else {
|
pX = auxS; auxS+= d->size_H*d->size_H;
|
pX = auxS; auxS+= d->size_H*d->size_H;
|
| Line 700... |
Line 697... |
PetscImaginaryPart((b)[0])); \
|
PetscImaginaryPart((b)[0])); \
|
} \
|
} \
|
}
|
}
|
#endif
|
#endif
|
|
|
#undef __FUNCT__
|
|
#define __FUNCT__ "dvd_improvex_compute_X"
|
|
PETSC_STATIC_INLINE PetscErrorCode dvd_improvex_compute_X(dvdDashboard *d,PetscInt i_s,PetscInt i_e,Vec *u,PetscScalar *pX,PetscInt ld)
|
|
{
|
|
PetscErrorCode ierr;
|
|
PetscInt n = i_e - i_s, i;
|
|
|
|
PetscFunctionBegin;
|
|
ierr = SlepcUpdateVectorsZ(u, 0.0, 1.0, d->V-d->cX_in_H, d->size_V+d->cX_in_H, pX, ld, d->size_H, n); CHKERRQ(ierr);
|
|
/* nX(i) <- ||X(i)|| */
|
|
if (d->correctXnorm) {
|
|
for (i=0; i<n; i++) {
|
|
ierr = VecNormBegin(u[i], NORM_2, &d->nX[i_s+i]);CHKERRQ(ierr);
|
|
}
|
|
for (i=0; i<n; i++) {
|
|
ierr = VecNormEnd(u[i], NORM_2, &d->nX[i_s+i]);CHKERRQ(ierr);
|
|
}
|
|
#if !defined(PETSC_USE_COMPLEX)
|
|
for(i=0; i<n; i++)
|
|
if(d->eigi[i_s+i] != 0.0)
|
|
d->nX[i_s+i] = d->nX[i_s+i+1] = PetscSqrtScalar(d->nX[i_s+i]*d->nX[i_s+i]+d->nX[i_s+i+1]*d->nX[i_s+i+1]);
|
|
#endif
|
|
} else {
|
|
for (i=0; i<n; i++) d->nX[i_s+i] = 1.0;
|
|
}
|
|
PetscFunctionReturn(0);
|
|
}
|
|
|
|
#undef __FUNCT__
|
#undef __FUNCT__
|
#define __FUNCT__ "dvd_improvex_jd_proj_uv_KZX"
|
#define __FUNCT__ "dvd_improvex_jd_proj_uv_KZX"
|
/*
|
/*
|
Compute: u <- X, v <- K*(theta[0]*A+theta[1]*B)*X,
|
Compute: u <- X, v <- K*(theta[0]*A+theta[1]*B)*X,
|