Subversion Repositories slepc-dev

Rev

Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1665 Rev 1672
/*
/*
   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      SLEPc - Scalable Library for Eigenvalue Problem Computations
   SLEPc - Scalable Library for Eigenvalue Problem Computations
      Copyright (c) 2002-2007, Universidad Politecnica de Valencia, Spain
   Copyright (c) 2002-2009, Universidad Politecnica de Valencia, Spain
 
 
      This file is part of SLEPc. See the README file for conditions of use
   This file is part of SLEPc.
      and additional information.
     
 
   SLEPc is free software: you can redistribute it and/or modify it under  the
 
   terms of version 3 of the GNU Lesser General Public License as published by
 
   the Free Software Foundation.
 
 
 
   SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
 
   WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
 
   FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
 
   more details.
 
 
 
   You  should have received a copy of the GNU Lesser General  Public  License
 
   along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
*/
 
 
#ifndef _EPSIMPL
#ifndef _EPSIMPL
#define _EPSIMPL
#define _EPSIMPL
 
 
#include "slepceps.h"
#include "slepceps.h"
 
 
extern PetscFList EPSList;
extern PetscFList EPSList;
extern PetscLogEvent EPS_SetUp, EPS_Solve, EPS_Dense;
extern PetscLogEvent EPS_SetUp, EPS_Solve, EPS_Dense;
 
 
typedef struct _EPSOps *EPSOps;
typedef struct _EPSOps *EPSOps;
 
 
struct _EPSOps {
struct _EPSOps {
  PetscErrorCode  (*solve)(EPS);            /* one-sided solver */
  PetscErrorCode  (*solve)(EPS);            /* one-sided solver */
  PetscErrorCode  (*solvets)(EPS);          /* two-sided solver */
  PetscErrorCode  (*solvets)(EPS);          /* two-sided solver */
  PetscErrorCode  (*setup)(EPS);
  PetscErrorCode  (*setup)(EPS);
  PetscErrorCode  (*setfromoptions)(EPS);
  PetscErrorCode  (*setfromoptions)(EPS);
  PetscErrorCode  (*publishoptions)(EPS);
  PetscErrorCode  (*publishoptions)(EPS);
  PetscErrorCode  (*destroy)(EPS);
  PetscErrorCode  (*destroy)(EPS);
  PetscErrorCode  (*view)(EPS,PetscViewer);
  PetscErrorCode  (*view)(EPS,PetscViewer);
  PetscErrorCode  (*backtransform)(EPS);
  PetscErrorCode  (*backtransform)(EPS);
  PetscErrorCode  (*computevectors)(EPS);
  PetscErrorCode  (*computevectors)(EPS);
};
};
 
 
/*
/*
     Maximum number of monitors you can run with a single EPS
     Maximum number of monitors you can run with a single EPS
*/
*/
#define MAXEPSMONITORS 5
#define MAXEPSMONITORS 5
 
 
/*
/*
   Defines the EPS data structure.
   Defines the EPS data structure.
*/
*/
struct _p_EPS {
struct _p_EPS {
  PETSCHEADER(struct _EPSOps);
  PETSCHEADER(struct _EPSOps);
  /*------------------------- User parameters --------------------------*/
  /*------------------------- User parameters --------------------------*/
  PetscInt       max_it,           /* maximum number of iterations */
  PetscInt       max_it,           /* maximum number of iterations */
                 nev,              /* number of eigenvalues to compute */
                 nev,              /* number of eigenvalues to compute */
                 ncv,              /* number of basis vectors */
                 ncv,              /* number of basis vectors */
                 mpd,              /* maximum dimension of projected problem */
                 mpd,              /* maximum dimension of projected problem */
                 allocated_ncv,    /* number of basis vectors allocated */
                 allocated_ncv,    /* number of basis vectors allocated */
                 nds;              /* number of basis vectors of deflation space */
                 nds;              /* number of basis vectors of deflation space */
  PetscScalar    target;           /* target value */
  PetscScalar    target;           /* target value */
  PetscTruth     target_set;       /* flag indicating if target was specified */
  PetscTruth     target_set;       /* flag indicating if target was specified */
  PetscReal      tol;              /* tolerance */
  PetscReal      tol;              /* tolerance */
  EPSWhich       which;            /* which part of the spectrum to be sought */
  EPSWhich       which;            /* which part of the spectrum to be sought */
  PetscTruth     evecsavailable;   /* computed eigenvectors */
  PetscTruth     evecsavailable;   /* computed eigenvectors */
  EPSProblemType problem_type;     /* which kind of problem to be solved */
  EPSProblemType problem_type;     /* which kind of problem to be solved */
  EPSExtraction  extraction;       /* which kind of extraction to be applied */
  EPSExtraction  extraction;       /* which kind of extraction to be applied */
  EPSClass       solverclass;      /* whether the selected solver is one- or two-sided */
  EPSClass       solverclass;      /* whether the selected solver is one- or two-sided */
 
 
  /*------------------------- Working data --------------------------*/
  /*------------------------- Working data --------------------------*/
  Vec         vec_initial,      /* initial vector */
  Vec         vec_initial,      /* initial vector */
              vec_initial_left, /* left initial vector for two-sided solvers */
              vec_initial_left, /* left initial vector for two-sided solvers */
              *V,               /* set of basis vectors and computed eigenvectors */
              *V,               /* set of basis vectors and computed eigenvectors */
              *AV,              /* auxiliar set of basis vectors */
              *AV,              /* auxiliar set of basis vectors */
              *W,               /* set of left basis vectors and computed left eigenvectors */
              *W,               /* set of left basis vectors and computed left eigenvectors */
              *DS,              /* deflation space */
              *DS,              /* deflation space */
              *DSV;             /* deflation space and basis vectors*/
              *DSV;             /* deflation space and basis vectors*/
  PetscScalar *eigr, *eigi,     /* real and imaginary parts of eigenvalues */
  PetscScalar *eigr, *eigi,     /* real and imaginary parts of eigenvalues */
              *T, *Tl;          /* projected matrices */
              *T, *Tl;          /* projected matrices */
  PetscReal   *errest,          /* error estimates */
  PetscReal   *errest,          /* error estimates */
              *errest_left;     /* left error estimates */
              *errest_left;     /* left error estimates */
  ST          OP;               /* spectral transformation object */
  ST          OP;               /* spectral transformation object */
  IP          ip;               /* innerproduct object */
  IP          ip;               /* innerproduct object */
  void        *data;            /* placeholder for misc stuff associated
  void        *data;            /* placeholder for misc stuff associated
                                   with a particular solver */
                                   with a particular solver */
  PetscInt    nconv,            /* number of converged eigenvalues */
  PetscInt    nconv,            /* number of converged eigenvalues */
              its,              /* number of iterations so far computed */
              its,              /* number of iterations so far computed */
              *perm;            /* permutation for eigenvalue ordering */
              *perm;            /* permutation for eigenvalue ordering */
 
 
  /* ---------------- Default work-area and status vars -------------------- */
  /* ---------------- Default work-area and status vars -------------------- */
  PetscInt   nwork;
  PetscInt   nwork;
  Vec        *work;
  Vec        *work;
 
 
  PetscInt   setupcalled;
  PetscInt   setupcalled;
  PetscTruth isgeneralized,
  PetscTruth isgeneralized,
             ispositive,
             ispositive,
             ishermitian;
             ishermitian;
  EPSConvergedReason reason;    
  EPSConvergedReason reason;    
 
 
  PetscErrorCode (*monitor[MAXEPSMONITORS])(EPS,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*);
  PetscErrorCode (*monitor[MAXEPSMONITORS])(EPS,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*);
  PetscErrorCode (*monitordestroy[MAXEPSMONITORS])(void*);
  PetscErrorCode (*monitordestroy[MAXEPSMONITORS])(void*);
  void       *monitorcontext[MAXEPSMONITORS];
  void       *monitorcontext[MAXEPSMONITORS];
  PetscInt    numbermonitors;
  PetscInt    numbermonitors;
 
 
  PetscTruth ds_ortho;    /* if vectors in DS have to be orthonormalized */  
  PetscTruth ds_ortho;    /* if vectors in DS have to be orthonormalized */  
};
};
 
 
#define EPSMonitor(eps,it,nconv,eigr,eigi,errest,nest) \
#define EPSMonitor(eps,it,nconv,eigr,eigi,errest,nest) \
        { PetscErrorCode _ierr; PetscInt _i,_im = eps->numbermonitors; \
        { PetscErrorCode _ierr; PetscInt _i,_im = eps->numbermonitors; \
          for ( _i=0; _i<_im; _i++ ) {\
          for ( _i=0; _i<_im; _i++ ) {\
            _ierr=(*eps->monitor[_i])(eps,it,nconv,eigr,eigi,errest,nest,eps->monitorcontext[_i]);\
            _ierr=(*eps->monitor[_i])(eps,it,nconv,eigr,eigi,errest,nest,eps->monitorcontext[_i]);\
            CHKERRQ(_ierr); \
            CHKERRQ(_ierr); \
          } \
          } \
        }
        }
 
 
