Subversion Repositories slepc-dev

Rev

Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2772 Rev 2773
Line 375... Line 375...
   PSTranslateHarmonic - Computes a translation of the projected matrix.
   PSTranslateHarmonic - Computes a translation of the projected matrix.
 
 
   Not Collective
   Not Collective
 
 
   Input Parameters:
   Input Parameters:
+  ps   - the projected system context
+  ps      - the projected system context
.  tau  - the translation amount
.  tau     - the translation amount
-  beta - last component of vector b
.  beta    - last component of vector b
 
-  recover - boolean flag to indicate whether to recover or not
 
 
 
   Output Parameters:
 
+  g       - the computed vector (optional)
 
-  gamma   - scale factor (optional)
 
 
   Notes:
   Notes:
   This function is intended for use in the context of Krylov methods only.
   This function is intended for use in the context of Krylov methods only.
   It computes a translation of a Krylov decomposition in order to extract
   It computes a translation of a Krylov decomposition in order to extract
   eigenpair approximations by harmonic Rayleigh-Ritz.
   eigenpair approximations by harmonic Rayleigh-Ritz.
   The matrix is updated as A + g*b' where g = (B-tau*eye(n))'\b and
   The matrix is updated as A + g*b' where g = (A-tau*eye(n))'\b and
   vector b is assumed to be beta*e_n^T.
   vector b is assumed to be beta*e_n^T.
 
 
   Level: developer
   The gamma factor is defined as sqrt(1+g'*g) and can be interpreted as
 
   the factor by which the residual of the Krylov decomposition is scaled.
 
 
.seealso: PSRecoverHarmonic()
   If the recover flag is activated, the computed translation undoes the
 
   translation done previously. In that case, parameter tau is ignored.
 
 
 
   Level: developer
@*/
@*/
PetscErrorCode PSTranslateHarmonic(PS ps,PetscScalar tau,PetscScalar beta,PetscScalar *g)
PetscErrorCode PSTranslateHarmonic(PS ps,PetscScalar tau,PetscReal beta,PetscBool recover,PetscScalar *g,PetscScalar *gamma)
{
{
  PetscErrorCode ierr;
  PetscErrorCode ierr;
 
 
  PetscFunctionBegin;
  PetscFunctionBegin;
  PetscValidHeaderSpecific(ps,PS_CLASSID,1);
  PetscValidHeaderSpecific(ps,PS_CLASSID,1);
  if (!ps->ops->translate) SETERRQ1(((PetscObject)ps)->comm,PETSC_ERR_SUP,"PS type %s",((PetscObject)ps)->type_name);
  if (!ps->ops->translate) SETERRQ1(((PetscObject)ps)->comm,PETSC_ERR_SUP,"PS type %s",((PetscObject)ps)->type_name);
  ierr = PetscLogEventBegin(PS_Other,ps,0,0,0);CHKERRQ(ierr);
  ierr = PetscLogEventBegin(PS_Other,ps,0,0,0);CHKERRQ(ierr);
  ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr);
  ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr);
  ierr = (*ps->ops->translate)(ps,tau,beta,g);CHKERRQ(ierr);
  ierr = (*ps->ops->translate)(ps,tau,beta,recover,g,gamma);CHKERRQ(ierr);
  ierr = PetscFPTrapPop();CHKERRQ(ierr);
  ierr = PetscFPTrapPop();CHKERRQ(ierr);
  ierr = PetscLogEventEnd(PS_Other,ps,0,0,0);CHKERRQ(ierr);
  ierr = PetscLogEventEnd(PS_Other,ps,0,0,0);CHKERRQ(ierr);
  ps->state = PS_STATE_RAW;
  ps->state = PS_STATE_RAW;
  ierr = PetscObjectStateIncrease((PetscObject)ps);CHKERRQ(ierr);
  ierr = PetscObjectStateIncrease((PetscObject)ps);CHKERRQ(ierr);
  PetscFunctionReturn(0);
  PetscFunctionReturn(0);