Date: 2016-09-29T11:13:16+00:00

Actual source code: slepcpep.h
slepc-3.7.3 2016-09-29
Report Typos and Errors

      1: /*
      2:    User interface for SLEPc's polynomial eigenvalue solvers.

      4:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      5:    SLEPc - Scalable Library for Eigenvalue Problem Computations
      6:    Copyright (c) 2002-2016, Universitat Politecnica de Valencia, Spain

      8:    This file is part of SLEPc.

     10:    SLEPc is free software: you can redistribute it and/or modify it under  the
     11:    terms of version 3 of the GNU Lesser General Public License as published by
     12:    the Free Software Foundation.

     14:    SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
     15:    WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
     16:    FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
     17:    more details.

     19:    You  should have received a copy of the GNU Lesser General  Public  License
     20:    along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
     21:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     22: */

     26: #include <slepceps.h>

     28: PETSC_EXTERN PetscErrorCode PEPInitializePackage(void);

     30: /*S
     31:      PEP - Abstract SLEPc object that manages all the polynomial eigenvalue
     32:      problem solvers.

     34:    Level: beginner

     36: .seealso:  PEPCreate()
     37: S*/
     38: typedef struct _p_PEP* PEP;

     40: /*J
     41:     PEPType - String with the name of a polynomial eigensolver

     43:    Level: beginner

     45: .seealso: PEPSetType(), PEP
     46: J*/
     47: typedef const char* PEPType;
     48: #define PEPLINEAR    "linear"
     49: #define PEPQARNOLDI  "qarnoldi"
     50: #define PEPTOAR      "toar"
     51: #define PEPSTOAR     "stoar"
     52: #define PEPJD        "jd"

     54: /* Logging support */
     55: PETSC_EXTERN PetscClassId PEP_CLASSID;

     57: /*E
     58:     PEPProblemType - Determines the type of the polynomial eigenproblem

     60:     Level: intermediate

     62: .seealso: PEPSetProblemType(), PEPGetProblemType()
     63: E*/
     64: typedef enum { PEP_GENERAL=1,
     65:                PEP_HERMITIAN,   /* All A_i  Hermitian */
     66:                PEP_GYROSCOPIC   /* QEP with M, K  Hermitian, M>0, C skew-Hermitian */
     67:              } PEPProblemType;

     69: /*E
     70:     PEPWhich - Determines which part of the spectrum is requested

     72:     Level: intermediate

     74: .seealso: PEPSetWhichEigenpairs(), PEPGetWhichEigenpairs()
     75: E*/
     76: typedef enum { PEP_LARGEST_MAGNITUDE=1,
     77:                PEP_SMALLEST_MAGNITUDE,
     78:                PEP_LARGEST_REAL,
     79:                PEP_SMALLEST_REAL,
     80:                PEP_LARGEST_IMAGINARY,
     81:                PEP_SMALLEST_IMAGINARY,
     82:                PEP_TARGET_MAGNITUDE,
     83:                PEP_TARGET_REAL,
     84:                PEP_TARGET_IMAGINARY,
     85:                PEP_WHICH_USER } PEPWhich;

     87: /*E
     88:     PEPBasis - The type of polynomial basis used to represent the polynomial
     89:     eigenproblem

     91:     Level: intermediate

     93: .seealso: PEPSetBasis()
     94: E*/
     95: typedef enum { PEP_BASIS_MONOMIAL,
     96:                PEP_BASIS_CHEBYSHEV1,
     97:                PEP_BASIS_CHEBYSHEV2,
     98:                PEP_BASIS_LEGENDRE,
     99:                PEP_BASIS_LAGUERRE,
    100:                PEP_BASIS_HERMITE } PEPBasis;
    101: PETSC_EXTERN const char *PEPBasisTypes[];

    103: /*E
    104:     PEPScale - The scaling strategy

    106:     Level: intermediate

    108: .seealso: PEPSetScale()
    109: E*/
    110: typedef enum { PEP_SCALE_NONE,
    111:                PEP_SCALE_SCALAR,
    112:                PEP_SCALE_DIAGONAL,
    113:                PEP_SCALE_BOTH } PEPScale;
    114: PETSC_EXTERN const char *PEPScaleTypes[];

    116: /*E
    117:     PEPRefine - The refinement type

    119:     Level: intermediate

    121: .seealso: PEPSetRefine()
    122: E*/
    123: typedef enum { PEP_REFINE_NONE,
    124:                PEP_REFINE_SIMPLE,
    125:                PEP_REFINE_MULTIPLE } PEPRefine;
    126: PETSC_EXTERN const char *PEPRefineTypes[];

    128: /*E
    129:     PEPRefineScheme - The scheme used for solving linear systems during iterative refinement

    131:     Level: intermediate

    133: .seealso: PEPSetRefine()
    134: E*/
    135: typedef enum { PEP_REFINE_SCHEME_SCHUR=1,
    136:                PEP_REFINE_SCHEME_MBE,
    137:                PEP_REFINE_SCHEME_EXPLICIT } PEPRefineScheme;
    138: PETSC_EXTERN const char *PEPRefineSchemes[];

    140: /*E
    141:     PEPExtract - The extraction type

    143:     Level: intermediate

    145: .seealso: PEPSetExtract()
    146: E*/
    147: typedef enum { PEP_EXTRACT_NONE=1,
    148:                PEP_EXTRACT_NORM,
    149:                PEP_EXTRACT_RESIDUAL,
    150:                PEP_EXTRACT_STRUCTURED } PEPExtract;
    151: PETSC_EXTERN const char *PEPExtractTypes[];

    153: /*E
    154:     PEPErrorType - The error type used to assess accuracy of computed solutions

    156:     Level: intermediate

    158: .seealso: PEPComputeError()
    159: E*/
    160: typedef enum { PEP_ERROR_ABSOLUTE,
    161:                PEP_ERROR_RELATIVE,
    162:                PEP_ERROR_BACKWARD } PEPErrorType;
    163: PETSC_EXTERN const char *PEPErrorTypes[];

    165: /*E
    166:     PEPConv - Determines the convergence test

    168:     Level: intermediate

    170: .seealso: PEPSetConvergenceTest(), PEPSetConvergenceTestFunction()
    171: E*/
    172: typedef enum { PEP_CONV_ABS,
    173:                PEP_CONV_REL,
    174:                PEP_CONV_NORM,
    175:                PEP_CONV_USER } PEPConv;

    177: /*E
    178:     PEPStop - Determines the stopping test

    180:     Level: advanced

    182: .seealso: PEPSetStoppingTest(), PEPSetStoppingTestFunction()
    183: E*/
    184: typedef enum { PEP_STOP_BASIC,
    185:                PEP_STOP_USER } PEPStop;

    187: /*E
    188:     PEPConvergedReason - Reason an eigensolver was said to
    189:          have converged or diverged

    191:     Level: intermediate

    193: .seealso: PEPSolve(), PEPGetConvergedReason(), PEPSetTolerances()
    194: E*/
    195: typedef enum {/* converged */
    196:               PEP_CONVERGED_TOL                =  1,
    197:               PEP_CONVERGED_USER               =  2,
    198:               /* diverged */
    199:               PEP_DIVERGED_ITS                 = -1,
    200:               PEP_DIVERGED_BREAKDOWN           = -2,
    201:               PEP_DIVERGED_SYMMETRY_LOST       = -3,
    202:               PEP_CONVERGED_ITERATING          =  0} PEPConvergedReason;
    203: PETSC_EXTERN const char *const*PEPConvergedReasons;

    205: PETSC_EXTERN PetscErrorCode PEPCreate(MPI_Comm,PEP*);
    206: PETSC_EXTERN PetscErrorCode PEPDestroy(PEP*);
    207: PETSC_EXTERN PetscErrorCode PEPReset(PEP);
    208: PETSC_EXTERN PetscErrorCode PEPSetType(PEP,PEPType);
    209: PETSC_EXTERN PetscErrorCode PEPGetType(PEP,PEPType*);
    210: PETSC_EXTERN PetscErrorCode PEPSetProblemType(PEP,PEPProblemType);
    211: PETSC_EXTERN PetscErrorCode PEPGetProblemType(PEP,PEPProblemType*);
    212: PETSC_EXTERN PetscErrorCode PEPSetOperators(PEP,PetscInt,Mat[]);
    213: PETSC_EXTERN PetscErrorCode PEPGetOperators(PEP,PetscInt,Mat*);
    214: PETSC_EXTERN PetscErrorCode PEPGetNumMatrices(PEP,PetscInt*);
    215: PETSC_EXTERN PetscErrorCode PEPSetTarget(PEP,PetscScalar);
    216: PETSC_EXTERN PetscErrorCode PEPGetTarget(PEP,PetscScalar*);
    217: PETSC_EXTERN PetscErrorCode PEPSetFromOptions(PEP);
    218: PETSC_EXTERN PetscErrorCode PEPSetUp(PEP);
    219: PETSC_EXTERN PetscErrorCode PEPSolve(PEP);
    220: PETSC_EXTERN PetscErrorCode PEPView(PEP,PetscViewer);
    221: PETSC_STATIC_INLINE PetscErrorCode PEPViewFromOptions(PEP pep,PetscObject obj,const char name[]) {return PetscObjectViewFromOptions((PetscObject)pep,obj,name);}
    222: PETSC_EXTERN PetscErrorCode PEPErrorView(PEP,PEPErrorType,PetscViewer);
    223: PETSC_DEPRECATED("Use PEPErrorView()") PETSC_STATIC_INLINE PetscErrorCode PEPPrintSolution(PEP pep,PetscViewer v) {return PEPErrorView(pep,PEP_ERROR_BACKWARD,v);}
    224: PETSC_EXTERN PetscErrorCode PEPErrorViewFromOptions(PEP);
    225: PETSC_EXTERN PetscErrorCode PEPReasonView(PEP,PetscViewer);
    226: PETSC_EXTERN PetscErrorCode PEPReasonViewFromOptions(PEP);
    227: PETSC_EXTERN PetscErrorCode PEPValuesView(PEP,PetscViewer);
    228: PETSC_EXTERN PetscErrorCode PEPValuesViewFromOptions(PEP);
    229: PETSC_EXTERN PetscErrorCode PEPVectorsView(PEP,PetscViewer);
    230: PETSC_EXTERN PetscErrorCode PEPVectorsViewFromOptions(PEP);
    231: PETSC_EXTERN PetscErrorCode PEPSetBV(PEP,BV);
    232: PETSC_EXTERN PetscErrorCode PEPGetBV(PEP,BV*);
    233: PETSC_EXTERN PetscErrorCode PEPSetRG(PEP,RG);
    234: PETSC_EXTERN PetscErrorCode PEPGetRG(PEP,RG*);
    235: PETSC_EXTERN PetscErrorCode PEPSetDS(PEP,DS);
    236: PETSC_EXTERN PetscErrorCode PEPGetDS(PEP,DS*);
    237: PETSC_EXTERN PetscErrorCode PEPSetST(PEP,ST);
    238: PETSC_EXTERN PetscErrorCode PEPGetST(PEP,ST*);
    239: PETSC_EXTERN PetscErrorCode PEPRefineGetKSP(PEP,KSP*);

    241: PETSC_EXTERN PetscErrorCode PEPSetTolerances(PEP,PetscReal,PetscInt);
    242: PETSC_EXTERN PetscErrorCode PEPGetTolerances(PEP,PetscReal*,PetscInt*);
    243: PETSC_EXTERN PetscErrorCode PEPSetConvergenceTestFunction(PEP,PetscErrorCode (*)(PEP,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*),void*,PetscErrorCode (*)(void*));
    244: PETSC_EXTERN PetscErrorCode PEPSetConvergenceTest(PEP,PEPConv);
    245: PETSC_EXTERN PetscErrorCode PEPGetConvergenceTest(PEP,PEPConv*);
    246: PETSC_EXTERN PetscErrorCode PEPConvergedAbsolute(PEP,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*);
    247: PETSC_EXTERN PetscErrorCode PEPConvergedRelative(PEP,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*);
    248: PETSC_EXTERN PetscErrorCode PEPConvergedNorm(PEP,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*);
    249: PETSC_EXTERN PetscErrorCode PEPSetStoppingTestFunction(PEP,PetscErrorCode (*)(PEP,PetscInt,PetscInt,PetscInt,PetscInt,PEPConvergedReason*,void*),void*,PetscErrorCode (*)(void*));
    250: PETSC_EXTERN PetscErrorCode PEPSetStoppingTest(PEP,PEPStop);
    251: PETSC_EXTERN PetscErrorCode PEPGetStoppingTest(PEP,PEPStop*);
    252: PETSC_EXTERN PetscErrorCode PEPStoppingBasic(PEP,PetscInt,PetscInt,PetscInt,PetscInt,PEPConvergedReason*,void*);
    253: PETSC_EXTERN PetscErrorCode PEPGetConvergedReason(PEP,PEPConvergedReason *);

    255: PETSC_EXTERN PetscErrorCode PEPSetDimensions(PEP,PetscInt,PetscInt,PetscInt);
    256: PETSC_EXTERN PetscErrorCode PEPGetDimensions(PEP,PetscInt*,PetscInt*,PetscInt*);
    257: PETSC_EXTERN PetscErrorCode PEPSetScale(PEP,PEPScale,PetscReal,Vec,Vec,PetscInt,PetscReal);
    258: PETSC_EXTERN PetscErrorCode PEPGetScale(PEP,PEPScale*,PetscReal*,Vec*,Vec*,PetscInt*,PetscReal*);
    259: PETSC_EXTERN PetscErrorCode PEPSetRefine(PEP,PEPRefine,PetscInt,PetscReal,PetscInt,PEPRefineScheme);
    260: PETSC_EXTERN PetscErrorCode PEPGetRefine(PEP,PEPRefine*,PetscInt*,PetscReal*,PetscInt*,PEPRefineScheme*);
    261: PETSC_EXTERN PetscErrorCode PEPSetExtract(PEP,PEPExtract);
    262: PETSC_EXTERN PetscErrorCode PEPGetExtract(PEP,PEPExtract*);
    263: PETSC_EXTERN PetscErrorCode PEPSetBasis(PEP,PEPBasis);
    264: PETSC_EXTERN PetscErrorCode PEPGetBasis(PEP,PEPBasis*);

    266: PETSC_EXTERN PetscErrorCode PEPGetConverged(PEP,PetscInt*);
    267: PETSC_EXTERN PetscErrorCode PEPGetEigenpair(PEP,PetscInt,PetscScalar*,PetscScalar*,Vec,Vec);
    268: PETSC_EXTERN PetscErrorCode PEPComputeError(PEP,PetscInt,PEPErrorType,PetscReal*);
    269: PETSC_DEPRECATED("Use PEPComputeError()") PETSC_STATIC_INLINE PetscErrorCode PEPComputeRelativeError(PEP pep,PetscInt i,PetscReal *r) {return PEPComputeError(pep,i,PEP_ERROR_BACKWARD,r);}
    270: PETSC_DEPRECATED("Use PEPComputeError() with PEP_ERROR_ABSOLUTE") PETSC_STATIC_INLINE PetscErrorCode PEPComputeResidualNorm(PEP pep,PetscInt i,PetscReal *r) {return PEPComputeError(pep,i,PEP_ERROR_ABSOLUTE,r);}
    271: PETSC_EXTERN PetscErrorCode PEPGetErrorEstimate(PEP,PetscInt,PetscReal*);

    273: PETSC_EXTERN PetscErrorCode PEPMonitor(PEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt);
    274: PETSC_EXTERN PetscErrorCode PEPMonitorSet(PEP,PetscErrorCode (*)(PEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*),void*,PetscErrorCode (*)(void**));
    275: PETSC_EXTERN PetscErrorCode PEPMonitorSetFromOptions(PEP,const char*,const char*,const char*,PetscErrorCode (*)(PEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,PetscViewerAndFormat*),PetscBool);
    276: PETSC_EXTERN PetscErrorCode PEPConvMonitorSetFromOptions(PEP,const char*,const char*,const char*,PetscErrorCode (*)(PEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,SlepcConvMonitor));
    277: PETSC_EXTERN PetscErrorCode PEPMonitorCancel(PEP);
    278: PETSC_EXTERN PetscErrorCode PEPGetMonitorContext(PEP,void **);
    279: PETSC_EXTERN PetscErrorCode PEPGetIterationNumber(PEP,PetscInt*);

    281: PETSC_EXTERN PetscErrorCode PEPSetInitialSpace(PEP,PetscInt,Vec*);
    282: PETSC_EXTERN PetscErrorCode PEPSetWhichEigenpairs(PEP,PEPWhich);
    283: PETSC_EXTERN PetscErrorCode PEPGetWhichEigenpairs(PEP,PEPWhich*);
    284: PETSC_EXTERN PetscErrorCode PEPSetEigenvalueComparison(PEP,PetscErrorCode (*func)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*),void*);

    286: PETSC_EXTERN PetscErrorCode PEPMonitorAll(PEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,PetscViewerAndFormat*);
    287: PETSC_EXTERN PetscErrorCode PEPMonitorFirst(PEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,PetscViewerAndFormat*);
    288: PETSC_EXTERN PetscErrorCode PEPMonitorConverged(PEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,SlepcConvMonitor);
    289: PETSC_EXTERN PetscErrorCode PEPMonitorLGCreate(MPI_Comm,const char[],const char[],int,int,int,int,PetscDrawLG*);
    290: PETSC_EXTERN PetscErrorCode PEPMonitorLG(PEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*);
    291: PETSC_EXTERN PetscErrorCode PEPMonitorLGAll(PEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*);

    293: PETSC_EXTERN PetscErrorCode PEPSetTrackAll(PEP,PetscBool);
    294: PETSC_EXTERN PetscErrorCode PEPGetTrackAll(PEP,PetscBool*);

    296: PETSC_EXTERN PetscErrorCode PEPSetOptionsPrefix(PEP,const char*);
    297: PETSC_EXTERN PetscErrorCode PEPAppendOptionsPrefix(PEP,const char*);
    298: PETSC_EXTERN PetscErrorCode PEPGetOptionsPrefix(PEP,const char*[]);

    300: PETSC_EXTERN PetscFunctionList PEPList;
    301: PETSC_EXTERN PetscErrorCode PEPRegister(const char[],PetscErrorCode(*)(PEP));

    303: PETSC_EXTERN PetscErrorCode PEPSetWorkVecs(PEP,PetscInt);
    304: PETSC_EXTERN PetscErrorCode PEPAllocateSolution(PEP,PetscInt);

    306: /* --------- options specific to particular eigensolvers -------- */

    308: PETSC_EXTERN PetscErrorCode PEPLinearSetCompanionForm(PEP,PetscInt);
    309: PETSC_EXTERN PetscErrorCode PEPLinearGetCompanionForm(PEP,PetscInt*);
    310: PETSC_EXTERN PetscErrorCode PEPLinearSetExplicitMatrix(PEP,PetscBool);
    311: PETSC_EXTERN PetscErrorCode PEPLinearGetExplicitMatrix(PEP,PetscBool*);
    312: PETSC_EXTERN PetscErrorCode PEPLinearSetEPS(PEP,EPS);
    313: PETSC_EXTERN PetscErrorCode PEPLinearGetEPS(PEP,EPS*);

    315: PETSC_EXTERN PetscErrorCode PEPQArnoldiSetRestart(PEP,PetscReal);
    316: PETSC_EXTERN PetscErrorCode PEPQArnoldiGetRestart(PEP,PetscReal*);
    317: PETSC_EXTERN PetscErrorCode PEPQArnoldiSetLocking(PEP,PetscBool);
    318: PETSC_EXTERN PetscErrorCode PEPQArnoldiGetLocking(PEP,PetscBool*);

    320: PETSC_EXTERN PetscErrorCode PEPTOARSetRestart(PEP,PetscReal);
    321: PETSC_EXTERN PetscErrorCode PEPTOARGetRestart(PEP,PetscReal*);
    322: PETSC_EXTERN PetscErrorCode PEPTOARSetLocking(PEP,PetscBool);
    323: PETSC_EXTERN PetscErrorCode PEPTOARGetLocking(PEP,PetscBool*);

    325: PETSC_EXTERN PetscErrorCode PEPSTOARSetLocking(PEP,PetscBool);
    326: PETSC_EXTERN PetscErrorCode PEPSTOARGetLocking(PEP,PetscBool*);

    328: PETSC_EXTERN PetscErrorCode PEPJDSetRestart(PEP,PetscReal);
    329: PETSC_EXTERN PetscErrorCode PEPJDGetRestart(PEP,PetscReal*);

    331: #endif