EXTERN PetscErrorCode EPSRegisterAll(char *);
EXTERN PetscErrorCode EPSRegisterAll(char *);
 
 
EXTERN PetscErrorCode EPSDestroy_Default(EPS);
EXTERN PetscErrorCode EPSDestroy_Default(EPS);
EXTERN PetscErrorCode EPSDefaultGetWork(EPS,PetscInt);
EXTERN PetscErrorCode EPSDefaultGetWork(EPS,PetscInt);
EXTERN PetscErrorCode EPSDefaultFreeWork(EPS);
EXTERN PetscErrorCode EPSDefaultFreeWork(EPS);
EXTERN PetscErrorCode EPSAllocateSolution(EPS);
EXTERN PetscErrorCode EPSAllocateSolution(EPS);
EXTERN PetscErrorCode EPSFreeSolution(EPS);
EXTERN PetscErrorCode EPSFreeSolution(EPS);
EXTERN PetscErrorCode EPSBackTransform_Default(EPS);
EXTERN PetscErrorCode EPSBackTransform_Default(EPS);
EXTERN PetscErrorCode EPSComputeVectors_Default(EPS);
EXTERN PetscErrorCode EPSComputeVectors_Default(EPS);
EXTERN PetscErrorCode EPSComputeVectors_Hermitian(EPS);
EXTERN PetscErrorCode EPSComputeVectors_Hermitian(EPS);
EXTERN PetscErrorCode EPSComputeVectors_Schur(EPS);
EXTERN PetscErrorCode EPSComputeVectors_Schur(EPS);
 
 
/* Private functions of the solver implementations */
/* Private functions of the solver implementations */
 
 
EXTERN PetscErrorCode EPSBasicArnoldi(EPS,PetscTruth,PetscScalar*,PetscInt,Vec*,PetscInt,PetscInt*,Vec,PetscReal*,PetscTruth*);
EXTERN PetscErrorCode EPSBasicArnoldi(EPS,PetscTruth,PetscScalar*,PetscInt,Vec*,PetscInt,PetscInt*,Vec,PetscReal*,PetscTruth*);
EXTERN PetscErrorCode EPSDelayedArnoldi(EPS,PetscScalar*,PetscInt,Vec*,PetscInt,PetscInt*,Vec,PetscReal*,PetscTruth*);
EXTERN PetscErrorCode EPSDelayedArnoldi(EPS,PetscScalar*,PetscInt,Vec*,PetscInt,PetscInt*,Vec,PetscReal*,PetscTruth*);
EXTERN PetscErrorCode EPSDelayedArnoldi1(EPS,PetscScalar*,PetscInt,Vec*,PetscInt,PetscInt*,Vec,PetscReal*,PetscTruth*);
EXTERN PetscErrorCode EPSDelayedArnoldi1(EPS,PetscScalar*,PetscInt,Vec*,PetscInt,PetscInt*,Vec,PetscReal*,PetscTruth*);
EXTERN PetscErrorCode ArnoldiResiduals(PetscScalar*,PetscInt,PetscScalar*,PetscReal,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscScalar*);
EXTERN PetscErrorCode ArnoldiResiduals(PetscScalar*,PetscInt,PetscScalar*,PetscReal,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscScalar*);
EXTERN PetscErrorCode EPSFullLanczos(EPS,PetscReal*,PetscReal*,Vec*,PetscInt,PetscInt*,Vec,PetscTruth*);
EXTERN PetscErrorCode EPSFullLanczos(EPS,PetscReal*,PetscReal*,Vec*,PetscInt,PetscInt*,Vec,PetscTruth*);
EXTERN PetscErrorCode EPSTranslateHarmonic(PetscInt,PetscScalar*,PetscInt,PetscScalar,PetscScalar,PetscScalar*,PetscScalar*);
EXTERN PetscErrorCode EPSTranslateHarmonic(PetscInt,PetscScalar*,PetscInt,PetscScalar,PetscScalar,PetscScalar*,PetscScalar*);
 
 
#endif
#endif