Subversion Repositories slepc-dev

Compare Revisions

Ignore whitespace Rev 2149 → Rev 2163

/tags/slepc-3_1-2/configure New file
0,0 → 1,0
link ./config/configure.py
slepc-3_1-2/configure Property changes : Added: svn:special
+ *
/tags/slepc-3_1-2/include/slepcqep.h New file
0,0 → 1,179
/*
User interface for SLEPc's quadratic eigenvalue solvers.
 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SLEPc - Scalable Library for Eigenvalue Problem Computations
Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
 
This file is part of SLEPc.
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/>.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
 
#if !defined(__SLEPCQEP_H)
#define __SLEPCQEP_H
#include "slepcsys.h"
#include "slepceps.h"
PETSC_EXTERN_CXX_BEGIN
 
extern PetscCookie QEP_COOKIE;
 
/*S
QEP - Abstract SLEPc object that manages all the quadratic eigenvalue
problem solvers.
 
Level: beginner
 
.seealso: QEPCreate()
S*/
typedef struct _p_QEP* QEP;
 
/*E
QEPType - String with the name of a quadratic eigensolver
 
Level: beginner
 
.seealso: QEPSetType(), QEP
E*/
#define QEPType char*
#define QEPLINEAR "linear"
#define QEPQARNOLDI "qarnoldi"
 
/*E
QEPProblemType - determines the type of the quadratic eigenproblem
 
Level: intermediate
 
.seealso: QEPSetProblemType(), QEPGetProblemType()
E*/
typedef enum { QEP_GENERAL=1,
QEP_HERMITIAN, /* M, C, K Hermitian */
QEP_GYROSCOPIC /* M, K Hermitian, M>0, C skew-Hermitian */
} QEPProblemType;
 
/*E
QEPWhich - determines which part of the spectrum is requested
 
Level: intermediate
 
.seealso: QEPSetWhichEigenpairs(), QEPGetWhichEigenpairs()
E*/
typedef enum { QEP_LARGEST_MAGNITUDE=1,
QEP_SMALLEST_MAGNITUDE,
QEP_LARGEST_REAL,
QEP_SMALLEST_REAL,
QEP_LARGEST_IMAGINARY,
QEP_SMALLEST_IMAGINARY } QEPWhich;
 
EXTERN PetscErrorCode QEPCreate(MPI_Comm,QEP*);
EXTERN PetscErrorCode QEPDestroy(QEP);
EXTERN PetscErrorCode QEPSetType(QEP,const QEPType);
EXTERN PetscErrorCode QEPGetType(QEP,const QEPType*);
EXTERN PetscErrorCode QEPSetProblemType(QEP,QEPProblemType);
EXTERN PetscErrorCode QEPGetProblemType(QEP,QEPProblemType*);
EXTERN PetscErrorCode QEPSetOperators(QEP,Mat,Mat,Mat);
EXTERN PetscErrorCode QEPGetOperators(QEP,Mat*,Mat*,Mat*);
EXTERN PetscErrorCode QEPSetFromOptions(QEP);
EXTERN PetscErrorCode QEPSetUp(QEP);
EXTERN PetscErrorCode QEPSolve(QEP);
EXTERN PetscErrorCode QEPView(QEP,PetscViewer);
 
EXTERN PetscErrorCode QEPSetIP(QEP,IP);
EXTERN PetscErrorCode QEPGetIP(QEP,IP*);
EXTERN PetscErrorCode QEPSetTolerances(QEP,PetscReal,PetscInt);
EXTERN PetscErrorCode QEPGetTolerances(QEP,PetscReal*,PetscInt*);
EXTERN PetscErrorCode QEPSetConvergenceTest(QEP,PetscErrorCode (*)(QEP,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*),void*);
EXTERN PetscErrorCode QEPDefaultConverged(QEP,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*);
EXTERN PetscErrorCode QEPAbsoluteConverged(QEP,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*);
EXTERN PetscErrorCode QEPSetDimensions(QEP,PetscInt,PetscInt,PetscInt);
EXTERN PetscErrorCode QEPGetDimensions(QEP,PetscInt*,PetscInt*,PetscInt*);
EXTERN PetscErrorCode QEPSetScaleFactor(QEP,PetscReal);
EXTERN PetscErrorCode QEPGetScaleFactor(QEP,PetscReal*);
 
EXTERN PetscErrorCode QEPGetConverged(QEP,PetscInt*);
EXTERN PetscErrorCode QEPGetEigenpair(QEP,PetscInt,PetscScalar*,PetscScalar*,Vec,Vec);
EXTERN PetscErrorCode QEPComputeRelativeError(QEP,PetscInt,PetscReal*);
EXTERN PetscErrorCode QEPComputeResidualNorm(QEP,PetscInt,PetscReal*);
EXTERN PetscErrorCode QEPGetErrorEstimate(QEP,PetscInt,PetscReal*);
 
EXTERN PetscErrorCode QEPMonitorSet(QEP,PetscErrorCode (*)(QEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*),
void*,PetscErrorCode (*monitordestroy)(void*));
EXTERN PetscErrorCode QEPMonitorCancel(QEP);
EXTERN PetscErrorCode QEPGetMonitorContext(QEP,void **);
EXTERN PetscErrorCode QEPGetIterationNumber(QEP,PetscInt*);
EXTERN PetscErrorCode QEPGetOperationCounters(QEP,PetscInt*,PetscInt*,PetscInt*);
 
EXTERN PetscErrorCode QEPSetInitialSpace(QEP,PetscInt,Vec*);
EXTERN PetscErrorCode QEPSetInitialSpaceLeft(QEP,PetscInt,Vec*);
EXTERN PetscErrorCode QEPSetWhichEigenpairs(QEP,QEPWhich);
EXTERN PetscErrorCode QEPGetWhichEigenpairs(QEP,QEPWhich*);
EXTERN PetscErrorCode QEPSetLeftVectorsWanted(QEP,PetscTruth);
EXTERN PetscErrorCode QEPGetLeftVectorsWanted(QEP,PetscTruth*);
EXTERN PetscErrorCode QEPSetEigenvalueComparison(QEP,PetscErrorCode (*func)(QEP,PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*),void*);
 
EXTERN PetscErrorCode QEPMonitorAll(QEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*);
EXTERN PetscErrorCode QEPMonitorFirst(QEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*);
EXTERN PetscErrorCode QEPMonitorConverged(QEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*);
EXTERN PetscErrorCode QEPMonitorLG(QEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*);
EXTERN PetscErrorCode QEPMonitorLGAll(QEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*);
 
EXTERN PetscErrorCode QEPSetTrackAll(QEP,PetscTruth);
EXTERN PetscErrorCode QEPGetTrackAll(QEP,PetscTruth*);
 
EXTERN PetscErrorCode QEPSetOptionsPrefix(QEP,const char*);
EXTERN PetscErrorCode QEPAppendOptionsPrefix(QEP,const char*);
EXTERN PetscErrorCode QEPGetOptionsPrefix(QEP,const char*[]);
 
/*E
QEPConvergedReason - reason an eigensolver was said to
have converged or diverged
 
Level: beginner
 
.seealso: QEPSolve(), QEPGetConvergedReason(), QEPSetTolerances()
E*/
typedef enum {/* converged */
QEP_CONVERGED_TOL = 2,
/* diverged */
QEP_DIVERGED_ITS = -3,
QEP_DIVERGED_BREAKDOWN = -4,
QEP_CONVERGED_ITERATING = 0} QEPConvergedReason;
 
EXTERN PetscErrorCode QEPGetConvergedReason(QEP,QEPConvergedReason *);
 
EXTERN PetscErrorCode QEPSortEigenvalues(QEP,PetscInt,PetscScalar*,PetscScalar*,PetscInt*);
EXTERN PetscErrorCode QEPSortEigenvaluesReal(QEP,PetscInt,PetscReal*,PetscInt*);
EXTERN PetscErrorCode QEPCompareEigenvalues(QEP,PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*);
EXTERN PetscErrorCode QEPSortDenseSchur(QEP,PetscInt,PetscInt,PetscScalar*,PetscInt,PetscScalar*,PetscScalar*,PetscScalar*);
 
EXTERN PetscErrorCode QEPRegister(const char*,const char*,const char*,PetscErrorCode(*)(QEP));
#if defined(PETSC_USE_DYNAMIC_LIBRARIES)
#define QEPRegisterDynamic(a,b,c,d) QEPRegister(a,b,c,0)
#else
#define QEPRegisterDynamic(a,b,c,d) QEPRegister(a,b,c,d)
#endif
EXTERN PetscErrorCode QEPRegisterDestroy(void);
 
/* --------- options specific to particular eigensolvers -------- */
 
EXTERN PetscErrorCode QEPLinearSetCompanionForm(QEP,PetscInt);
EXTERN PetscErrorCode QEPLinearGetCompanionForm(QEP,PetscInt*);
EXTERN PetscErrorCode QEPLinearSetExplicitMatrix(QEP,PetscTruth);
EXTERN PetscErrorCode QEPLinearGetExplicitMatrix(QEP,PetscTruth*);
EXTERN PetscErrorCode QEPLinearSetEPS(QEP,EPS);
EXTERN PetscErrorCode QEPLinearGetEPS(QEP,EPS*);
 
PETSC_EXTERN_CXX_END
#endif
 
/tags/slepc-3_1-2/include/slepcversion.h New file
0,0 → 1,22
#if !defined(__SLEPCVERSION_H)
#define __SLEPCVERSION_H
 
#define SLEPC_VERSION_RELEASE 1
#define SLEPC_VERSION_MAJOR 3
#define SLEPC_VERSION_MINOR 1
#define SLEPC_VERSION_SUBMINOR 0
#define SLEPC_VERSION_PATCH 2
#define SLEPC_VERSION_DATE "August 4, 2010"
#define SLEPC_VERSION_PATCH_DATE "September 1, 2010"
#define SLEPC_AUTHOR_INFO " The SLEPc Team\n\
slepc-maint@grycap.upv.es\n\
http://www.grycap.upv.es/slepc\n"
 
#define SLEPC_VERSION_(MAJOR,MINOR,SUBMINOR) \
((SLEPC_VERSION_MAJOR == (MAJOR)) && \
(SLEPC_VERSION_MINOR == (MINOR)) && \
(SLEPC_VERSION_SUBMINOR == (SUBMINOR)) && \
(SLEPC_VERSION_RELEASE == 1))
 
#endif
 
slepc-3_1-2/include/slepcversion.h Property changes : Added: svn:eol-style
+ native
/tags/slepc-3_1-2/include/slepcst.h New file
0,0 → 1,134
/*
Spectral transformation module for eigenvalue problems.
 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SLEPc - Scalable Library for Eigenvalue Problem Computations
Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
 
This file is part of SLEPc.
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/>.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
 
#if !defined(__SLEPCST_H)
#define __SLEPCST_H
#include "petscksp.h"
PETSC_EXTERN_CXX_BEGIN
 
extern PetscCookie ST_COOKIE;
 
/*S
ST - Abstract SLEPc object that manages spectral transformations.
This object is accessed only in advanced applications.
 
Level: beginner
 
.seealso: STCreate(), EPS
S*/
typedef struct _p_ST* ST;
 
/*E
STType - String with the name of a SLEPc spectral transformation
 
Level: beginner
 
.seealso: STSetType(), ST
E*/
#define STType char*
#define STSHELL "shell"
#define STSHIFT "shift"
#define STSINVERT "sinvert"
#define STCAYLEY "cayley"
#define STFOLD "fold"
#define STPRECOND "precond"
 
EXTERN PetscErrorCode STCreate(MPI_Comm,ST*);
EXTERN PetscErrorCode STDestroy(ST);
EXTERN PetscErrorCode STSetType(ST,const STType);
EXTERN PetscErrorCode STGetType(ST,const STType*);
EXTERN PetscErrorCode STSetOperators(ST,Mat,Mat);
EXTERN PetscErrorCode STGetOperators(ST,Mat*,Mat*);
EXTERN PetscErrorCode STSetUp(ST);
EXTERN PetscErrorCode STSetFromOptions(ST);
EXTERN PetscErrorCode STView(ST,PetscViewer);
 
EXTERN PetscErrorCode STApply(ST,Vec,Vec);
EXTERN PetscErrorCode STGetBilinearForm(ST,Mat*);
EXTERN PetscErrorCode STApplyTranspose(ST,Vec,Vec);
EXTERN PetscErrorCode STComputeExplicitOperator(ST,Mat*);
EXTERN PetscErrorCode STPostSolve(ST);
 
EXTERN PetscErrorCode STSetKSP(ST,KSP);
EXTERN PetscErrorCode STGetKSP(ST,KSP*);
EXTERN PetscErrorCode STSetShift(ST,PetscScalar);
EXTERN PetscErrorCode STGetShift(ST,PetscScalar*);
EXTERN PetscErrorCode STSetDefaultShift(ST,PetscScalar);
EXTERN PetscErrorCode STSetBalanceMatrix(ST,Vec);
EXTERN PetscErrorCode STGetBalanceMatrix(ST,Vec*);
 
EXTERN PetscErrorCode STSetOptionsPrefix(ST,const char*);
EXTERN PetscErrorCode STAppendOptionsPrefix(ST,const char*);
EXTERN PetscErrorCode STGetOptionsPrefix(ST,const char*[]);
 
EXTERN PetscErrorCode STBackTransform(ST,PetscInt,PetscScalar*,PetscScalar*);
 
EXTERN PetscErrorCode STCheckNullSpace(ST,PetscInt,const Vec[]);
 
EXTERN PetscErrorCode STGetOperationCounters(ST,PetscInt*,PetscInt*);
EXTERN PetscErrorCode STResetOperationCounters(ST);
 
/*E
STMatMode - determines how to handle the coefficient matrix associated
to the spectral transformation
 
Level: intermediate
 
.seealso: STSetMatMode(), STGetMatMode()
E*/
typedef enum { ST_MATMODE_COPY,
ST_MATMODE_INPLACE,
ST_MATMODE_SHELL } STMatMode;
EXTERN PetscErrorCode STSetMatMode(ST,STMatMode);
EXTERN PetscErrorCode STGetMatMode(ST,STMatMode*);
EXTERN PetscErrorCode STSetMatStructure(ST,MatStructure);
EXTERN PetscErrorCode STGetMatStructure(ST,MatStructure*);
 
EXTERN PetscErrorCode STRegister(const char*,const char*,const char*,PetscErrorCode(*)(ST));
#if defined(PETSC_USE_DYNAMIC_LIBRARIES)
#define STRegisterDynamic(a,b,c,d) STRegister(a,b,c,0)
#else
#define STRegisterDynamic(a,b,c,d) STRegister(a,b,c,d)
#endif
EXTERN PetscErrorCode STRegisterDestroy(void);
 
/* --------- options specific to particular spectral transformations-------- */
 
EXTERN PetscErrorCode STShellGetContext(ST st,void **ctx);
EXTERN PetscErrorCode STShellSetContext(ST st,void *ctx);
EXTERN PetscErrorCode STShellSetApply(ST st,PetscErrorCode (*apply)(ST,Vec,Vec));
EXTERN PetscErrorCode STShellSetApplyTranspose(ST st,PetscErrorCode (*applytrans)(ST,Vec,Vec));
EXTERN PetscErrorCode STShellSetBackTransform(ST st,PetscErrorCode (*backtr)(ST,PetscInt,PetscScalar*,PetscScalar*));
EXTERN PetscErrorCode STShellSetName(ST,const char[]);
EXTERN PetscErrorCode STShellGetName(ST,char*[]);
 
EXTERN PetscErrorCode STCayleySetAntishift(ST,PetscScalar);
 
EXTERN PetscErrorCode STPrecondGetMatForPC(ST st,Mat *mat);
EXTERN PetscErrorCode STPrecondSetMatForPC(ST st,Mat mat);
EXTERN PetscErrorCode STPrecondGetKSPHasMat(ST st,PetscTruth *setmat);
EXTERN PetscErrorCode STPrecondSetKSPHasMat(ST st,PetscTruth setmat);
 
PETSC_EXTERN_CXX_END
#endif
 
slepc-3_1-2/include/slepcst.h Property changes : Added: svn:eol-style
+ native
/tags/slepc-3_1-2/include/slepceps.h New file
0,0 → 1,355
/*
User interface for the SLEPC eigenproblem solvers.
 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SLEPc - Scalable Library for Eigenvalue Problem Computations
Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
 
This file is part of SLEPc.
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/>.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
 
#if !defined(__SLEPCEPS_H)
#define __SLEPCEPS_H
#include "slepcsys.h"
#include "slepcst.h"
#include "slepcip.h"
PETSC_EXTERN_CXX_BEGIN
 
extern PetscCookie EPS_COOKIE;
 
/*S
EPS - Abstract SLEPc object that manages all the eigenvalue
problem solvers.
 
Level: beginner
 
.seealso: EPSCreate(), ST
S*/
typedef struct _p_EPS* EPS;
 
/*E
EPSType - String with the name of a SLEPc eigensolver
 
Level: beginner
 
.seealso: EPSSetType(), EPS
E*/
#define EPSType char*
#define EPSPOWER "power"
#define EPSSUBSPACE "subspace"
#define EPSARNOLDI "arnoldi"
#define EPSLANCZOS "lanczos"
#define EPSKRYLOVSCHUR "krylovschur"
#define EPSGD "gd"
#define EPSJD "jd"
#define EPSLAPACK "lapack"
/* the next ones are interfaces to external libraries */
#define EPSARPACK "arpack"
#define EPSBLZPACK "blzpack"
#define EPSTRLAN "trlan"
#define EPSBLOPEX "blopex"
#define EPSPRIMME "primme"
 
/*E
EPSProblemType - determines the type of eigenvalue problem
 
Level: beginner
 
.seealso: EPSSetProblemType(), EPSGetProblemType()
E*/
typedef enum { EPS_HEP=1,
EPS_GHEP,
EPS_NHEP,
EPS_GNHEP,
EPS_PGNHEP } EPSProblemType;
 
/*E
EPSExtraction - determines the type of extraction technique employed
by the eigensolver
 
Level: beginner
 
.seealso: EPSSetExtraction(), EPSGetExtraction()
E*/
typedef enum { EPS_RITZ=1,
EPS_HARMONIC,
EPS_HARMONIC_RELATIVE,
EPS_HARMONIC_RIGHT,
EPS_HARMONIC_LARGEST,
EPS_REFINED,
EPS_REFINED_HARMONIC } EPSExtraction;
 
/*E
EPSWhich - determines which part of the spectrum is requested
 
Level: intermediate
 
.seealso: EPSSetWhichEigenpairs(), EPSGetWhichEigenpairs()
E*/
typedef enum { EPS_LARGEST_MAGNITUDE=1,
EPS_SMALLEST_MAGNITUDE,
EPS_LARGEST_REAL,
EPS_SMALLEST_REAL,
EPS_LARGEST_IMAGINARY,
EPS_SMALLEST_IMAGINARY,
EPS_TARGET_MAGNITUDE,
EPS_TARGET_REAL,
EPS_TARGET_IMAGINARY,
EPS_WHICH_USER } EPSWhich;
 
/*E
EPSBalance - the type of balancing used for non-Hermitian problems
 
Level: intermediate
 
.seealso: EPSSetBalance()
E*/
typedef enum { EPS_BALANCE_NONE=1,
EPS_BALANCE_ONESIDE,
EPS_BALANCE_TWOSIDE,
EPS_BALANCE_USER } EPSBalance;
 
/*E
EPSConv - determines the convergence test
 
Level: intermediate
 
.seealso: EPSSetConvergenceTest(), EPSSetConvergenceTestFunction()
E*/
typedef enum { EPS_CONV_ABS=1,
EPS_CONV_EIG,
EPS_CONV_NORM,
EPS_CONV_USER } EPSConv;
 
EXTERN PetscErrorCode EPSCreate(MPI_Comm,EPS *);
EXTERN PetscErrorCode EPSDestroy(EPS);
EXTERN PetscErrorCode EPSSetType(EPS,const EPSType);
EXTERN PetscErrorCode EPSGetType(EPS,const EPSType*);
EXTERN PetscErrorCode EPSSetProblemType(EPS,EPSProblemType);
EXTERN PetscErrorCode EPSGetProblemType(EPS,EPSProblemType*);
EXTERN PetscErrorCode EPSSetExtraction(EPS,EPSExtraction);
EXTERN PetscErrorCode EPSGetExtraction(EPS,EPSExtraction*);
EXTERN PetscErrorCode EPSSetBalance(EPS,EPSBalance,PetscInt,PetscReal);
EXTERN PetscErrorCode EPSGetBalance(EPS,EPSBalance*,PetscInt*,PetscReal*);
EXTERN PetscErrorCode EPSSetOperators(EPS,Mat,Mat);
EXTERN PetscErrorCode EPSGetOperators(EPS,Mat*,Mat*);
EXTERN PetscErrorCode EPSSetFromOptions(EPS);
EXTERN PetscErrorCode EPSSetUp(EPS);
EXTERN PetscErrorCode EPSSolve(EPS);
EXTERN PetscErrorCode EPSView(EPS,PetscViewer);
 
EXTERN PetscErrorCode EPSSetTarget(EPS,PetscScalar);
EXTERN PetscErrorCode EPSGetTarget(EPS,PetscScalar*);
EXTERN PetscErrorCode EPSSetST(EPS,ST);
EXTERN PetscErrorCode EPSGetST(EPS,ST*);
EXTERN PetscErrorCode EPSSetIP(EPS,IP);
EXTERN PetscErrorCode EPSGetIP(EPS,IP*);
EXTERN PetscErrorCode EPSSetTolerances(EPS,PetscReal,PetscInt);
EXTERN PetscErrorCode EPSGetTolerances(EPS,PetscReal*,PetscInt*);
EXTERN PetscErrorCode EPSSetConvergenceTestFunction(EPS,PetscErrorCode (*)(EPS,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*),void*);
EXTERN PetscErrorCode EPSSetConvergenceTest(EPS eps,EPSConv conv);
EXTERN PetscErrorCode EPSGetConvergenceTest(EPS eps,EPSConv *conv);
EXTERN PetscErrorCode EPSEigRelativeConverged(EPS,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*);
EXTERN PetscErrorCode EPSAbsoluteConverged(EPS,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*);
EXTERN PetscErrorCode EPSNormRelativeConverged(EPS,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*);
EXTERN PetscErrorCode EPSSetDimensions(EPS,PetscInt,PetscInt,PetscInt);
EXTERN PetscErrorCode EPSGetDimensions(EPS,PetscInt*,PetscInt*,PetscInt*);
 
EXTERN PetscErrorCode EPSGetConverged(EPS,PetscInt*);
EXTERN PetscErrorCode EPSGetEigenpair(EPS,PetscInt,PetscScalar*,PetscScalar*,Vec,Vec);
EXTERN PetscErrorCode EPSGetEigenvalue(EPS,PetscInt,PetscScalar*,PetscScalar*);
EXTERN PetscErrorCode EPSGetEigenvector(EPS,PetscInt,Vec,Vec);
EXTERN PetscErrorCode EPSGetEigenvectorLeft(EPS,PetscInt,Vec,Vec);
EXTERN PetscErrorCode EPSComputeRelativeError(EPS,PetscInt,PetscReal*);
EXTERN PetscErrorCode EPSComputeRelativeErrorLeft(EPS,PetscInt,PetscReal*);
EXTERN PetscErrorCode EPSComputeResidualNorm(EPS,PetscInt,PetscReal*);
EXTERN PetscErrorCode EPSComputeResidualNormLeft(EPS,PetscInt,PetscReal*);
EXTERN PetscErrorCode EPSGetInvariantSubspace(EPS,Vec*);
EXTERN PetscErrorCode EPSGetInvariantSubspaceLeft(EPS,Vec*);
EXTERN PetscErrorCode EPSGetErrorEstimate(EPS,PetscInt,PetscReal*);
EXTERN PetscErrorCode EPSGetErrorEstimateLeft(EPS,PetscInt,PetscReal*);
 
EXTERN PetscErrorCode EPSMonitorSet(EPS,PetscErrorCode (*)(EPS,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*),
void*,PetscErrorCode (*monitordestroy)(void*));
EXTERN PetscErrorCode EPSMonitorCancel(EPS);
EXTERN PetscErrorCode EPSGetMonitorContext(EPS,void **);
EXTERN PetscErrorCode EPSGetIterationNumber(EPS,PetscInt*);
EXTERN PetscErrorCode EPSGetOperationCounters(EPS,PetscInt*,PetscInt*,PetscInt*);
 
EXTERN PetscErrorCode EPSSetWhichEigenpairs(EPS,EPSWhich);
EXTERN PetscErrorCode EPSGetWhichEigenpairs(EPS,EPSWhich*);
EXTERN PetscErrorCode EPSSetLeftVectorsWanted(EPS,PetscTruth);
EXTERN PetscErrorCode EPSGetLeftVectorsWanted(EPS,PetscTruth*);
EXTERN PetscErrorCode EPSSetMatrixNorms(EPS,PetscReal,PetscReal,PetscTruth);
EXTERN PetscErrorCode EPSGetMatrixNorms(EPS,PetscReal*,PetscReal*,PetscTruth*);
EXTERN PetscErrorCode EPSSetTrueResidual(EPS,PetscTruth);
EXTERN PetscErrorCode EPSGetTrueResidual(EPS,PetscTruth*);
EXTERN PetscErrorCode EPSSetEigenvalueComparison(EPS,PetscErrorCode (*func)(EPS,PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*),void*);
EXTERN PetscErrorCode EPSIsGeneralized(EPS,PetscTruth*);
EXTERN PetscErrorCode EPSIsHermitian(EPS,PetscTruth*);
 
EXTERN PetscErrorCode EPSMonitorFirst(EPS,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*);
EXTERN PetscErrorCode EPSMonitorAll(EPS,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*);
EXTERN PetscErrorCode EPSMonitorConverged(EPS,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*);
EXTERN PetscErrorCode EPSMonitorLG(EPS,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*);
EXTERN PetscErrorCode EPSMonitorLGAll(EPS,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*);
 
EXTERN PetscErrorCode EPSSetTrackAll(EPS,PetscTruth);
EXTERN PetscErrorCode EPSGetTrackAll(EPS,PetscTruth*);
 
EXTERN PetscErrorCode EPSSetDeflationSpace(EPS,PetscInt,Vec*);
EXTERN PetscErrorCode EPSRemoveDeflationSpace(EPS);
EXTERN PetscErrorCode EPSSetInitialSpace(EPS,PetscInt,Vec*);
EXTERN PetscErrorCode EPSSetInitialSpaceLeft(EPS,PetscInt,Vec*);
 
EXTERN PetscErrorCode EPSSetOptionsPrefix(EPS,const char*);
EXTERN PetscErrorCode EPSAppendOptionsPrefix(EPS,const char*);
EXTERN PetscErrorCode EPSGetOptionsPrefix(EPS,const char*[]);
 
/*E
EPSConvergedReason - reason an eigensolver was said to
have converged or diverged
 
Level: beginner
 
.seealso: EPSSolve(), EPSGetConvergedReason(), EPSSetTolerances()
E*/
typedef enum {/* converged */
EPS_CONVERGED_TOL = 2,
/* diverged */
EPS_DIVERGED_ITS = -3,
EPS_DIVERGED_BREAKDOWN = -4,
EPS_DIVERGED_NONSYMMETRIC = -5,
EPS_CONVERGED_ITERATING = 0} EPSConvergedReason;
 
EXTERN PetscErrorCode EPSGetConvergedReason(EPS,EPSConvergedReason *);
 
EXTERN PetscErrorCode EPSSortEigenvalues(EPS,PetscInt,PetscScalar*,PetscScalar*,PetscInt*);
EXTERN PetscErrorCode EPSSortEigenvaluesReal(EPS,PetscInt,PetscReal*,PetscInt*);
EXTERN PetscErrorCode EPSCompareEigenvalues(EPS,PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*);
EXTERN PetscErrorCode EPSDenseNHEP(PetscInt,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*);
EXTERN PetscErrorCode EPSDenseGNHEP(PetscInt,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*);
EXTERN PetscErrorCode EPSDenseHEP(PetscInt,PetscScalar*,PetscInt,PetscReal*,PetscScalar*);
EXTERN PetscErrorCode EPSDenseGHEP(PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscScalar*);
EXTERN PetscErrorCode EPSDenseHessenberg(PetscInt,PetscInt,PetscScalar*,PetscInt,PetscScalar*);
EXTERN PetscErrorCode EPSDenseSchur(PetscInt,PetscInt,PetscScalar*,PetscInt,PetscScalar*,PetscScalar*,PetscScalar*);
EXTERN PetscErrorCode EPSSortDenseSchur(EPS,PetscInt,PetscInt,PetscScalar*,PetscInt,PetscScalar*,PetscScalar*,PetscScalar*);
EXTERN PetscErrorCode EPSSortDenseSchurGeneralized(EPS,PetscInt,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscInt,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*);
EXTERN PetscErrorCode EPSDenseTridiagonal(PetscInt,PetscReal*,PetscReal*,PetscReal*,PetscScalar*);
 
EXTERN PetscErrorCode EPSGetStartVector(EPS,PetscInt,Vec,PetscTruth*);
EXTERN PetscErrorCode EPSGetStartVectorLeft(EPS,PetscInt,Vec,PetscTruth*);
 
EXTERN PetscErrorCode EPSRegister(const char*,const char*,const char*,PetscErrorCode(*)(EPS));
#if defined(PETSC_USE_DYNAMIC_LIBRARIES)
#define EPSRegisterDynamic(a,b,c,d) EPSRegister(a,b,c,0)
#else
#define EPSRegisterDynamic(a,b,c,d) EPSRegister(a,b,c,d)
#endif
EXTERN PetscErrorCode EPSRegisterDestroy(void);
 
/* --------- options specific to particular eigensolvers -------- */
 
/*E
EPSPowerShiftType - determines the type of shift used in the Power iteration
 
Level: advanced
 
.seealso: EPSPowerSetShiftType(), EPSPowerGetShiftType()
E*/
typedef enum { EPS_POWER_SHIFT_CONSTANT,
EPS_POWER_SHIFT_RAYLEIGH,
EPS_POWER_SHIFT_WILKINSON } EPSPowerShiftType;
 
EXTERN PetscErrorCode EPSPowerSetShiftType(EPS,EPSPowerShiftType);
EXTERN PetscErrorCode EPSPowerGetShiftType(EPS,EPSPowerShiftType*);
 
EXTERN PetscErrorCode EPSArnoldiSetDelayed(EPS,PetscTruth);
EXTERN PetscErrorCode EPSArnoldiGetDelayed(EPS,PetscTruth*);
 
/*E
EPSLanczosReorthogType - determines the type of reorthogonalization
used in the Lanczos method
 
Level: advanced
 
.seealso: EPSLanczosSetReorthog(), EPSLanczosGetReorthog()
E*/
typedef enum { EPS_LANCZOS_REORTHOG_LOCAL,
EPS_LANCZOS_REORTHOG_FULL,
EPS_LANCZOS_REORTHOG_SELECTIVE,
EPS_LANCZOS_REORTHOG_PERIODIC,
EPS_LANCZOS_REORTHOG_PARTIAL,
EPS_LANCZOS_REORTHOG_DELAYED } EPSLanczosReorthogType;
 
EXTERN PetscErrorCode EPSLanczosSetReorthog(EPS,EPSLanczosReorthogType);
EXTERN PetscErrorCode EPSLanczosGetReorthog(EPS,EPSLanczosReorthogType*);
 
EXTERN PetscErrorCode EPSBlzpackSetBlockSize(EPS,PetscInt);
EXTERN PetscErrorCode EPSBlzpackSetInterval(EPS,PetscReal,PetscReal);
EXTERN PetscErrorCode EPSBlzpackSetNSteps(EPS,PetscInt);
 
/*E
EPSPRIMMEMethod - determines the method selected in the PRIMME library
 
Level: advanced
 
.seealso: EPSPRIMMESetMethod(), EPSPRIMMEGetMethod()
E*/
typedef enum { EPS_PRIMME_DYNAMIC,
EPS_PRIMME_DEFAULT_MIN_TIME,
EPS_PRIMME_DEFAULT_MIN_MATVECS,
EPS_PRIMME_ARNOLDI,
EPS_PRIMME_GD,
EPS_PRIMME_GD_PLUSK,
EPS_PRIMME_GD_OLSEN_PLUSK,
EPS_PRIMME_JD_OLSEN_PLUSK,
EPS_PRIMME_RQI,
EPS_PRIMME_JDQR,
EPS_PRIMME_JDQMR,
EPS_PRIMME_JDQMR_ETOL,
EPS_PRIMME_SUBSPACE_ITERATION,
EPS_PRIMME_LOBPCG_ORTHOBASIS,
EPS_PRIMME_LOBPCG_ORTHOBASISW } EPSPRIMMEMethod;
 
EXTERN PetscErrorCode EPSPRIMMESetBlockSize(EPS eps,PetscInt bs);
EXTERN PetscErrorCode EPSPRIMMESetMethod(EPS eps, EPSPRIMMEMethod method);
EXTERN PetscErrorCode EPSPRIMMEGetBlockSize(EPS eps,PetscInt *bs);
EXTERN PetscErrorCode EPSPRIMMEGetMethod(EPS eps, EPSPRIMMEMethod *method);
 
EXTERN PetscErrorCode EPSGDSetKrylovStart(EPS eps,PetscTruth krylovstart);
EXTERN PetscErrorCode EPSGDGetKrylovStart(EPS eps,PetscTruth *krylovstart);
EXTERN PetscErrorCode EPSGDSetBlockSize(EPS eps,PetscInt blocksize);
EXTERN PetscErrorCode EPSGDGetBlockSize(EPS eps,PetscInt *blocksize);
EXTERN PetscErrorCode EPSGDSetRestart(EPS eps,PetscInt minv,PetscInt plusk);
EXTERN PetscErrorCode EPSGDGetRestart(EPS eps,PetscInt *minv,PetscInt *plusk);
EXTERN PetscErrorCode EPSGDSetInitialSize(EPS eps,PetscInt initialsize);
EXTERN PetscErrorCode EPSGDGetInitialSize(EPS eps,PetscInt *initialsize);
 
EXTERN PetscErrorCode EPSJDSetKrylovStart(EPS eps,PetscTruth krylovstart);
EXTERN PetscErrorCode EPSJDGetKrylovStart(EPS eps,PetscTruth *krylovstart);
EXTERN PetscErrorCode EPSJDSetBlockSize(EPS eps,PetscInt blocksize);
EXTERN PetscErrorCode EPSJDGetBlockSize(EPS eps,PetscInt *blocksize);
EXTERN PetscErrorCode EPSJDSetRestart(EPS eps,PetscInt minv,PetscInt plusk);
EXTERN PetscErrorCode EPSJDGetRestart(EPS eps,PetscInt *minv,PetscInt *plusk);
EXTERN PetscErrorCode EPSJDSetInitialSize(EPS eps,PetscInt initialsize);
EXTERN PetscErrorCode EPSJDGetInitialSize(EPS eps,PetscInt *initialsize);
EXTERN PetscErrorCode EPSJDSetFix(EPS eps,PetscReal fix);
EXTERN PetscErrorCode EPSJDGetFix(EPS eps,PetscReal *fix);
 
PETSC_EXTERN_CXX_END
#endif
 
slepc-3_1-2/include/slepceps.h Property changes : Added: svn:eol-style
+ native
/tags/slepc-3_1-2/include/slepcip.h New file
0,0 → 1,104
/*
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SLEPc - Scalable Library for Eigenvalue Problem Computations
Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
 
This file is part of SLEPc.
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/>.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
 
#if !defined(__SLEPCIP_H)
#define __SLEPCIP_H
#include "slepcsys.h"
PETSC_EXTERN_CXX_BEGIN
 
extern PetscCookie IP_COOKIE;
 
/*E
IPOrthogonalizationType - determines what type of orthogonalization to use
 
Level: advanced
 
.seealso: IPSetOrthogonalization(), IPGetOrthogonalization(), IPOrthogonalize()
E*/
typedef enum { IP_ORTH_MGS,
IP_ORTH_CGS } IPOrthogonalizationType;
 
/*E
IPOrthogonalizationRefinementType - determines what type of refinement
to use during orthogonalization
 
Level: advanced
 
.seealso: IPSetOrthogonalization(), IPGetOrthogonalization(), IPOrthogonalize()
E*/
typedef enum { IP_ORTH_REFINE_NEVER,
IP_ORTH_REFINE_IFNEEDED,
IP_ORTH_REFINE_ALWAYS } IPOrthogonalizationRefinementType;
 
/*S
IP - Abstraction of a vector inner product, that can be defined
in different ways. Using this object is not required for application
programmers.
 
Level: beginner
 
.seealso: IPCreate()
S*/
typedef struct _p_IP* IP;
 
EXTERN PetscErrorCode IPInitializePackage(char *path);
EXTERN PetscErrorCode IPCreate(MPI_Comm,IP*);
EXTERN PetscErrorCode IPSetOptionsPrefix(IP,const char *);
EXTERN PetscErrorCode IPAppendOptionsPrefix(IP,const char *);
EXTERN PetscErrorCode IPGetOptionsPrefix(IP,const char *[]);
EXTERN PetscErrorCode IPSetFromOptions(IP);
EXTERN PetscErrorCode IPSetOrthogonalization(IP,IPOrthogonalizationType,IPOrthogonalizationRefinementType,PetscReal);
EXTERN PetscErrorCode IPGetOrthogonalization(IP,IPOrthogonalizationType*,IPOrthogonalizationRefinementType*,PetscReal*);
EXTERN PetscErrorCode IPView(IP,PetscViewer);
EXTERN PetscErrorCode IPDestroy(IP);
 
EXTERN PetscErrorCode IPOrthogonalize(IP,PetscInt,Vec*,PetscInt,PetscTruth*,Vec*,Vec,PetscScalar*,PetscReal*,PetscTruth*);
EXTERN PetscErrorCode IPBiOrthogonalize(IP,PetscInt,Vec*,Vec*,Vec,PetscScalar*,PetscReal*);
EXTERN PetscErrorCode IPQRDecomposition(IP,Vec*,PetscInt,PetscInt,PetscScalar*,PetscInt);
 
/*E
IPBilinearForm - determines the type of bilinear/sesquilinear form
 
Level: developer
 
.seealso: IPSetBilinearForm(), IPGetBilinearForm()
E*/
typedef enum { IP_INNER_HERMITIAN,
IP_INNER_SYMMETRIC } IPBilinearForm;
EXTERN PetscErrorCode IPSetBilinearForm(IP,Mat,IPBilinearForm);
EXTERN PetscErrorCode IPGetBilinearForm(IP,Mat*,IPBilinearForm*);
EXTERN PetscErrorCode IPApplyMatrix(IP,Vec,Vec);
 
EXTERN PetscErrorCode IPInnerProduct(IP ip,Vec,Vec,PetscScalar*);
EXTERN PetscErrorCode IPInnerProductBegin(IP ip,Vec,Vec,PetscScalar*);
EXTERN PetscErrorCode IPInnerProductEnd(IP ip,Vec,Vec,PetscScalar*);
EXTERN PetscErrorCode IPMInnerProduct(IP ip,Vec,PetscInt,const Vec[],PetscScalar*);
EXTERN PetscErrorCode IPMInnerProductBegin(IP ip,Vec,PetscInt,const Vec[],PetscScalar*);
EXTERN PetscErrorCode IPMInnerProductEnd(IP ip,Vec,PetscInt,const Vec[],PetscScalar*);
EXTERN PetscErrorCode IPNorm(IP ip,Vec,PetscReal*);
EXTERN PetscErrorCode IPNormBegin(IP ip,Vec,PetscReal*);
EXTERN PetscErrorCode IPNormEnd(IP ip,Vec,PetscReal*);
 
EXTERN PetscErrorCode IPGetOperationCounters(IP,PetscInt*);
EXTERN PetscErrorCode IPResetOperationCounters(IP);
 
PETSC_EXTERN_CXX_END
#endif
slepc-3_1-2/include/slepcip.h Property changes : Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
/tags/slepc-3_1-2/include/finclude/slepcqepdef.h New file
0,0 → 1,41
!
! Include file for Fortran use of the QEP object in SLEPc
!
!
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! SLEPc - Scalable Library for Eigenvalue Problem Computations
! Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
!
! This file is part of SLEPc.
!
! 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/>.
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
!
#if !defined(__SLEPCQEP_H)
#define __SLEPCQEP_H
 
#include "finclude/slepcipdef.h"
#include "finclude/slepcepsdef.h"
 
#if !defined(PETSC_USE_FORTRAN_DATATYPES)
#define QEP PetscFortranAddr
#endif
 
#define QEPType character*(80)
#define QEPProblemType PetscEnum
#define QEPWhich PetscEnum
#define QEPConvergedReason PetscEnum
 
#define QEPLINEAR 'linear'
 
#endif
/tags/slepc-3_1-2/include/finclude/slepcsvd.h90 New file
0,0 → 1,31
!
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! SLEPc - Scalable Library for Eigenvalue Problem Computations
! Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
!
! This file is part of SLEPc.
!
! 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/>.
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
!
!
!
! Additional SVD include file for use of SLEPc with Fortran 90/HPF
!
#include "finclude/ftn-custom/slepcsvd.h90"
#if defined(PETSC_USE_FORTRAN_INTERFACES)
interface
#include "finclude/ftn-auto/slepcsvd.h90"
end interface
#endif
 
slepc-3_1-2/include/finclude/slepcsvd.h90 Property changes : Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
/tags/slepc-3_1-2/include/finclude/slepcstdef.h New file
0,0 → 1,42
!
! Include file for Fortran use of the ST object in SLEPc
!
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! SLEPc - Scalable Library for Eigenvalue Problem Computations
! Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
!
! This file is part of SLEPc.
!
! 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/>.
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
!
#if !defined(__SLEPCST_H)
#define __SLEPCST_H
 
#include "finclude/petsckspdef.h"
 
#if !defined(PETSC_USE_FORTRAN_DATATYPES)
#define ST PetscFortranAddr
#endif
 
#define STType character*(80)
#define STMatMode PetscEnum
 
#define STSHELL 'shell'
#define STSHIFT 'shift'
#define STSINVERT 'sinvert'
#define STCAYLEY 'cayley'
#define STFOLD 'fold'
#define STPRECOND 'precond'
 
#endif
slepc-3_1-2/include/finclude/slepcstdef.h Property changes : Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
/tags/slepc-3_1-2/include/finclude/slepcepsdef.h New file
0,0 → 1,61
!
! Include file for Fortran use of the EPS object in SLEPc
!
!
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! SLEPc - Scalable Library for Eigenvalue Problem Computations
! Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
!
! This file is part of SLEPc.
!
! 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/>.
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
!
#if !defined(__SLEPCEPS_H)
#define __SLEPCEPS_H
 
#include "finclude/slepcstdef.h"
#include "finclude/slepcipdef.h"
 
#if !defined(PETSC_USE_FORTRAN_DATATYPES)
#define EPS PetscFortranAddr
#endif
 
#define EPSType character*(80)
#define EPSConvergedReason PetscEnum
#define EPSProblemType PetscEnum
#define EPSWhich PetscEnum
#define EPSExtraction PetscEnum
#define EPSBalance PetscEnum
#define EPSConv PetscEnum
#define EPSPowerShiftType PetscEnum
#define EPSLanczosReorthogType PetscEnum
#define EPSPRIMMEMethod PetscEnum
#define EPSPRIMMEPrecond PetscEnum
 
 
#define EPSPOWER 'power'
#define EPSSUBSPACE 'subspace'
#define EPSARNOLDI 'arnoldi'
#define EPSLANCZOS 'lanczos'
#define EPSKRYLOVSCHUR 'krylovschur'
#define EPSLAPACK 'lapack'
#define EPSARPACK 'arpack'
#define EPSBLZPACK 'blzpack'
#define EPSTRLAN 'trlan'
#define EPSBLOPEX 'blopex'
#define EPSPRIMME 'primme'
#define EPSGD 'gd'
#define EPSJD 'jd'
 
#endif
slepc-3_1-2/include/finclude/slepcepsdef.h Property changes : Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
/tags/slepc-3_1-2/include/finclude/slepcip.h New file
0,0 → 1,44
!
! Include file for Fortran use of the IP object in SLEPc
!
!
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! SLEPc - Scalable Library for Eigenvalue Problem Computations
! Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
!
! This file is part of SLEPc.
!
! 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/>.
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
!
#include "finclude/slepcipdef.h"
 
PetscEnum IP_ORTH_MGS
PetscEnum IP_ORTH_CGS
parameter (IP_ORTH_MGS = 0)
parameter (IP_ORTH_CGS = 1)
 
PetscEnum IP_ORTH_REFINE_NEVER
PetscEnum IP_ORTH_REFINE_IFNEEDED
PetscEnum IP_ORTH_REFINE_ALWAYS
 
parameter (IP_ORTH_REFINE_NEVER = 0)
parameter (IP_ORTH_REFINE_IFNEEDED = 1)
parameter (IP_ORTH_REFINE_ALWAYS = 2)
 
PetscEnum IP_INNER_HERMITIAN
PetscEnum IP_INNER_SYMMETRIC
 
parameter (IP_INNER_HERMITIAN = 0)
parameter (IP_INNER_SYMMETRIC = 1)
slepc-3_1-2/include/finclude/slepcip.h Property changes : Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
/tags/slepc-3_1-2/include/finclude/slepcsvddef.h New file
0,0 → 1,45
!
! Include file for Fortran use of the SVD object in SLEPc
!
!
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! SLEPc - Scalable Library for Eigenvalue Problem Computations
! Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
!
! This file is part of SLEPc.
!
! 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/>.
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
!
#if !defined(__SLEPCSVD_H)
#define __SLEPCSVD_H
 
#include "finclude/slepcipdef.h"
#include "finclude/slepcepsdef.h"
 
#if !defined(PETSC_USE_FORTRAN_DATATYPES)
#define SVD PetscFortranAddr
#endif
 
#define SVDType character*(80)
#define SVDTransposeMode PetscEnum
#define SVDWhich PetscEnum
#define SVDConvergedReason PetscEnum
 
#define SVDCROSS 'cross'
#define SVDCYCLIC 'cyclic'
#define SVDLAPACK 'lapack'
#define SVDLANCZOS 'lanczos'
#define SVDTRLANCZOS 'trlanczos'
 
#endif
slepc-3_1-2/include/finclude/slepcsvddef.h Property changes : Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
/tags/slepc-3_1-2/include/finclude/slepcsys.h New file
0,0 → 1,25
!
! Include file for Fortran use of the SLEPc package
!
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! SLEPc - Scalable Library for Eigenvalue Problem Computations
! Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
!
! This file is part of SLEPc.
!
! 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/>.
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
!
 
#include "petscconf.h"
#include "finclude/petscdef.h"
slepc-3_1-2/include/finclude/slepcsys.h Property changes : Added: svn:eol-style
+ native
/tags/slepc-3_1-2/include/finclude/slepc.h New file
0,0 → 1,27
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! SLEPc - Scalable Library for Eigenvalue Problem Computations
! Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
!
! This file is part of SLEPc.
!
! 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/>.
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
!
! Single Fortran include file for all of SLEPc
!
 
#include "finclude/slepcsys.h"
#include "finclude/slepceps.h"
#include "finclude/slepcip.h"
#include "finclude/slepcst.h"
#include "finclude/slepcsvd.h"
slepc-3_1-2/include/finclude/slepc.h Property changes : Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
/tags/slepc-3_1-2/include/finclude/slepcip.h90 New file
0,0 → 1,31
!
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! SLEPc - Scalable Library for Eigenvalue Problem Computations
! Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
!
! This file is part of SLEPc.
!
! 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/>.
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
!
!
!
! Additional IP include file for use of SLEPc with Fortran 90/HPF
!
#include "finclude/ftn-custom/slepcip.h90"
#if defined(PETSC_USE_FORTRAN_INTERFACES)
interface
#include "finclude/ftn-auto/slepcip.h90"
end interface
#endif
 
slepc-3_1-2/include/finclude/slepcip.h90 Property changes : Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
/tags/slepc-3_1-2/include/finclude/ftn-custom/slepcsvddef.h90 New file
0,0 → 1,31
!
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! SLEPc - Scalable Library for Eigenvalue Problem Computations
! Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
!
! This file is part of SLEPc.
!
! 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/>.
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
!
 
#if !defined(__SLEPCSVDDEF_H90)
#define __SLEPCSVDDEF_H90
 
#if defined(PETSC_USE_FORTRAN_DATATYPES)
type SVD
PetscFortranAddr:: v
end type SVD
#endif
 
#endif
slepc-3_1-2/include/finclude/ftn-custom/slepcsvddef.h90 Property changes : Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
/tags/slepc-3_1-2/include/finclude/ftn-custom/slepcsvd.h90 New file
0,0 → 1,30
!
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! SLEPc - Scalable Library for Eigenvalue Problem Computations
! Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
!
! This file is part of SLEPc.
!
! 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/>.
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
!
 
#if !defined(PETSC_USE_FORTRAN_MODULES)
#include "finclude/ftn-custom/slepcsvddef.h90"
#endif
 
#if defined(PETSC_USE_FORTRAN_DATATYPES) && !defined(SVD_HIDE)
#define SVD_HIDE type(SVD)
#elif !defined(SVD_HIDE)
#define SVD_HIDE SVD
#endif
slepc-3_1-2/include/finclude/ftn-custom/slepcsvd.h90 Property changes : Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
/tags/slepc-3_1-2/include/finclude/ftn-custom/slepcqepdef.h90 New file
0,0 → 1,31
!
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! SLEPc - Scalable Library for Eigenvalue Problem Computations
! Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
!
! This file is part of SLEPc.
!
! 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/>.
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
!
 
#if !defined(__SLEPCQEPDEF_H90)
#define __SLEPCQEPDEF_H90
 
#if defined(PETSC_USE_FORTRAN_DATATYPES)
type QEP
PetscFortranAddr:: v
end type QEP
#endif
 
#endif
/tags/slepc-3_1-2/include/finclude/ftn-custom/slepcqep.h90 New file
0,0 → 1,30
!
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! SLEPc - Scalable Library for Eigenvalue Problem Computations
! Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
!
! This file is part of SLEPc.
!
! 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/>.
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
!
 
#if !defined(PETSC_USE_FORTRAN_MODULES)
#include "finclude/ftn-custom/slepcqepdef.h90"
#endif
 
#if defined(PETSC_USE_FORTRAN_DATATYPES) && !defined(QEP_HIDE)
#define QEP_HIDE type(QEP)
#elif !defined(QEP_HIDE)
#define QEP_HIDE QEP
#endif
/tags/slepc-3_1-2/include/finclude/ftn-custom/slepcstdef.h90 New file
0,0 → 1,31
!
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! SLEPc - Scalable Library for Eigenvalue Problem Computations
! Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
!
! This file is part of SLEPc.
!
! 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/>.
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
!
 
#if !defined(__SLEPCSTDEF_H90)
#define __SLEPCSTDEF_H90
 
#if defined(PETSC_USE_FORTRAN_DATATYPES)
type ST
PetscFortranAddr:: v
end type ST
#endif
 
#endif
slepc-3_1-2/include/finclude/ftn-custom/slepcstdef.h90 Property changes : Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
/tags/slepc-3_1-2/include/finclude/ftn-custom/slepcepsdef.h90 New file
0,0 → 1,31
!
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! SLEPc - Scalable Library for Eigenvalue Problem Computations
! Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
!
! This file is part of SLEPc.
!
! 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/>.
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
!
 
#if !defined(__SLEPCEPSDEF_H90)
#define __SLEPCEPSDEF_H90
 
#if defined(PETSC_USE_FORTRAN_DATATYPES)
type EPS
PetscFortranAddr:: v
end type EPS
#endif
 
#endif
slepc-3_1-2/include/finclude/ftn-custom/slepcepsdef.h90 Property changes : Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
/tags/slepc-3_1-2/include/finclude/ftn-custom/slepcst.h90 New file
0,0 → 1,30
!
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! SLEPc - Scalable Library for Eigenvalue Problem Computations
! Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
!
! This file is part of SLEPc.
!
! 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/>.
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
!
 
#if !defined(PETSC_USE_FORTRAN_MODULES)
#include "finclude/ftn-custom/slepcstdef.h90"
#endif
 
#if defined(PETSC_USE_FORTRAN_DATATYPES) && !defined(ST_HIDE)
#define ST_HIDE type(ST)
#elif !defined(ST_HIDE)
#define ST_HIDE ST
#endif
slepc-3_1-2/include/finclude/ftn-custom/slepcst.h90 Property changes : Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
/tags/slepc-3_1-2/include/finclude/ftn-custom/makefile New file
0,0 → 1,22
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# SLEPc - Scalable Library for Eigenvalue Problem Computations
# Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
#
# This file is part of SLEPc.
#
# 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/>.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
 
include ${SLEPC_DIR}/conf/slepc_common
slepc-3_1-2/include/finclude/ftn-custom/makefile Property changes : Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
/tags/slepc-3_1-2/include/finclude/ftn-custom/slepceps.h90 New file
0,0 → 1,30
!
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! SLEPc - Scalable Library for Eigenvalue Problem Computations
! Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
!
! This file is part of SLEPc.
!
! 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/>.
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
!
 
#if !defined(PETSC_USE_FORTRAN_MODULES)
#include "finclude/ftn-custom/slepcepsdef.h90"
#endif
 
#if defined(PETSC_USE_FORTRAN_DATATYPES) && !defined(EPS_HIDE)
#define EPS_HIDE type(EPS)
#elif !defined(EPS_HIDE)
#define EPS_HIDE EPS
#endif
slepc-3_1-2/include/finclude/ftn-custom/slepceps.h90 Property changes : Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
/tags/slepc-3_1-2/include/finclude/ftn-custom/slepcipdef.h90 New file
0,0 → 1,31
!
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! SLEPc - Scalable Library for Eigenvalue Problem Computations
! Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
!
! This file is part of SLEPc.
!
! 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/>.
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
!
 
#if !defined(__SLEPCIPDEF_H90)
#define __SLEPCIPDEF_H90
 
#if defined(PETSC_USE_FORTRAN_DATATYPES)
type IP
PetscFortranAddr:: v
end type IP
#endif
 
#endif
slepc-3_1-2/include/finclude/ftn-custom/slepcipdef.h90 Property changes : Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
/tags/slepc-3_1-2/include/finclude/ftn-custom/slepcip.h90 New file
0,0 → 1,30
!
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! SLEPc - Scalable Library for Eigenvalue Problem Computations
! Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
!
! This file is part of SLEPc.
!
! 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/>.
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
!
 
#if !defined(PETSC_USE_FORTRAN_MODULES)
#include "finclude/ftn-custom/slepcipdef.h90"
#endif
 
#if defined(PETSC_USE_FORTRAN_DATATYPES) && !defined(IP_HIDE)
#define IP_HIDE type(IP)
#elif !defined(IP_HIDE)
#define IP_HIDE IP
#endif
slepc-3_1-2/include/finclude/ftn-custom/slepcip.h90 Property changes : Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
/tags/slepc-3_1-2/include/finclude/slepcqep.h New file
0,0 → 1,65
!
! Include file for Fortran use of the QEP object in SLEPc
!
!
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! SLEPc - Scalable Library for Eigenvalue Problem Computations
! Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
!
! This file is part of SLEPc.
!
! 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/>.
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
!
#include "finclude/slepcqepdef.h"
 
! Convergence flags.
! They should match the flags in $SLEPC_DIR/include/slepcqep.h
 
PetscEnum QEP_CONVERGED_TOL
PetscEnum QEP_DIVERGED_ITS
PetscEnum QEP_DIVERGED_BREAKDOWN
PetscEnum QEP_CONVERGED_ITERATING
 
parameter (QEP_CONVERGED_TOL = 2)
parameter (QEP_DIVERGED_ITS = -3)
parameter (QEP_DIVERGED_BREAKDOWN = -4)
parameter (QEP_CONVERGED_ITERATING = 0)
 
PetscEnum QEP_GENERAL
PetscEnum QEP_HERMITIAN
PetscEnum QEP_GYROSCOPIC
 
parameter (QEP_GENERAL = 1)
parameter (QEP_HERMITIAN = 2)
parameter (QEP_GYROSCOPIC = 3)
PetscEnum QEP_LARGEST_MAGNITUDE
PetscEnum QEP_SMALLEST_MAGNITUDE
PetscEnum QEP_LARGEST_REAL
PetscEnum QEP_SMALLEST_REAL
PetscEnum QEP_LARGEST_IMAGINARY
PetscEnum QEP_SMALLEST_IMAGINARY
 
parameter (QEP_LARGEST_MAGNITUDE = 1)
parameter (QEP_SMALLEST_MAGNITUDE = 2)
parameter (QEP_LARGEST_REAL = 3)
parameter (QEP_SMALLEST_REAL = 4)
parameter (QEP_LARGEST_IMAGINARY = 5)
parameter (QEP_SMALLEST_IMAGINARY = 6)
external QEPMONITORALL
external QEPMONITORLG
external QEPMONITORLGALL
external QEPMONITORCONVERGED
external QEPMONITORFIRST
/tags/slepc-3_1-2/include/finclude/slepcst.h New file
0,0 → 1,32
!
! Include file for Fortran use of the ST object in SLEPc
!
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! SLEPc - Scalable Library for Eigenvalue Problem Computations
! Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
!
! This file is part of SLEPc.
!
! 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/>.
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
!
#include "finclude/slepcstdef.h"
 
PetscEnum ST_MATMODE_COPY
PetscEnum ST_MATMODE_INPLACE
PetscEnum ST_MATMODE_SHELL
 
parameter (ST_MATMODE_COPY = 0)
parameter (ST_MATMODE_INPLACE = 1)
parameter (ST_MATMODE_SHELL = 2)
 
slepc-3_1-2/include/finclude/slepcst.h Property changes : Added: svn:eol-style
+ native
/tags/slepc-3_1-2/include/finclude/slepceps.h New file
0,0 → 1,181
!
! Include file for Fortran use of the EPS object in SLEPc
!
!
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! SLEPc - Scalable Library for Eigenvalue Problem Computations
! Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
!
! This file is part of SLEPc.
!
! 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/>.
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
!
#include "finclude/slepcepsdef.h"
 
! Convergence flags.
! They sould match the flags in $SLEPC_DIR/include/slepceps.h
 
PetscEnum EPS_CONVERGED_TOL
PetscEnum EPS_DIVERGED_ITS
PetscEnum EPS_DIVERGED_BREAKDOWN
PetscEnum EPS_DIVERGED_NONSYMMETRIC
PetscEnum EPS_CONVERGED_ITERATING
 
parameter (EPS_CONVERGED_TOL = 2)
parameter (EPS_DIVERGED_ITS = -3)
parameter (EPS_DIVERGED_BREAKDOWN = -4)
parameter (EPS_DIVERGED_NONSYMMETRIC = -5)
parameter (EPS_CONVERGED_ITERATING = 0)
 
PetscEnum EPS_HEP
PetscEnum EPS_GHEP
PetscEnum EPS_NHEP
PetscEnum EPS_GNHEP
PetscEnum EPS_PGNHEP
 
parameter (EPS_HEP = 1)
parameter (EPS_GHEP = 2)
parameter (EPS_NHEP = 3)
parameter (EPS_GNHEP = 4)
parameter (EPS_PGNHEP = 5)
PetscEnum EPS_LARGEST_MAGNITUDE
PetscEnum EPS_SMALLEST_MAGNITUDE
PetscEnum EPS_LARGEST_REAL
PetscEnum EPS_SMALLEST_REAL
PetscEnum EPS_LARGEST_IMAGINARY
PetscEnum EPS_SMALLEST_IMAGINARY
PetscEnum EPS_TARGET_MAGNITUDE
PetscEnum EPS_TARGET_REAL
PetscEnum EPS_TARGET_IMAGINARY
PetscEnum EPS_WHICH_USER
 
parameter (EPS_LARGEST_MAGNITUDE = 1)
parameter (EPS_SMALLEST_MAGNITUDE = 2)
parameter (EPS_LARGEST_REAL = 3)
parameter (EPS_SMALLEST_REAL = 4)
parameter (EPS_LARGEST_IMAGINARY = 5)
parameter (EPS_SMALLEST_IMAGINARY = 6)
parameter (EPS_TARGET_MAGNITUDE = 7)
parameter (EPS_TARGET_REAL = 8)
parameter (EPS_TARGET_IMAGINARY = 9)
parameter (EPS_WHICH_USER = 10)
PetscEnum EPS_BALANCE_NONE
PetscEnum EPS_BALANCE_ONESIDE
PetscEnum EPS_BALANCE_TWOSIDE
PetscEnum EPS_BALANCE_USER
 
parameter (EPS_BALANCE_NONE = 1)
parameter (EPS_BALANCE_ONESIDE = 2)
parameter (EPS_BALANCE_TWOSIDE = 3)
parameter (EPS_BALANCE_USER = 4)
 
PetscEnum EPS_POWER_SHIFT_CONSTANT
PetscEnum EPS_POWER_SHIFT_RAYLEIGH
PetscEnum EPS_POWER_SHIFT_WILKINSON
 
parameter (EPS_POWER_SHIFT_CONSTANT = 0)
parameter (EPS_POWER_SHIFT_RAYLEIGH = 1)
parameter (EPS_POWER_SHIFT_WILKINSON = 2)
 
PetscEnum EPS_ONE_SIDE
PetscEnum EPS_TWO_SIDE
 
parameter (EPS_ONE_SIDE = 0)
parameter (EPS_TWO_SIDE = 1)
PetscEnum EPS_RITZ
PetscEnum EPS_HARMONIC
PetscEnum EPS_HARMONIC_RELATIVE
PetscEnum EPS_HARMONIC_RIGHT
PetscEnum EPS_HARMONIC_LARGEST
PetscEnum EPS_REFINED
PetscEnum EPS_REFINED_HARMONIC
 
parameter (EPS_RITZ = 1)
parameter (EPS_HARMONIC = 2)
parameter (EPS_HARMONIC_RELATIVE = 3)
parameter (EPS_HARMONIC_RIGHT = 4)
parameter (EPS_HARMONIC_LARGEST = 5)
parameter (EPS_REFINED = 6)
parameter (EPS_REFINED_HARMONIC = 7)
 
PetscEnum EPS_CONV_ABS
PetscEnum EPS_CONV_EIG
PetscEnum EPS_CONV_NORM
 
parameter (EPS_CONV_ABS = 1)
parameter (EPS_CONV_EIG = 2)
parameter (EPS_CONV_NORM = 3)
 
PetscEnum EPS_LANCZOS_REORTHOG_LOCAL
PetscEnum EPS_LANCZOS_REORTHOG_FULL
PetscEnum EPS_LANCZOS_REORTHOG_SELECTIVE
PetscEnum EPS_LANCZOS_REORTHOG_PERIODIC
PetscEnum EPS_LANCZOS_REORTHOG_PARTIAL
 
parameter (EPS_LANCZOS_REORTHOG_LOCAL = 0)
parameter (EPS_LANCZOS_REORTHOG_FULL = 1)
parameter (EPS_LANCZOS_REORTHOG_SELECTIVE = 2)
parameter (EPS_LANCZOS_REORTHOG_PERIODIC = 3)
parameter (EPS_LANCZOS_REORTHOG_PARTIAL = 4)
 
PetscEnum EPS_PRIMME_DYNAMIC
PetscEnum EPS_PRIMME_DEFAULT_MIN_TIME
PetscEnum EPS_PRIMME_DEFAULT_MIN_MATVECS
PetscEnum EPS_PRIMME_ARNOLDI
PetscEnum EPS_PRIMME_GD
PetscEnum EPS_PRIMME_GD_PLUSK
PetscEnum EPS_PRIMME_GD_OLSEN_PLUSK
PetscEnum EPS_PRIMME_JD_OLSEN_PLUSK
PetscEnum EPS_PRIMME_RQI
PetscEnum EPS_PRIMME_JDQR
PetscEnum EPS_PRIMME_JDQMR
PetscEnum EPS_PRIMME_JDQMR_ETOL
PetscEnum EPS_PRIMME_SUBSPACE_ITERATION
PetscEnum EPS_PRIMME_LOBPCG_ORTHOBASIS
PetscEnum EPS_PRIMME_LOBPCG_ORTHOBASISW
 
parameter (EPS_PRIMME_DYNAMIC = 0)
parameter (EPS_PRIMME_DEFAULT_MIN_TIME = 1)
parameter (EPS_PRIMME_DEFAULT_MIN_MATVECS = 2)
parameter (EPS_PRIMME_ARNOLDI = 3)
parameter (EPS_PRIMME_GD = 4)
parameter (EPS_PRIMME_GD_PLUSK = 5)
parameter (EPS_PRIMME_GD_OLSEN_PLUSK = 7)
parameter (EPS_PRIMME_JD_OLSEN_PLUSK = 8)
parameter (EPS_PRIMME_RQI = 9)
parameter (EPS_PRIMME_JDQR = 10)
parameter (EPS_PRIMME_JDQMR = 11)
parameter (EPS_PRIMME_JDQMR_ETOL = 12)
parameter (EPS_PRIMME_SUBSPACE_ITERATION = 13)
parameter (EPS_PRIMME_LOBPCG_ORTHOBASIS = 14)
parameter (EPS_PRIMME_LOBPCG_ORTHOBASISW = 15)
 
PetscEnum EPS_PRIMME_PRECOND_NONE
PetscEnum EPS_PRIMME_PRECOND_DIAGONAL
 
parameter (EPS_PRIMME_PRECOND_NONE = 0)
parameter (EPS_PRIMME_PRECOND_DIAGONAL = 1)
 
external EPSMONITORALL
external EPSMONITORLG
external EPSMONITORCONVERGED
external EPSMONITORFIRST
 
!PETSC_DEC_ATTRIBUTES(EPSMONITORALL,'_EPSMONITORALL')
!PETSC_DEC_ATTRIBUTES(EPSMONITORLG,'_EPSMONITORLG')
!PETSC_DEC_ATTRIBUTES(EPSMONITORCONVERGED,'_EPSMONITORCONVERGED')
!PETSC_DEC_ATTRIBUTES(EPSMONITORFIRST,'_EPSMONITORFIRST')
slepc-3_1-2/include/finclude/slepceps.h Property changes : Added: svn:eol-style
+ native
/tags/slepc-3_1-2/include/finclude/slepcipdef.h New file
0,0 → 1,35
!
! Include file for Fortran use of the IP object in SLEPc
!
!
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! SLEPc - Scalable Library for Eigenvalue Problem Computations
! Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
!
! This file is part of SLEPc.
!
! 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/>.
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
!
#if !defined(__SLEPCIP_H)
#define __SLEPCIP_H
 
#if !defined(PETSC_USE_FORTRAN_DATATYPES)
#define IP PetscFortranAddr
#endif
 
#define IPOrthogonalizationType PetscEnum
#define IPOrthogonalizationRefinementType PetscEnum
#define IPBilinearForm PetscEnum
 
#endif
slepc-3_1-2/include/finclude/slepcipdef.h Property changes : Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
/tags/slepc-3_1-2/include/finclude/slepc.h90 New file
0,0 → 1,27
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! SLEPc - Scalable Library for Eigenvalue Problem Computations
! Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
!
! This file is part of SLEPc.
!
! 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/>.
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
!
! Single Fortran 90 include file
!
 
#include "finclude/slepcsys.h"
#include "finclude/slepceps.h90"
#include "finclude/slepcip.h90"
#include "finclude/slepcst.h90"
#include "finclude/slepcsvd.h90"
slepc-3_1-2/include/finclude/slepc.h90 Property changes : Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
/tags/slepc-3_1-2/include/finclude/slepcsvd.h New file
0,0 → 1,49
!
! Include file for Fortran use of the SVD object in SLEPc
!
!
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! SLEPc - Scalable Library for Eigenvalue Problem Computations
! Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
!
! This file is part of SLEPc.
!
! 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/>.
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
!
#include "finclude/slepcsvddef.h"
 
! Convergence flags.
! They sould match the flags in $SLEPC_DIR/include/slepcsvd.h
 
PetscEnum SVD_CONVERGED_TOL
PetscEnum SVD_DIVERGED_ITS
PetscEnum SVD_DIVERGED_BREAKDOWN
PetscEnum SVD_CONVERGED_ITERATING
 
parameter (SVD_CONVERGED_TOL = 2)
parameter (SVD_DIVERGED_ITS = -3)
parameter (SVD_DIVERGED_BREAKDOWN = -4)
parameter (SVD_CONVERGED_ITERATING = 0)
 
PetscEnum SVD_TRANSPOSE_EXPLICIT
PetscEnum SVD_TRANSPOSE_IMPLICIT
 
parameter (SVD_TRANSPOSE_EXPLICIT = 0)
parameter (SVD_TRANSPOSE_IMPLICIT = 1)
integer SVD_LARGEST
integer SVD_SMALLEST
 
parameter (SVD_LARGEST = 0)
parameter (SVD_SMALLEST = 1)
slepc-3_1-2/include/finclude/slepcsvd.h Property changes : Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
/tags/slepc-3_1-2/include/finclude/slepcqep.h90 New file
0,0 → 1,31
!
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! SLEPc - Scalable Library for Eigenvalue Problem Computations
! Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
!
! This file is part of SLEPc.
!
! 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/>.
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
!
!
!
! Additional QEP include file for use of SLEPc with Fortran 90/HPF
!
#include "finclude/ftn-custom/slepcqep.h90"
#if defined(PETSC_USE_FORTRAN_INTERFACES)
interface
#include "finclude/ftn-auto/slepcqep.h90"
end interface
#endif
 
/tags/slepc-3_1-2/include/finclude/slepcdef.h New file
0,0 → 1,26
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! SLEPc - Scalable Library for Eigenvalue Problem Computations
! Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
!
! This file is part of SLEPc.
!
! 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/>.
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
!
! Single Fortran include file for all of SLEPc
!
 
#include "finclude/slepcepsdef.h"
#include "finclude/slepcipdef.h"
#include "finclude/slepcstdef.h"
#include "finclude/slepcsvddef.h"
slepc-3_1-2/include/finclude/slepcdef.h Property changes : Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
/tags/slepc-3_1-2/include/finclude/slepcst.h90 New file
0,0 → 1,31
!
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! SLEPc - Scalable Library for Eigenvalue Problem Computations
! Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
!
! This file is part of SLEPc.
!
! 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/>.
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
!
!
!
! Additional ST include file for use of SLEPc with Fortran 90/HPF
!
#include "finclude/ftn-custom/slepcst.h90"
#if defined(PETSC_USE_FORTRAN_INTERFACES)
interface
#include "finclude/ftn-auto/slepcst.h90"
end interface
#endif
 
slepc-3_1-2/include/finclude/slepcst.h90 Property changes : Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
/tags/slepc-3_1-2/include/finclude/slepceps.h90 New file
0,0 → 1,31
!
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! SLEPc - Scalable Library for Eigenvalue Problem Computations
! Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
!
! This file is part of SLEPc.
!
! 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/>.
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
!
!
!
! Additional EPS include file for use of SLEPc with Fortran 90/HPF
!
#include "finclude/ftn-custom/slepceps.h90"
#if defined(PETSC_USE_FORTRAN_INTERFACES)
interface
#include "finclude/ftn-auto/slepceps.h90"
end interface
#endif
 
slepc-3_1-2/include/finclude/slepceps.h90 Property changes : Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
/tags/slepc-3_1-2/include/finclude/makefile New file
0,0 → 1,40
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# SLEPc - Scalable Library for Eigenvalue Problem Computations
# Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
#
# This file is part of SLEPc.
#
# 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/>.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
 
CFLAGS =
FFLAGS =
SOURCEC =
SOURCEF =
SOURCEH = slepc.h slepceps.h slepcst.h slepcsvd.h slepcip.h
OBJSC =
OBJSF =
LIBBASE = libslepc
DIRS =
MANSEC =
LOCDIR = include/finclude/
 
include ${SLEPC_DIR}/conf/slepc_common
 
runexamples:
 
 
 
 
slepc-3_1-2/include/finclude/makefile Property changes : Added: svn:eol-style
+ native
/tags/slepc-3_1-2/include/slepcsvd.h New file
0,0 → 1,162
/*
User interface for the SLEPC singular value solvers.
 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SLEPc - Scalable Library for Eigenvalue Problem Computations
Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
 
This file is part of SLEPc.
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/>.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
 
#if !defined(__SLEPCSVD_H)
#define __SLEPCSVD_H
#include "slepcsys.h"
#include "slepceps.h"
PETSC_EXTERN_CXX_BEGIN
 
extern PetscCookie SVD_COOKIE;
 
/*S
SVD - Abstract SLEPc object that manages all the singular value
problem solvers.
 
Level: beginner
 
.seealso: SVDCreate()
S*/
typedef struct _p_SVD* SVD;
 
/*E
SVDType - String with the name of a SLEPc singular value solver
 
Level: beginner
 
.seealso: SVDSetType(), SVD
E*/
#define SVDType char*
#define SVDCROSS "cross"
#define SVDCYCLIC "cyclic"
#define SVDLAPACK "lapack"
#define SVDLANCZOS "lanczos"
#define SVDTRLANCZOS "trlanczos"
 
/*E
SVDTransposeMode - determines how to handle the transpose of the matrix
 
Level: advanced
 
.seealso: SVDSetTransposeMode(), SVDGetTransposeMode()
E*/
typedef enum { SVD_TRANSPOSE_EXPLICIT,
SVD_TRANSPOSE_IMPLICIT } SVDTransposeMode;
 
/*E
SVDWhich - determines whether largest or smallest singular triplets
are to be computed
 
Level: intermediate
 
.seealso: SVDSetWhichSingularTriplets(), SVDGetWhichSingularTriplets()
E*/
typedef enum { SVD_LARGEST,
SVD_SMALLEST } SVDWhich;
 
/*E
SVDConvergedReason - reason a singular value solver was said to
have converged or diverged
 
Level: beginner
 
.seealso: SVDSolve(), SVDGetConvergedReason(), SVDSetTolerances()
E*/
typedef enum {/* converged */
SVD_CONVERGED_TOL = 2,
/* diverged */
SVD_DIVERGED_ITS = -3,
SVD_DIVERGED_BREAKDOWN = -4,
SVD_CONVERGED_ITERATING = 0 } SVDConvergedReason;
 
EXTERN PetscErrorCode SVDCreate(MPI_Comm,SVD*);
EXTERN PetscErrorCode SVDSetIP(SVD,IP);
EXTERN PetscErrorCode SVDGetIP(SVD,IP*);
EXTERN PetscErrorCode SVDSetType(SVD,const SVDType);
EXTERN PetscErrorCode SVDGetType(SVD,const SVDType*);
EXTERN PetscErrorCode SVDSetOperator(SVD,Mat);
EXTERN PetscErrorCode SVDGetOperator(SVD,Mat*);
EXTERN PetscErrorCode SVDSetInitialSpace(SVD,PetscInt,Vec*);
EXTERN PetscErrorCode SVDSetTransposeMode(SVD,SVDTransposeMode);
EXTERN PetscErrorCode SVDGetTransposeMode(SVD,SVDTransposeMode*);
EXTERN PetscErrorCode SVDSetDimensions(SVD,PetscInt,PetscInt,PetscInt);
EXTERN PetscErrorCode SVDGetDimensions(SVD,PetscInt*,PetscInt*,PetscInt*);
EXTERN PetscErrorCode SVDSetTolerances(SVD,PetscReal,PetscInt);
EXTERN PetscErrorCode SVDGetTolerances(SVD,PetscReal*,PetscInt*);
EXTERN PetscErrorCode SVDSetWhichSingularTriplets(SVD,SVDWhich);
EXTERN PetscErrorCode SVDGetWhichSingularTriplets(SVD,SVDWhich*);
EXTERN PetscErrorCode SVDSetFromOptions(SVD);
EXTERN PetscErrorCode SVDSetOptionsPrefix(SVD,const char*);
EXTERN PetscErrorCode SVDAppendOptionsPrefix(SVD,const char*);
EXTERN PetscErrorCode SVDGetOptionsPrefix(SVD,const char*[]);
EXTERN PetscErrorCode SVDSetUp(SVD);
EXTERN PetscErrorCode SVDSolve(SVD);
EXTERN PetscErrorCode SVDGetIterationNumber(SVD,PetscInt*);
EXTERN PetscErrorCode SVDGetConvergedReason(SVD,SVDConvergedReason*);
EXTERN PetscErrorCode SVDGetConverged(SVD,PetscInt*);
EXTERN PetscErrorCode SVDGetSingularTriplet(SVD,PetscInt,PetscReal*,Vec,Vec);
EXTERN PetscErrorCode SVDComputeResidualNorms(SVD,PetscInt,PetscReal*,PetscReal*);
EXTERN PetscErrorCode SVDComputeRelativeError(SVD,PetscInt,PetscReal*);
EXTERN PetscErrorCode SVDGetOperationCounters(SVD,PetscInt*,PetscInt*);
EXTERN PetscErrorCode SVDView(SVD,PetscViewer);
EXTERN PetscErrorCode SVDDestroy(SVD);
 
EXTERN PetscErrorCode SVDMonitorSet(SVD,PetscErrorCode (*)(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,void*),
void*,PetscErrorCode (*monitordestroy)(void*));
EXTERN PetscErrorCode SVDMonitorCancel(SVD);
EXTERN PetscErrorCode SVDGetMonitorContext(SVD,void **);
EXTERN PetscErrorCode SVDMonitorAll(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,void*);
EXTERN PetscErrorCode SVDMonitorFirst(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,void*);
EXTERN PetscErrorCode SVDMonitorConverged(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,void*);
EXTERN PetscErrorCode SVDMonitorLG(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,void*);
EXTERN PetscErrorCode SVDMonitorLGAll(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,void*);
 
EXTERN PetscErrorCode SVDSetTrackAll(SVD,PetscTruth);
EXTERN PetscErrorCode SVDGetTrackAll(SVD,PetscTruth*);
 
EXTERN PetscErrorCode SVDDense(PetscInt,PetscInt,PetscScalar*,PetscReal*,PetscScalar*,PetscScalar*);
 
EXTERN PetscErrorCode SVDCrossSetEPS(SVD,EPS);
EXTERN PetscErrorCode SVDCrossGetEPS(SVD,EPS*);
 
EXTERN PetscErrorCode SVDCyclicSetExplicitMatrix(SVD,PetscTruth);
EXTERN PetscErrorCode SVDCyclicGetExplicitMatrix(SVD,PetscTruth*);
EXTERN PetscErrorCode SVDCyclicSetEPS(SVD,EPS);
EXTERN PetscErrorCode SVDCyclicGetEPS(SVD,EPS*);
 
EXTERN PetscErrorCode SVDLanczosSetOneSide(SVD,PetscTruth);
EXTERN PetscErrorCode SVDLanczosGetOneSide(SVD,PetscTruth*);
 
EXTERN PetscErrorCode SVDTRLanczosSetOneSide(SVD,PetscTruth);
EXTERN PetscErrorCode SVDTRLanczosGetOneSide(SVD,PetscTruth*);
 
EXTERN PetscErrorCode SVDRegister(const char*,const char*,const char*,PetscErrorCode(*)(SVD));
#if defined(PETSC_USE_DYNAMIC_LIBRARIES)
#define SVDRegisterDynamic(a,b,c,d) SVDRegister(a,b,c,0)
#else
#define SVDRegisterDynamic(a,b,c,d) SVDRegister(a,b,c,d)
#endif
EXTERN PetscErrorCode SVDRegisterDestroy(void);
 
PETSC_EXTERN_CXX_END
#endif
slepc-3_1-2/include/slepcsvd.h Property changes : Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
/tags/slepc-3_1-2/include/private/epsimpl.h New file
0,0 → 1,162
/*
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SLEPc - Scalable Library for Eigenvalue Problem Computations
Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
 
This file is part of SLEPc.
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
#define _EPSIMPL
 
#include "slepceps.h"
 
extern PetscFList EPSList;
extern PetscLogEvent EPS_SetUp, EPS_Solve, EPS_Dense;
 
typedef struct _EPSOps *EPSOps;
 
struct _EPSOps {
PetscErrorCode (*solve)(EPS);
PetscErrorCode (*setup)(EPS);
PetscErrorCode (*setfromoptions)(EPS);
PetscErrorCode (*publishoptions)(EPS);
PetscErrorCode (*destroy)(EPS);
PetscErrorCode (*view)(EPS,PetscViewer);
PetscErrorCode (*backtransform)(EPS);
PetscErrorCode (*computevectors)(EPS);
};
 
/*
Maximum number of monitors you can run with a single EPS
*/
#define MAXEPSMONITORS 5
 
/*
Defines the EPS data structure.
*/
struct _p_EPS {
PETSCHEADER(struct _EPSOps);
/*------------------------- User parameters --------------------------*/
PetscInt max_it, /* maximum number of iterations */
nev, /* number of eigenvalues to compute */
ncv, /* number of basis vectors */
mpd, /* maximum dimension of projected problem */
nini, ninil, /* number of initial vectors (negative means not copied yet) */
nds; /* number of basis vectors of deflation space */
PetscScalar target; /* target value */
PetscReal tol; /* tolerance */
EPSConv conv; /* convergence test */
PetscErrorCode (*conv_func)(EPS,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*);
void *conv_ctx;
EPSWhich which; /* which part of the spectrum to be sought */
PetscTruth leftvecs; /* if left eigenvectors are requested */
PetscErrorCode (*which_func)(EPS,PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*);
void *which_ctx;
EPSProblemType problem_type; /* which kind of problem to be solved */
EPSExtraction extraction; /* which kind of extraction to be applied */
EPSBalance balance; /* the balancing method */
PetscInt balance_its; /* number of iterations of the balancing method */
PetscReal balance_cutoff; /* cutoff value for balancing */
PetscReal nrma, nrmb; /* matrix norms */
PetscTruth adaptive; /* whether matrix norms are adaptively improved */
PetscTruth trueres; /* whether the true residual norm must be computed */
PetscTruth trackall; /* whether all the residuals must be computed */
 
/*------------------------- Working data --------------------------*/
Vec D, /* diagonal matrix for balancing */
*V, /* set of basis vectors and computed eigenvectors */
*W, /* set of left basis vectors and computed left eigenvectors */
*IS, *ISL, /* placeholder for references to user-provided initial space */
*DS; /* deflation space */
PetscScalar *eigr, *eigi, /* real and imaginary parts of eigenvalues */
*T, *Tl; /* projected matrices */
PetscReal *errest, /* error estimates */
*errest_left; /* left error estimates */
ST OP; /* spectral transformation object */
IP ip; /* innerproduct object */
void *data; /* placeholder for misc stuff associated
with a particular solver */
PetscInt nconv, /* number of converged eigenvalues */
its, /* number of iterations so far computed */
*perm, /* permutation for eigenvalue ordering */
nv, /* size of current Schur decomposition */
n, nloc, /* problem dimensions (global, local) */
allocated_ncv; /* number of basis vectors allocated */
PetscTruth evecsavailable; /* computed eigenvectors */
PetscRandom rand; /* random number generator */
 
/* ---------------- Default work-area and status vars -------------------- */
PetscInt nwork;
Vec *work;
 
PetscTruth ds_ortho; /* if DS vectors have been stored and orthonormalized */
PetscInt setupcalled;
PetscTruth isgeneralized,
ispositive,
ishermitian;
EPSConvergedReason reason;
 
PetscErrorCode (*monitor[MAXEPSMONITORS])(EPS,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*);
PetscErrorCode (*monitordestroy[MAXEPSMONITORS])(void*);
void *monitorcontext[MAXEPSMONITORS];
PetscInt numbermonitors;
};
 
#define EPSMonitor(eps,it,nconv,eigr,eigi,errest,nest) \
{ PetscErrorCode _ierr; PetscInt _i,_im = eps->numbermonitors; \
for ( _i=0; _i<_im; _i++ ) {\
_ierr=(*eps->monitor[_i])(eps,it,nconv,eigr,eigi,errest,nest,eps->monitorcontext[_i]);\
CHKERRQ(_ierr); \
} \
}
 
/* context for EPSMonitorConverged */
typedef struct {
PetscViewerASCIIMonitor viewer;
PetscInt oldnconv;
} EPSMONITOR_CONV;
EXTERN PetscErrorCode EPSMonitorDestroy_Converged(EPSMONITOR_CONV*);
 
EXTERN PetscErrorCode EPSRegisterAll(char *);
EXTERN PetscErrorCode EPSInitializePackage(char *);
EXTERN PetscErrorCode EPSFinalizePackage(void);
 
EXTERN PetscErrorCode EPSDestroy_Default(EPS);
EXTERN PetscErrorCode EPSDefaultGetWork(EPS,PetscInt);
EXTERN PetscErrorCode EPSDefaultFreeWork(EPS);
EXTERN PetscErrorCode EPSAllocateSolution(EPS);
EXTERN PetscErrorCode EPSFreeSolution(EPS);
EXTERN PetscErrorCode EPSBackTransform_Default(EPS);
EXTERN PetscErrorCode EPSComputeVectors_Default(EPS);
EXTERN PetscErrorCode EPSComputeVectors_Hermitian(EPS);
EXTERN PetscErrorCode EPSComputeVectors_Schur(EPS);
EXTERN PetscErrorCode EPSComputeResidualNorm_Private(EPS,PetscScalar,PetscScalar,Vec,Vec,PetscReal*);
EXTERN PetscErrorCode EPSComputeRelativeError_Private(EPS,PetscScalar,PetscScalar,Vec,Vec,PetscReal*);
EXTERN PetscErrorCode EPSComputeTrueResidual(EPS,PetscScalar,PetscScalar,PetscScalar*,Vec*,PetscInt,PetscReal*);
 
/* Private functions of the solver implementations */
 
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 EPSDelayedArnoldi1(EPS,PetscScalar*,PetscInt,Vec*,PetscInt,PetscInt*,Vec,PetscReal*,PetscTruth*);
EXTERN PetscErrorCode EPSKrylovConvergence(EPS,PetscTruth,PetscInt,PetscInt,PetscScalar*,PetscInt,PetscScalar*,Vec*,PetscInt,PetscReal,PetscReal,PetscInt*,PetscScalar*);
EXTERN PetscErrorCode EPSFullLanczos(EPS,PetscReal*,PetscReal*,Vec*,PetscInt,PetscInt*,Vec,PetscTruth*);
EXTERN PetscErrorCode EPSTranslateHarmonic(PetscInt,PetscScalar*,PetscInt,PetscScalar,PetscScalar,PetscScalar*,PetscScalar*);
EXTERN PetscErrorCode EPSBuildBalance_Krylov(EPS);
EXTERN PetscErrorCode EPSProjectedKSNonsym(EPS,PetscInt,PetscScalar*,PetscInt,PetscScalar*,PetscInt);
 
#endif
slepc-3_1-2/include/private/epsimpl.h Property changes : Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
/tags/slepc-3_1-2/include/private/ipimpl.h New file
0,0 → 1,48
/*
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SLEPc - Scalable Library for Eigenvalue Problem Computations
Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
 
This file is part of SLEPc.
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 _IPIMPL
#define _IPIMPL
 
#include "slepcip.h"
 
extern PetscCookie IP_COOKIE;
extern PetscLogEvent IP_InnerProduct,IP_Orthogonalize,IP_ApplyMatrix;
 
struct _p_IP {
PETSCHEADER(int);
IPOrthogonalizationType orthog_type; /* which orthogonalization to use */
IPOrthogonalizationRefinementType orthog_ref; /* refinement method */
PetscReal orthog_eta;
IPBilinearForm bilinear_form;
Mat matrix;
PetscInt innerproducts;
 
/*------------------------- Cache Bx product -------------------*/
PetscInt xid;
PetscInt xstate;
Vec Bx;
};
 
EXTERN PetscErrorCode IPApplyMatrix_Private(IP,Vec);
EXTERN PetscErrorCode IPOrthogonalizeCGS1(IP,PetscInt,Vec*,PetscInt,PetscTruth*,Vec*,Vec,PetscScalar*,PetscReal*,PetscReal*);
 
#endif
slepc-3_1-2/include/private/ipimpl.h Property changes : Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
/tags/slepc-3_1-2/include/private/svdimpl.h New file
0,0 → 1,113
/*
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SLEPc - Scalable Library for Eigenvalue Problem Computations
Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
 
This file is part of SLEPc.
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 _SVDIMPL
#define _SVDIMPL
 
#include "slepcsvd.h"
#include "slepcip.h"
 
extern PetscFList SVDList;
extern PetscLogEvent SVD_SetUp, SVD_Solve, SVD_Dense;
 
typedef struct _SVDOps *SVDOps;
 
struct _SVDOps {
PetscErrorCode (*solve)(SVD);
PetscErrorCode (*setup)(SVD);
PetscErrorCode (*setfromoptions)(SVD);
PetscErrorCode (*publishoptions)(SVD);
PetscErrorCode (*destroy)(SVD);
PetscErrorCode (*view)(SVD,PetscViewer);
};
 
/*
Maximum number of monitors you can run with a single SVD
*/
#define MAXSVDMONITORS 5
 
/*
Defines the SVD data structure.
*/
struct _p_SVD {
PETSCHEADER(struct _SVDOps);
Mat OP; /* problem matrix */
Mat A; /* problem matrix (m>n) */
Mat AT; /* transposed matrix */
SVDTransposeMode transmode; /* transpose mode */
PetscReal *sigma; /* singular values */
PetscInt *perm; /* permutation for singular value ordering */
Vec *U,*V; /* left and right singular vectors */
Vec *IS; /* placeholder for references to user-provided initial space */
PetscInt n; /* maximun size of descomposition */
SVDWhich which; /* which singular values are computed */
PetscInt nconv; /* number of converged values */
PetscInt nsv; /* number of requested values */
PetscInt ncv; /* basis size */
PetscInt mpd; /* maximum dimension of projected problem */
PetscInt nini; /* number of initial vectors (negative means not copied yet) */
PetscInt its; /* iteration counter */
PetscInt max_it; /* max iterations */
PetscReal tol; /* tolerance */
PetscReal *errest; /* error estimates */
PetscRandom rand; /* random number generator */
void *data; /* placeholder for misc stuff associated
with a particular solver */
PetscInt setupcalled;
SVDConvergedReason reason;
IP ip;
PetscTruth trackall;
PetscErrorCode (*monitor[MAXSVDMONITORS])(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,void*);
PetscErrorCode (*monitordestroy[MAXSVDMONITORS])(void*);
void *monitorcontext[MAXSVDMONITORS];
PetscInt numbermonitors;
PetscInt matvecs;
};
 
EXTERN PetscErrorCode SVDRegisterAll(char *);
EXTERN PetscErrorCode SVDInitializePackage(char*);
EXTERN PetscErrorCode SVDFinalizePackage(void);
 
#define SVDMonitor(svd,it,nconv,sigma,errest,nest) \
{ PetscErrorCode _ierr; PetscInt _i,_im = svd->numbermonitors; \
for ( _i=0; _i<_im; _i++ ) {\
_ierr=(*svd->monitor[_i])(svd,it,nconv,sigma,errest,nest,svd->monitorcontext[_i]);\
CHKERRQ(_ierr); \
} \
}
 
/* context for SVDMonitorConverged */
typedef struct {
PetscViewerASCIIMonitor viewer;
PetscInt oldnconv;
} SVDMONITOR_CONV;
EXTERN PetscErrorCode SVDMonitorDestroy_Converged(SVDMONITOR_CONV*);
 
EXTERN PetscErrorCode SVDDestroy_Default(SVD);
EXTERN PetscErrorCode SVDMatMult(SVD,PetscTruth,Vec,Vec);
EXTERN PetscErrorCode SVDMatGetVecs(SVD,Vec*,Vec*);
EXTERN PetscErrorCode SVDMatGetSize(SVD,PetscInt*,PetscInt*);
EXTERN PetscErrorCode SVDMatGetLocalSize(SVD,PetscInt*,PetscInt*);
EXTERN PetscErrorCode SVDTwoSideLanczos(SVD,PetscReal*,PetscReal*,Vec*,Vec,Vec*,PetscInt,PetscInt,PetscScalar*);
 
#endif
slepc-3_1-2/include/private/svdimpl.h Property changes : Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
/tags/slepc-3_1-2/include/private/makefile New file
0,0 → 1,34
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# SLEPc - Scalable Library for Eigenvalue Problem Computations
# Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
#
# This file is part of SLEPc.
#
# 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/>.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
 
CFLAGS =
FFLAGS =
SOURCEC =
SOURCEF =
SOURCEH = epsimpl.h stimpl.h svdimpl.h ipimpl.h
OBJSC =
OBJSF =
LIBBASE = libslepc
DIRS =
LOCDIR = include/
MANSEC =
 
include ${SLEPC_DIR}/conf/slepc_common
slepc-3_1-2/include/private/makefile Property changes : Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
/tags/slepc-3_1-2/include/private/qepimpl.h New file
0,0 → 1,126
/*
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SLEPc - Scalable Library for Eigenvalue Problem Computations
Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
 
This file is part of SLEPc.
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 _QEPIMPL
#define _QEPIMPL
 
#include "slepcqep.h"
 
extern PetscFList QEPList;
extern PetscLogEvent QEP_SetUp, QEP_Solve, QEP_Dense;
 
typedef struct _QEPOps *QEPOps;
 
struct _QEPOps {
PetscErrorCode (*solve)(QEP);
PetscErrorCode (*setup)(QEP);
PetscErrorCode (*setfromoptions)(QEP);
PetscErrorCode (*publishoptions)(QEP);
PetscErrorCode (*destroy)(QEP);
PetscErrorCode (*view)(QEP,PetscViewer);
};
 
/*
Maximum number of monitors you can run with a single QEP
*/
#define MAXQEPMONITORS 5
 
/*
Defines the QEP data structure.
*/
struct _p_QEP {
PETSCHEADER(struct _QEPOps);
/*------------------------- User parameters --------------------------*/
PetscInt max_it, /* maximum number of iterations */
nev, /* number of eigenvalues to compute */
ncv, /* number of basis vectors */
mpd, /* maximum dimension of projected problem */
nini, ninil; /* number of initial vectors (negative means not copied yet) */
PetscReal tol; /* tolerance */
PetscReal sfactor; /* scaling factor of the quadratic problem */
PetscErrorCode (*conv_func)(QEP,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*);
void *conv_ctx;
QEPWhich which; /* which part of the spectrum to be sought */
PetscTruth leftvecs; /* if left eigenvectors are requested */
PetscErrorCode (*which_func)(QEP,PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*);
void *which_ctx;
QEPProblemType problem_type; /* which kind of problem to be solved */
PetscTruth trackall; /* whether all the residuals must be computed */
 
/*------------------------- Working data --------------------------*/
Mat M,C,K; /* problem matrices */
Vec *V, /* set of basis vectors and computed eigenvectors */
*W, /* set of left basis vectors and computed left eigenvectors */
*IS, *ISL; /* placeholder for references to user-provided initial space */
PetscScalar *eigr, *eigi, /* real and imaginary parts of eigenvalues */
*T; /* matrix for projected eigenproblem */
PetscReal *errest; /* error estimates */
IP ip; /* innerproduct object */
void *data; /* placeholder for misc stuff associated
with a particular solver */
PetscInt nconv, /* number of converged eigenvalues */
its, /* number of iterations so far computed */
*perm, /* permutation for eigenvalue ordering */
matvecs, linits, /* operation counters */
n, nloc; /* problem dimensions (global, local) */
PetscRandom rand; /* random number generator */
 
/* ---------------- Default work-area and status vars -------------------- */
PetscInt nwork;
Vec *work;
 
PetscInt setupcalled;
QEPConvergedReason reason;
 
PetscErrorCode (*monitor[MAXQEPMONITORS])(QEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*);
PetscErrorCode (*monitordestroy[MAXQEPMONITORS])(void*);
void *monitorcontext[MAXQEPMONITORS];
PetscInt numbermonitors;
};
 
#define QEPMonitor(qep,it,nconv,eigr,eigi,errest,nest) \
{ PetscErrorCode _ierr; PetscInt _i,_im = qep->numbermonitors; \
for ( _i=0; _i<_im; _i++ ) {\
_ierr=(*qep->monitor[_i])(qep,it,nconv,eigr,eigi,errest,nest,qep->monitorcontext[_i]);\
CHKERRQ(_ierr); \
} \
}
 
/* context for QEPMonitorConverged */
typedef struct {
PetscViewerASCIIMonitor viewer;
PetscInt oldnconv;
} QEPMONITOR_CONV;
EXTERN PetscErrorCode QEPMonitorDestroy_Converged(QEPMONITOR_CONV*);
 
EXTERN PetscErrorCode QEPRegisterAll(char *);
EXTERN PetscErrorCode QEPInitializePackage(char *);
EXTERN PetscErrorCode QEPFinalizePackage(void);
 
EXTERN PetscErrorCode QEPDestroy_Default(QEP);
EXTERN PetscErrorCode QEPDefaultGetWork(QEP,PetscInt);
EXTERN PetscErrorCode QEPDefaultFreeWork(QEP);
EXTERN PetscErrorCode QEPComputeVectors_Schur(QEP);
EXTERN PetscErrorCode QEPComputeResidualNorm_Private(QEP,PetscScalar,PetscScalar,Vec,Vec,PetscReal*);
EXTERN PetscErrorCode QEPComputeRelativeError_Private(QEP,PetscScalar,PetscScalar,Vec,Vec,PetscReal*);
EXTERN PetscErrorCode QEPKrylovConvergence(QEP,PetscInt,PetscInt,PetscScalar*,PetscInt,PetscScalar*,PetscInt,PetscReal,PetscInt*,PetscScalar*);
 
#endif
/tags/slepc-3_1-2/include/private/slepcimpl.h New file
0,0 → 1,31
/*
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SLEPc - Scalable Library for Eigenvalue Problem Computations
Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
 
This file is part of SLEPc.
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 _SLEPCIMPL
#define _SLEPCIMPL
 
#include "slepcsys.h"
 
/* Private functions that are shared by several classes */
 
EXTERN PetscErrorCode DenseSelectedEvec(PetscScalar*,PetscInt,PetscScalar*,PetscScalar*,PetscInt,PetscTruth,PetscInt,PetscScalar*);
 
#endif
/tags/slepc-3_1-2/include/private/stimpl.h New file
0,0 → 1,81
/*
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SLEPc - Scalable Library for Eigenvalue Problem Computations
Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
 
This file is part of SLEPc.
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 _STIMPL
#define _STIMPL
 
#include "slepceps.h"
 
extern PetscLogEvent ST_SetUp, ST_Apply, ST_ApplyB, ST_ApplyTranspose;
extern PetscFList STList;
 
typedef struct _STOps *STOps;
 
struct _STOps {
PetscErrorCode (*setup)(ST);
PetscErrorCode (*apply)(ST,Vec,Vec);
PetscErrorCode (*getbilinearform)(ST,Mat*);
PetscErrorCode (*applytrans)(ST,Vec,Vec);
PetscErrorCode (*setshift)(ST,PetscScalar);
PetscErrorCode (*setfromoptions)(ST);
PetscErrorCode (*postsolve)(ST);
PetscErrorCode (*backtr)(ST,PetscInt,PetscScalar*,PetscScalar*);
PetscErrorCode (*destroy)(ST);
PetscErrorCode (*view)(ST,PetscViewer);
};
 
struct _p_ST {
PETSCHEADER(struct _STOps);
/*------------------------- User parameters --------------------------*/
Mat A,B; /* Matrices which define the eigensystem */
PetscScalar sigma; /* Value of the shift */
PetscTruth sigma_set; /* whether the user provided the shift or not */
PetscScalar defsigma; /* Default value of the shift */
STMatMode shift_matrix;
MatStructure str; /* whether matrices have the same pattern or not */
Mat mat;
 
/*------------------------- Misc data --------------------------*/
KSP ksp;
Vec w;
Vec D; /* diagonal matrix for balancing */
Vec wb; /* balancing requires an extra work vector */
void *data;
PetscInt setupcalled;
PetscInt lineariterations;
PetscInt applys;
PetscErrorCode (*checknullspace)(ST,PetscInt,const Vec[]);
};
 
EXTERN PetscErrorCode STRegisterAll(char*);
EXTERN PetscErrorCode STInitializePackage(char*);
EXTERN PetscErrorCode STFinalizePackage(void);
 
EXTERN PetscErrorCode STGetBilinearForm_Default(ST,Mat*);
EXTERN PetscErrorCode STView_Default(ST,PetscViewer);
EXTERN PetscErrorCode STAssociatedKSPSolve(ST,Vec,Vec);
EXTERN PetscErrorCode STAssociatedKSPSolveTranspose(ST,Vec,Vec);
EXTERN PetscErrorCode STCheckNullSpace_Default(ST,PetscInt,const Vec[]);
EXTERN PetscErrorCode STMatShellCreate(ST st,Mat *mat);
 
#endif
 
slepc-3_1-2/include/private/stimpl.h Property changes : Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
/tags/slepc-3_1-2/include/slepcblaslapack.h New file
0,0 → 1,337
/*
 
Necessary routines in BLAS and LAPACK not included in petscblaslapack.f
 
 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SLEPc - Scalable Library for Eigenvalue Problem Computations
Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
 
This file is part of SLEPc.
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/>.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
 
#if !defined(__SLEPCBLASLAPACK_H)
#define __SLEPCBLASLAPACK_H
#include "petscblaslapack.h"
 
/* Macros for building LAPACK names */
#if defined(PETSC_BLASLAPACK_UNDERSCORE)
#if defined(PETSC_USE_SINGLE)
#define SLEPC_BLASLAPACKREAL(lcase,ucase) s##lcase##_
#if defined(PETSC_USE_COMPLEX)
#define SLEPC_BLASLAPACK(lcase,ucase) c##lcase##_
#else
#define SLEPC_BLASLAPACK(lcase,ucase) s##lcase##_
#endif
#else
#define SLEPC_BLASLAPACKREAL(lcase,ucase) d##lcase##_
#if defined(PETSC_USE_COMPLEX)
#define SLEPC_BLASLAPACK(lcase,ucase) z##lcase##_
#else
#define SLEPC_BLASLAPACK(lcase,ucase) d##lcase##_
#endif
#endif
 
#elif defined(PETSC_BLASLAPACK_CAPS) || defined(PETSC_BLASLAPACK_STDCALL)
#if defined(PETSC_USE_SINGLE)
#define SLEPC_BLASLAPACKREAL(lcase,ucase) S##ucase
#if defined(PETSC_USE_COMPLEX)
#define SLEPC_BLASLAPACK(lcase,ucase) C##ucase
#else
#define SLEPC_BLASLAPACK(lcase,ucase) S##ucase
#endif
#else
#define SLEPC_BLASLAPACKREAL(lcase,ucase) D##ucase
#if defined(PETSC_USE_COMPLEX)
#define SLEPC_BLASLAPACK(lcase,ucase) Z##ucase
#else
#define SLEPC_BLASLAPACK(lcase,ucase) D##ucase
#endif
#endif
 
#else
#if defined(PETSC_USE_SINGLE)
#define SLEPC_BLASLAPACKREAL(lcase,ucase) s##lcase
#if defined(PETSC_USE_COMPLEX)
#define SLEPC_BLASLAPACK(lcase,ucase) c##lcase
#else
#define SLEPC_BLASLAPACK(lcase,ucase) s##lcase
#endif
#else
#define SLEPC_BLASLAPACKREAL(lcase,ucase) d##lcase
#if defined(PETSC_USE_COMPLEX)
#define SLEPC_BLASLAPACK(lcase,ucase) z##lcase
#else
#define SLEPC_BLASLAPACK(lcase,ucase) d##lcase
#endif
#endif
 
#endif
 
/* LAPACK functions without string parameters */
#define LAPACKlaev2_ SLEPC_BLASLAPACK(laev2,LAEV2)
#define LAPACKgehrd_ SLEPC_BLASLAPACK(gehrd,GEHRD)
#define LAPACKgetri_ SLEPC_BLASLAPACK(getri,GETRI)
#define LAPACKgelqf_ SLEPC_BLASLAPACK(gelqf,GELQF)
#if !defined(PETSC_USE_COMPLEX)
#define LAPACKorghr_ SLEPC_BLASLAPACK(orghr,ORGHR)
#else
#define LAPACKorghr_ SLEPC_BLASLAPACK(unghr,UNGHR)
#endif
#if !defined(PETSC_USE_COMPLEX)
#define LAPACKorgqr_ SLEPC_BLASLAPACK(orgqr,ORGQR)
#else
#define LAPACKorgqr_ SLEPC_BLASLAPACK(ungqr,UNGQR)
#endif
#define LAPACKtgexc_ SLEPC_BLASLAPACK(tgexc,TGEXC)
#define LAPACKlag2_ SLEPC_BLASLAPACKREAL(lag2,LAG2)
 
/* LAPACK functions with string parameters */
#if !defined(PETSC_BLASLAPACK_STDCALL)
 
#define BLAStrsm_(a,b,c,d,e,f,g,h,i,j,k) SLEPC_BLASLAPACK(trsm,TRSM) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),1,1,1,1)
#define BLASsymm_(a,b,c,d,e,f,g,h,i,j,k,l) SLEPC_BLASLAPACK(symm,SYMM) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),1,1)
#define LAPACKlanhs_(a,b,c,d,e) SLEPC_BLASLAPACK(lanhs,LANHS) ((a),(b),(c),(d),(e),1)
#define LAPACKlange_(a,b,c,d,e,f) SLEPC_BLASLAPACK(lange,LANGE) ((a),(b),(c),(d),(e),(f),1)
#define LAPACKstevr_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t) SLEPC_BLASLAPACKREAL(stevr,STEVR) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),1,1)
#define LAPACKbdsdc_(a,b,c,d,e,f,g,h,i,j,k,l,m,n) SLEPC_BLASLAPACKREAL(bdsdc,BDSDC) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),1,1)
#define LAPACKggevx_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,ab,ac) SLEPC_BLASLAPACK(ggevx,GGEVX) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),(u),(v),(w),(x),(y),(z),(aa),(ab),(ac),1,1,1,1)
#define LAPACKggev_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) SLEPC_BLASLAPACK(ggev,GGEV) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),1,1)
#define LAPACKsteqr_(a,b,c,d,e,f,g,h) SLEPC_BLASLAPACKREAL(steqr,STEQR) ((a),(b),(c),(d),(e),(f),(g),(h),1)
#define LAPACKorgtr_(a,b,c,d,e,f,g,h) SLEPC_BLASLAPACKREAL(orgtr,ORGTR) ((a),(b),(c),(d),(e),(f),(g),(h),1)
#define LAPACKsytrd_(a,b,c,d,e,f,g,h,i,j) SLEPC_BLASLAPACKREAL(sytrd,SYTRD) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),1)
#define LAPACKpbtrf_(a,b,c,d,e,f) SLEPC_BLASLAPACK(pbtrf,PBTRF) ((a),(b),(c),(d),(e),(f),1)
#define LAPACKlamch_(a) SLEPC_BLASLAPACKREAL(lamch,LAMCH) ((a),1)
 
#if !defined(PETSC_USE_COMPLEX)
#define BLAShemm_(a,b,c,d,e,f,g,h,i,j,k,l) SLEPC_BLASLAPACK(symm,SYMM) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),1,1)
#define LAPACKsyevr_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u) SLEPC_BLASLAPACK(syevr,SYEVR) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),(u),1,1,1)
#define LAPACKsygvd_(a,b,c,d,e,f,g,h,i,j,k,l,m,n) SLEPC_BLASLAPACK(sygvd,SYGVD) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),1,1)
#define LAPACKormlq_(a,b,c,d,e,f,g,h,i,j,k,l,m) SLEPC_BLASLAPACK(ormlq,ORMLQ) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),1,1)
#define LAPACKtrevc_(a,b,c,d,e,f,g,h,i,j,k,l,m,n) SLEPC_BLASLAPACK(trevc,TREVC) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),1,1)
#define LAPACKgeevx_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w) SLEPC_BLASLAPACK(geevx,GEEVX) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),(u),(v),(w),1,1,1,1)
#define LAPACKhseqr_(a,b,c,d,e,f,g,h,i,j,k,l,m,n) SLEPC_BLASLAPACK(hseqr,HSEQR) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),1,1)
#define LAPACKtrexc_(a,b,c,d,e,f,g,h,i,j) SLEPC_BLASLAPACK(trexc,TREXC) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),1)
#define LAPACKgesdd_(a,b,c,d,e,f,g,h,i,j,k,l,m,n) SLEPC_BLASLAPACK(gesdd,GESDD) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),1)
#define LAPACKgges_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u) SLEPC_BLASLAPACK(gges,GGES) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),(u),1,1,1)
#define LAPACKtgevc_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) SLEPC_BLASLAPACK(tgevc,TGEVC) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),1,1)
#else
#define BLAShemm_(a,b,c,d,e,f,g,h,i,j,k,l) SLEPC_BLASLAPACK(hemm,HEMM) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),1,1)
#define LAPACKsyevr_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w) SLEPC_BLASLAPACK(heevr,HEEVR) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),(u),(v),(w),1,1,1)
#define LAPACKsygvd_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) SLEPC_BLASLAPACK(hegvd,HEGVD) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),1,1)
#define LAPACKormlq_(a,b,c,d,e,f,g,h,i,j,k,l,m) SLEPC_BLASLAPACK(unmlq,UNMLQ) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),1,1)
#define LAPACKtrevc_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) SLEPC_BLASLAPACK(trevc,TREVC) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),1,1)
#define LAPACKgeevx_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v) SLEPC_BLASLAPACK(geevx,GEEVX) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),(u),(v),1,1,1,1)
#define LAPACKhseqr_(a,b,c,d,e,f,g,h,i,j,k,l,m) SLEPC_BLASLAPACK(hseqr,HSEQR) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),1,1)
#define LAPACKtrexc_(a,b,c,d,e,f,g,h,i) SLEPC_BLASLAPACK(trexc,TREXC) ((a),(b),(c),(d),(e),(f),(g),(h),(i),1)
#define LAPACKgesdd_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) SLEPC_BLASLAPACK(gesdd,GESDD) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),1)
#define LAPACKgges_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u) SLEPC_BLASLAPACK(gges,GGES) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),(u),1,1,1)
#define LAPACKtgevc_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) SLEPC_BLASLAPACK(tgevc,TGEVC) ((a),(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),1,1)
#endif
 
#else /* PETSC_BLASLAPACK_STDCALL */
 
#define BLAStrsm_(a,b,c,d,e,f,g,h,i,j,k) SLEPC_BLASLAPACK(trsm,TRSM) ((a),1,(b),1,(c),1,(d),1,(e),(f),(g),(h),(i),(j),(k))
#define BLASsymm_(a,b,c,d,e,f,g,h,i,j,k,l) SLEPC_BLASLAPACK(symm,SYMM) ((a),1,(b),1,(c),(d),(e),(f),(g),(h),(i),(j),(k),(l))
#define LAPACKlanhs_(a,b,c,d,e) SLEPC_BLASLAPACK(lanhs,LANHS) ((a),1,(b),(c),(d),(e))
#define LAPACKlange_(a,b,c,d,e,f) SLEPC_BLASLAPACK(lange,LANGE) ((a),1,(b),(c),(d),(e),(f))
#define LAPACKstevr_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t) SLEPC_BLASLAPACKREAL(stevr,STEVR) ((a),1,(b),1,(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t))
#define LAPACKbdsdc_(a,b,c,d,e,f,g,h,i,j,k,l,m,n) SLEPC_BLASLAPACKREAL(bdsdc,BDSDC) ((a),1,(b),1,(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n))
#define LAPACKggevx_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,ab,ac) SLEPC_BLASLAPACK(ggevx,GGEVX) ((a),1,(b),1,(c),1,(d),1,(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),(u),(v),(w),(x),(y),(z),(aa),(ab),(ac))
#define LAPACKggev_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) SLEPC_BLASLAPACK(ggev,GGEV) ((a),1,(b),1,(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q))
#define LAPACKsteqr_(a,b,c,d,e,f,g,h) SLEPC_BLASLAPACKREAL(steqr,STEQR) ((a),1,(b),(c),(d),(e),(f),(g),(h))
#define LAPACKorgtr_(a,b,c,d,e,f,g,h) SLEPC_BLASLAPACKREAL(orgtr,ORGTR) ((a),1,(b),(c),(d),(e),(f),(g),(h))
#define LAPACKsytrd_(a,b,c,d,e,f,g,h,i,j) SLEPC_BLASLAPACKREAL(sytrd,SYTRD) ((a),1,(b),(c),(d),(e),(f),(g),(h),(i),(j))
#define LAPACKpbtrf_(a,b,c,d,e,f) SLEPC_BLASLAPACK(pbtrf,PBTRF) ((a),1,(b),(c),(d),(e),(f))
#define LAPACKlamch_(a) SLEPC_BLASLAPACKREAL(lamch,LAMCH) ((a),1)
 
#if !defined(PETSC_USE_COMPLEX)
#define BLAShemm_(a,b,c,d,e,f,g,h,i,j,k,l) SLEPC_BLASLAPACK(symm,SYMM) ((a),1,(b),1,(c),(d),(e),(f),(g),(h),(i),(j),(k),(l))
#define LAPACKsyevr_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u) SLEPC_BLASLAPACK(syevr,SYEVR) ((a),1,(b),1,(c),1,(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),(u))
#define LAPACKsygvd_(a,b,c,d,e,f,g,h,i,j,k,l,m,n) SLEPC_BLASLAPACK(sygvd,SYGVD) ((a),(b),1,(c),1,(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n))
#define LAPACKormlq_(a,b,c,d,e,f,g,h,i,j,k,l,m) SLEPC_BLASLAPACK(ormlq,ORMLQ) ((a),1,(b),1,(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m))
#define LAPACKtrevc_(a,b,c,d,e,f,g,h,i,j,k,l,m,n) SLEPC_BLASLAPACK(trevc,TREVC) ((a),1,(b),1,(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n))
#define LAPACKgeevx_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w) SLEPC_BLASLAPACK(geevx,GEEVX) ((a),1,(b),1,(c),1,(d),1,(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),(u),(v),(w))
#define LAPACKhseqr_(a,b,c,d,e,f,g,h,i,j,k,l,m,n) SLEPC_BLASLAPACK(hseqr,HSEQR) ((a),1,(b),1,(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n))
#define LAPACKtrexc_(a,b,c,d,e,f,g,h,i,j) SLEPC_BLASLAPACK(trexc,TREXC) ((a),1,(b),(c),(d),(e),(f),(g),(h),(i),(j))
#define LAPACKgesdd_(a,b,c,d,e,f,g,h,i,j,k,l,m,n) SLEPC_BLASLAPACK(gesdd,GESDD) ((a),1,(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n))
#define LAPACKgges_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u) SLEPC_BLASLAPACK(gges,GGES) ((a),1,(b),1,(c),1,(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),(u))
#define LAPACKtgevc_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) SLEPC_BLASLAPACK(tgevc,TGEVC) ((a),1,(b),1,(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p))
#else
#define BLAShemm_(a,b,c,d,e,f,g,h,i,j,k,l) SLEPC_BLASLAPACK(hemm,HEMM) ((a),1,(b),1,(c),(d),(e),(f),(g),(h),(i),(j),(k),(l))
#define LAPACKsyevr_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w) SLEPC_BLASLAPACK(heevr,HEEVR) ((a),1,(b),1,(c),1,(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),(u),(v),(w))
#define LAPACKsygvd_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) SLEPC_BLASLAPACK(hegvd,HEGVD) ((a),(b),1,(c),1,(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p))
#define LAPACKormlq_(a,b,c,d,e,f,g,h,i,j,k,l,m) SLEPC_BLASLAPACK(unmlq,UNMLQ) ((a),1,(b),1,(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m))
#define LAPACKtrevc_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) SLEPC_BLASLAPACK(trevc,TREVC) ((a),1,(b),1,(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o))
#define LAPACKgeevx_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v) SLEPC_BLASLAPACK(geevx,GEEVX) ((a),1,(b),1,(c),1,(d),1,(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),(u),(v))
#define LAPACKhseqr_(a,b,c,d,e,f,g,h,i,j,k,l,m) SLEPC_BLASLAPACK(hseqr,HSEQR) ((a),1,(b),1,(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m))
#define LAPACKtrexc_(a,b,c,d,e,f,g,h,i) SLEPC_BLASLAPACK(trexc,TREXC) ((a),1,(b),(c),(d),(e),(f),(g),(h),(i))
#define LAPACKgesdd_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) SLEPC_BLASLAPACK(gesdd,GESDD) ((a),1,(b),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o))
#define LAPACKgges_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u) SLEPC_BLASLAPACK(gges,GGES) ((a),1,(b),1,(c),1,(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q),(r),(s),(t),(u))
#define LAPACKtgevc_(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) SLEPC_BLASLAPACK(tgevc,TGEVC) ((a),1,(b),1,(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m),(n),(o),(p),(q))
#endif
 
#endif
 
PETSC_EXTERN_CXX_BEGIN
EXTERN_C_BEGIN
 
#if !defined(PETSC_BLASLAPACK_STDCALL)
 
/* LAPACK functions without string parameters */
EXTERN void SLEPC_BLASLAPACK(laev2,LAEV2) (PetscScalar*,PetscScalar*,PetscScalar*,PetscReal*,PetscReal*,PetscReal*,PetscScalar*);
EXTERN void SLEPC_BLASLAPACK(gehrd,GEHRD) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
EXTERN void SLEPC_BLASLAPACK(getri,GETRI) (PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
EXTERN void SLEPC_BLASLAPACK(gelqf,GELQF) (PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
#if !defined(PETSC_USE_COMPLEX)
EXTERN void SLEPC_BLASLAPACK(orghr,ORGHR) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
EXTERN void SLEPC_BLASLAPACK(tgexc,TGEXC) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
#else
EXTERN void SLEPC_BLASLAPACK(unghr,UNGHR) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
EXTERN void SLEPC_BLASLAPACK(tgexc,TGEXC) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*);
#endif
#if !defined(PETSC_USE_COMPLEX)
EXTERN void SLEPC_BLASLAPACK(orgqr,ORGQR) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
#else
EXTERN void SLEPC_BLASLAPACK(ungqr,UNGQR) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
#endif
#if !defined(PETSC_USE_COMPLEX)
EXTERN void SLEPC_BLASLAPACK(tgexc,TGEXC) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
#else
EXTERN void SLEPC_BLASLAPACK(tgexc,TGEXC) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*);
#endif
EXTERN void SLEPC_BLASLAPACKREAL(lag2,LAG2) (PetscReal*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*);
 
/* LAPACK functions with string parameters */
EXTERN void SLEPC_BLASLAPACK(trsm,TRSM) (const char*,const char*,const char*,const char*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt,PetscBLASInt,PetscBLASInt,PetscBLASInt);
EXTERN void SLEPC_BLASLAPACK(symm,SYMM) (const char*,const char*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*, PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt,PetscBLASInt);
EXTERN PetscReal SLEPC_BLASLAPACK(lanhs,LANHS) (const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt);
EXTERN PetscReal SLEPC_BLASLAPACK(lange,LANGE) (const char*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt);
EXTERN void SLEPC_BLASLAPACKREAL(stevr,STEVR) (const char*,const char*,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscReal*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt);
EXTERN void SLEPC_BLASLAPACKREAL(bdsdc,BDSDC) (const char*,const char*,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt);
EXTERN void SLEPC_BLASLAPACKREAL(steqr,STEQR) (const char*,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt);
EXTERN void SLEPC_BLASLAPACKREAL(orgtr,ORGTR) (const char*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscReal*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt);
EXTERN void SLEPC_BLASLAPACKREAL(sytrd,SYTRD) (const char*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt);
EXTERN PetscReal SLEPC_BLASLAPACK(pbtrf,PBTRF) (const char*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt);
EXTERN PetscReal SLEPC_BLASLAPACKREAL(lamch,LAMCH) (const char*,PetscBLASInt);
 
#if !defined(PETSC_USE_COMPLEX)
EXTERN void SLEPC_BLASLAPACK(hseqr,HSEQR) (const char*,const char*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt);
EXTERN void SLEPC_BLASLAPACK(trexc,TREXC) (const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt);
EXTERN void SLEPC_BLASLAPACK(trevc,TREVC) (const char*,const char*,PetscTruth*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt,PetscBLASInt);
EXTERN void SLEPC_BLASLAPACK(geevx,GEEVX) (const char*,const char*,const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt,PetscBLASInt,PetscBLASInt);
EXTERN void SLEPC_BLASLAPACK(ggevx,GGEVX) (const char*,const char*,const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt,PetscBLASInt,PetscBLASInt);
EXTERN void SLEPC_BLASLAPACK(ggev,GGEV) (const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt);
EXTERN void SLEPC_BLASLAPACK(syevr,SYEVR) (const char*,const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt,PetscBLASInt);
EXTERN void SLEPC_BLASLAPACK(sygvd,SYGVD) (PetscBLASInt*,const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt);
EXTERN void SLEPC_BLASLAPACK(gesdd,GESDD) (const char*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt);
EXTERN void SLEPC_BLASLAPACK(ormlq,ORMLQ) (const char*,const char*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt);
EXTERN void SLEPC_BLASLAPACK(gges,GGES) (const char*,const char*,const char*,PetscBLASInt(*)(),PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt,PetscBLASInt);
EXTERN void SLEPC_BLASLAPACK(tgevc,TGEVC) (const char*,const char*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt,PetscBLASInt);
#else
EXTERN void SLEPC_BLASLAPACK(hemm,HEMM) (const char*,const char*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*, PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt,PetscBLASInt);
EXTERN void SLEPC_BLASLAPACK(hseqr,HSEQR) (const char*,const char*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt);
EXTERN void SLEPC_BLASLAPACK(trexc,TREXC) (const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt);
EXTERN void SLEPC_BLASLAPACK(trevc,TREVC) (const char*,const char*,PetscTruth*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscReal*,PetscBLASInt*,PetscBLASInt,PetscBLASInt);
EXTERN void SLEPC_BLASLAPACK(geevx,GEEVX) (const char*,const char*,const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt,PetscBLASInt,PetscBLASInt,PetscBLASInt);
EXTERN void SLEPC_BLASLAPACK(ggevx,GGEVX) (const char*,const char*,const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*, PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscScalar*, PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt,PetscBLASInt,PetscBLASInt);
EXTERN void SLEPC_BLASLAPACK(ggev,GGEV) (const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt,PetscBLASInt);
EXTERN void SLEPC_BLASLAPACK(heevr,HEEVR) (const char *,const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscBLASInt*, PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt,PetscBLASInt);
EXTERN void SLEPC_BLASLAPACK(hegvd,HEGVD) (PetscBLASInt*,const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt);
EXTERN void SLEPC_BLASLAPACK(gesdd,GESDD) (const char*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt);
EXTERN void SLEPC_BLASLAPACK(unmlq,UNMLQ) (const char*,const char*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt);
EXTERN void SLEPC_BLASLAPACK(ungtr,UNGTR) (const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt);
EXTERN void SLEPC_BLASLAPACK(hetrd,HETRD) (const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscReal*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt);
EXTERN void SLEPC_BLASLAPACK(gges,GGES) (const char*,const char*,const char*,PetscBLASInt(*)(),PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt,PetscBLASInt,PetscBLASInt);
EXTERN void SLEPC_BLASLAPACK(tgevc,TGEVC) (const char*,const char*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscReal*,PetscBLASInt*,PetscBLASInt,PetscBLASInt);
#endif
 
#else /* PETSC_BLASLAPACK_STDCALL */
 
/* LAPACK functions without string parameters */
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(laev2,LAEV2) (PetscScalar*,PetscScalar*,PetscScalar*,PetscReal*,PetscReal*,PetscReal*,PetscScalar*);
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(gehrd,GEHRD) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(getri,GETRI) (PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(gelqf,GELQF) (PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
#if !defined(PETSC_USE_COMPLEX)
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(orghr,ORGHR) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(tgexc,TGEXC) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
#else
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(unghr,UNGHR) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(tgexc,TGEXC) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*);
#endif
#if !defined(PETSC_USE_COMPLEX)
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(orgqr,ORGQR) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
#else
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(ungqr,UNGQR) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
#endif
#if !defined(PETSC_USE_COMPLEX)
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(tgexc,TGEXC) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
#else
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(tgexc,TGEXC) (PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*);
#endif
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACKREAL(lag2,LAG2) (PetscReal*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*);
 
/* LAPACK functions with string parameters */
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(trsm,TRSM) (const char*,PetscBLASInt,const char*,PetscBLASInt,const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*);
EXTERN void SLEPC_BLASLAPACK(symm,SYMM) (const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*, PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*);
EXTERN PetscReal PETSC_STDCALL SLEPC_BLASLAPACK(lanhs,LANHS) (const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*);
EXTERN PetscReal PETSC_STDCALL SLEPC_BLASLAPACK(lange,LANGE) (const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*);
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACKREAL(stevr,STEVR) (const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscReal*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*);
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACKREAL(bdsdc,BDSDC) (const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*);
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACKREAL(steqr,STEQR) (const char*,PetscBLASInt,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscBLASInt*,PetscReal*,PetscBLASInt*);
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACKREAL(orgtr,ORGTR) (const char*,PetscBLASInt,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscReal*,PetscReal*,PetscBLASInt*,PetscBLASInt*);
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACKREAL(sytrd,SYTRD) (const char*,PetscBLASInt,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscBLASInt*,PetscBLASInt*);
EXTERN PetscReal PETSC_STDCALL SLEPC_BLASLAPACK(pbtrf,PBTRF) (const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
EXTERN PetscReal SLEPC_BLASLAPACKREAL(lamch,LAMCH) (const char*,PetscBLASInt);
 
#if !defined(PETSC_USE_COMPLEX)
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(hseqr,HSEQR) (const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(trexc,TREXC) (const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*);
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(trevc,TREVC) (const char*,PetscBLASInt,const char*,PetscBLASInt,PetscTruth*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*);
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(geevx,GEEVX) (const char*,PetscBLASInt,const char*,PetscBLASInt,const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*);
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(ggevx,GGEVX) (const char*,PetscBLASInt,const char*,PetscBLASInt,const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*);
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(ggev,GGEV) (const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(syevr,SYEVR) (const char*,PetscBLASInt,const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*);
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(sygvd,SYGVD) (PetscBLASInt*,const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*);
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(gesdd,GESDD) (const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*);
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(ormlq,ORMLQ) (const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(gges,GGES) (const char*,PetscBLASInt,const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt(*)(...),PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*);
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(tgevc,TGEVC) (const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*);
#else
EXTERN void SLEPC_BLASLAPACK(hemm,HEMM) (const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*, PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*);
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(hseqr,HSEQR) (const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(trexc,TREXC) (const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*);
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(trevc,TREVC) (const char*,PetscBLASInt,const char*,PetscBLASInt,PetscTruth*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscReal*,PetscBLASInt*);
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(geevx,GEEVX) (const char*,PetscBLASInt,const char*,PetscBLASInt,const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*);
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(ggevx,GGEVX) (const char*,PetscBLASInt,const char*,PetscBLASInt,const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*, PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscReal*,PetscScalar*, PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*);
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(ggev,GGEV) (const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*);
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(heevr,HEEVR) (const char*,PetscBLASInt,const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscBLASInt*, PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*);
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(hegvd,HEGVD) (PetscBLASInt*,const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*);
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(gesdd,GESDD) (const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*);
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(unmlq,UNMLQ) (const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(ungtr,UNGTR) (const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(hetrd,HETRD) (const char*,PetscBLASInt,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscReal*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*);
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(gges,GGES) (const char*,PetscBLASInt,const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt(*)(...),PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*);
EXTERN void PETSC_STDCALL SLEPC_BLASLAPACK(tgevc,TGEVC) (const char*,PetscBLASInt,const char*,PetscBLASInt,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscReal*,PetscBLASInt*);
#endif
 
#endif
 
EXTERN_C_END
PETSC_EXTERN_CXX_END
 
#endif
slepc-3_1-2/include/slepcblaslapack.h Property changes : Added: svn:eol-style
+ native
/tags/slepc-3_1-2/include/slepcvec.h New file
0,0 → 1,41
/*
User interface for vectors composed by vectors.
 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SLEPc - Scalable Library for Eigenvalue Problem Computations
Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
 
This file is part of SLEPc.
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/>.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
 
#if !defined(__SLEPCVEC_H)
#define __SLEPCVEC_H
PETSC_EXTERN_CXX_BEGIN
 
#define VECCOMP "comp"
 
PetscErrorCode PETSCVEC_DLLEXPORT VecRegister_Comp(const char path[]);
PetscErrorCode PETSCVEC_DLLEXPORT VecCreateComp(MPI_Comm comm, PetscInt *Nx,
PetscInt n, const VecType t,
Vec Vparent, Vec *V);
PetscErrorCode PETSCVEC_DLLEXPORT VecCreateCompWithVecs(Vec *x, PetscInt n,
Vec Vparent, Vec *V);
PetscErrorCode VecCompGetVecs(Vec win, const Vec **x, PetscInt *n);
PetscErrorCode VecCompSetVecs(Vec win, Vec *x, PetscInt n);
 
PETSC_EXTERN_CXX_END
#endif
 
/tags/slepc-3_1-2/include/slepcsys.h New file
0,0 → 1,69
/*
This is the main SLEPc include file (for C and C++). It is included
by all other SLEPc include files, so it almost never has to be
specifically included.
 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SLEPc - Scalable Library for Eigenvalue Problem Computations
Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
 
This file is part of SLEPc.
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/>.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
 
#if !defined(__SLEPC_H)
#define __SLEPC_H
 
/* ========================================================================== */
/*
Current SLEPc version number and release date
*/
#include "slepcversion.h"
 
/* ========================================================================== */
/*
The PETSc include files.
*/
#include "petsc.h"
#include "petscvec.h"
#include "petscmat.h"
 
PETSC_EXTERN_CXX_BEGIN
/*
Initialization of SLEPc and other system routines
*/
EXTERN PetscErrorCode SlepcInitialize(int*,char***,char[],const char[]);
EXTERN PetscErrorCode SlepcFinalize(void);
EXTERN PetscErrorCode SlepcInitializeFortran(void);
 
EXTERN PetscErrorCode SlepcVecSetRandom(Vec,PetscRandom);
EXTERN PetscErrorCode SlepcIsHermitian(Mat,PetscTruth*);
#if !defined(PETSC_USE_COMPLEX)
EXTERN PetscReal SlepcAbsEigenvalue(PetscScalar,PetscScalar);
#else
#define SlepcAbsEigenvalue(x,y) PetscAbsScalar(x)
#endif
EXTERN PetscErrorCode SlepcVecNormalize(Vec,Vec,PetscTruth,PetscReal*);
EXTERN PetscErrorCode SlepcMatConvertSeqDense(Mat,Mat*);
EXTERN PetscErrorCode SlepcCheckOrthogonality(Vec*,PetscInt,Vec *,PetscInt,Mat,PetscScalar*);
EXTERN PetscErrorCode SlepcUpdateVectors(PetscInt,Vec*,PetscInt,PetscInt,const PetscScalar*,PetscInt,PetscTruth);
EXTERN PetscErrorCode SlepcUpdateStrideVectors(PetscInt n_,Vec *V,PetscInt s,PetscInt d,PetscInt e,const PetscScalar *Q,PetscInt ldq_,PetscTruth qtrans);
EXTERN PetscErrorCode SlepcVecMAXPBY(Vec,PetscScalar,PetscScalar,PetscInt,PetscScalar*,Vec*);
extern PetscTruth SlepcInitializeCalled;
 
PETSC_EXTERN_CXX_END
#endif
 
slepc-3_1-2/include/slepcsys.h Property changes : Added: svn:eol-style
+ native
/tags/slepc-3_1-2/include/slepc.h New file
0,0 → 1,31
/*
This is the main SLEPc include file (for C and C++). It is included
by all other SLEPc include files, so it almost never has to be
specifically included.
 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SLEPc - Scalable Library for Eigenvalue Problem Computations
Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
 
This file is part of SLEPc.
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/>.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
 
/*
Include all top-level SLEPc functionality
*/
#include "slepcsvd.h"
#include "slepcsys.h"
 
/tags/slepc-3_1-2/include/makefile New file
0,0 → 1,34
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# SLEPc - Scalable Library for Eigenvalue Problem Computations
# Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
#
# This file is part of SLEPc.
#
# 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/>.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
 
CFLAGS =
FFLAGS =
SOURCEC =
SOURCEF =
SOURCEH = slepc.h slepcsys.h slepceps.h slepcst.h slepcsvd.h slepcip.h slepcversion.h slepcblaslapack.h
OBJSC =
OBJSF =
LIBBASE = libslepc
DIRS = finclude private
LOCDIR = include/
MANSEC =
 
include ${SLEPC_DIR}/conf/slepc_common
slepc-3_1-2/include/makefile Property changes : Added: svn:eol-style
+ native
/tags/slepc-3_1-2/COPYING.LESSER New file
0,0 → 1,165
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
 
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
 
 
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
 
0. Additional Definitions.
 
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
 
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
 
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
 
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
 
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
 
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
 
1. Exception to Section 3 of the GNU GPL.
 
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
 
2. Conveying Modified Versions.
 
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
 
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
 
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
 
3. Object Code Incorporating Material from Library Header Files.
 
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
 
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
 
b) Accompany the object code with a copy of the GNU GPL and this license
document.
 
4. Combined Works.
 
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
 
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
 
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
 
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
 
d) Do one of the following:
 
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
 
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
 
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
 
5. Combined Libraries.
 
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
 
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
 
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
 
6. Revised Versions of the GNU Lesser General Public License.
 
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
 
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
 
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
slepc-3_1-2/COPYING.LESSER Property changes : Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
/tags/slepc-3_1-2/conf/slepc_common_variables New file
0,0 → 1,24
include ${PETSC_DIR}/conf/variables
include ${SLEPC_DIR}/${PETSC_ARCH}/conf/slepcvariables
 
SLEPC_LIB_DIR = ${SLEPC_DIR}/${PETSC_ARCH}/lib
SLEPC_INCLUDE = -I${SLEPC_DIR} -I${SLEPC_DIR}/${PETSC_ARCH}/include -I${SLEPC_DIR}/include
CC_INCLUDES = ${PETSC_INCLUDE} ${SLEPC_INCLUDE}
FC_INCLUDES = ${PETSC_INCLUDE} ${SLEPC_INCLUDE}
 
PCONF = ${SLEPC_HAVE_ARPACK} ${SLEPC_HAVE_BLZPACK} ${SLEPC_HAVE_PLANSO} ${SLEPC_HAVE_TRLAN} ${SLEPC_MISSING_LAPACK} ${SLEPC_HAVE_PRIMME}
SLEPC_EXTERNAL_LIB = ${ARPACK_LIB} ${BLZPACK_LIB} ${PLANSO_LIB} ${TRLAN_LIB} ${PRIMME_LIB}
OTHERSHAREDLIBS = ${SLEPC_EXTERNAL_LIB}
 
INSTALL_LIB_DIR = ${SLEPC_LIB_DIR}
CCPPFLAGS = ${PETSC_CCPPFLAGS} ${SLEPC_INCLUDE} ${PCONF}
FCPPFLAGS = ${PETSC_FCPPFLAGS} ${SLEPC_INCLUDE} ${PCONF}
 
SLEPC_LIB = ${CC_LINKER_SLFLAG}${SLEPC_LIB_DIR} -L${SLEPC_LIB_DIR} -lslepc ${SLEPC_EXTERNAL_LIB} ${PETSC_KSP_LIB}
 
# no longer required
SLEPC_FORTRAN_LIB =
 
SHLIBS = libslepc
LIBNAME = ${INSTALL_LIB_DIR}/${LIBBASE}.${AR_LIB_SUFFIX}
 
slepc-3_1-2/conf/slepc_common_variables Property changes : Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
/tags/slepc-3_1-2/conf/slepc_common_rules New file
0,0 → 1,78
include ${PETSC_DIR}/conf/rules
 
chkslepc_dir:
@mypwd=`pwd`; cd ${true_SLEPC_DIR} 2>&1 > /dev/null; true_SLEPC_DIR=`pwd`; cd $${mypwd} 2>&1 >/dev/null; \
newpwd=`echo $${mypwd} | sed "s+$${true_SLEPC_DIR}+DUMMY+g"`;\
hasslepc=`echo $${mypwd} | sed "s+slepc-+DUMMY+g"`;\
if [ $${mypwd} = $${newpwd} -a $${hasslepc} != $${mypwd} ]; then \
echo "*********************Warning*************************" ; \
echo "Your true_SLEPC_DIR may not match the directory you are in";\
echo "true_SLEPC_DIR " $${true_SLEPC_DIR} "Current directory" $${mypwd};\
echo "******************************************************" ; \
fi
 
slepc_manualpages:
-@if [ "${MANSEC}" != "" ] ; then \
DOCTEXT_PATH=${PETSC_DIR}/src/docs/tex/doctext; export DOCTEXT_PATH; \
${DOCTEXT} -html \
-mpath ${LOC}/docs/manualpages/${MANSEC} -heading SLEPc \
-defn ${SLEPC_DIR}/src/docs/tex/doctext/html.def \
-locdir ${LOCDIR} -mapref ${LOC}/docs/manualpages/manualpages.cit \
${SOURCEC} ${SOURCEH}; \
chmod -f g+w ${LOC}/docs/manualpages/${MANSEC}/* ; fi
 
slepc_html:
-@sed -e s?man+../?man+ROOT/docs/manualpages/? ${LOC}/docs/manualpages/manualpages.cit > /tmp/$$USER.htmlmap
-@cat ${PETSC_DIR}/src/docs/mpi.www.index >> /tmp/$$USER.htmlmap
-@ROOT=`echo ${LOCDIR} | sed -e s?/[a-z]*?/..?g -e s?src/??g -e s?include/??g` ;\
loc=`pwd | sed -e s?\$${PETSC_DIR}?$${LOC}/?g -e s?/disks??g`; \
${MKDIR} -p $${loc} ;\
for i in ${SOURCEC} ${SOURCEF} ${SOURCEH} ${EXAMPLESC} ${EXAMPLESF} ${EXAMPLESCH} ${EXAMPLESFH} ${EXAMPLESMATLAB} foo ; do\
if [ -f $$i ]; then \
iroot=`echo $$i | sed -e "s?[a-z.]*/??g"`;\
IROOT=`echo $${i} | sed -e s?[.][.]??g` ;\
if [ "$${IROOT}" != "$${i}" ] ; then \
IROOT=".."; \
else \
IROOT=$${ROOT};\
fi;\
${RM} $${loc}/$$i.html; \
echo "<center><a href=\"$${iroot}\">Actual source code: $${iroot}</a></center><br>" > $${loc}/$$i.html; \
sed -e "s/CHKERRQ(ierr);//g" -e "s/PetscFunctionReturn(0)/return(0)/g" \
-e "s/ierr [ ]*= //g" $$i | ${C2HTML} -n | ${PETSC_DIR}/bin/maint/fixinclude $$i $${ROOT} | \
egrep -v '(PetscValid|PetscFunctionBegin|PetscCheck|PetscErrorCode ierr;|#if !defined\(__|#define __|#undef __|EXTERN_C|extern )' | \
${MAPNAMES} -map /tmp/$$USER.htmlmap -inhtml | sed -e s?ROOT?$${IROOT}?g >> $${loc}/$$i.html ; \
fi; \
done
-@ROOT=`echo ${LOCDIR} | sed -e s?/[a-z]*?/..?g -e s?src/??g -e s?include/??g` ;\
loc=`pwd | sed -e s?\$${PETSC_DIR}?$${LOC}/?g -e s?/disks??g`; ${RM} $${loc}/index.html; \
cat ${SLEPC_DIR}/src/docs/manualpages-sec/header_${MANSEC} | sed -e "s?<A HREF=\"PETSC_DIR[a-z/]*\">Examples</A>?<A HREF=\"$${ROOT}/docs/manualpages/${MANSEC}\">Manual pages</A>?g" -e "s?PETSC_DIR?$${ROOT}/?g"> $${loc}/index.html; \
echo "<p>" >> $${loc}/index.html
-@loc=`pwd | sed -e s?\$${PETSC_DIR}?$${LOC}/?g -e s?/disks??g`;\
if [ "${EXAMPLESC}" != "" ] ; then \
for file in ${EXAMPLESC} foo ; do \
if [ -f $$file ]; then \
cmess=`grep "static char help" $${file} | cut -d\" -f2 | cut -d\. -f1`; \
echo "<a href=\"$${file}.html\">$${file}: $${cmess}</a><br>" >> $${loc}/index.html;\
fi; \
done ;\
else \
for file in ${DIRS} foo; do \
if [ -d $$file ]; then \
echo "<a href=\"$${file}/\">$${file}/</a><br>" >> $${loc}/index.html; \
fi; \
done; \
echo " " >> $${loc}/index.html; \
for file in ${SOURCEH} ${SOURCEC} ${SOURCEF} foo ; do \
if [ -f $$file ]; then \
echo "<a href=\"$${file}.html\">$${file}</a><br>" >> $${loc}/index.html; \
fi; \
done; \
fi ;\
echo " " >> $${loc}/index.html; \
echo "<a href=\"makefile.html\">makefile</a><br>" >> $${loc}/index.html
-@loc=`pwd | sed -e s?\$${PETSC_DIR}?$${LOC}/?g -e s?/disks??g`; \
cat makefile | ${C2HTML} | ${MAPNAMES} -map /tmp/$$USER.htmlmap -inhtml > $${loc}/makefile.html
-@${RM} /tmp/$$USER.htmlmap tmp
 
include ${SLEPC_DIR}/${PETSC_ARCH}/conf/slepcrules
slepc-3_1-2/conf/slepc_common_rules Property changes : Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
/tags/slepc-3_1-2/conf/slepc_common New file
0,0 → 1,16
#
# SLEPc uses the portable makefile system provided by the PETSc library.
# The following include files set customized site, optimization, and version
# options. Do NOT remove any of these include files!
#
#
# a dummy target which does nothing - just in case
# 'ALL: get mapped into this file'
#
all_dummy:
-@true
 
include ${SLEPC_DIR}/conf/slepc_common_variables
include ${SLEPC_DIR}/conf/slepc_common_rules
include ${PETSC_DIR}/conf/test
 
slepc-3_1-2/conf/slepc_common Property changes : Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
/tags/slepc-3_1-2/config/primme.py New file
0,0 → 1,67
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# SLEPc - Scalable Library for Eigenvalue Problem Computations
# Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
#
# This file is part of SLEPc.
#
# 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/>.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
 
import os
import sys
 
import petscconf
import log
import check
 
def Check(conf,directory,libs):
log.Write('='*80)
log.Println('Checking PRIMME library...')
 
if petscconf.PRECISION == 'single':
sys.exit('ERROR: PRIMME does not support single precision.')
functions_base = ['primme_set_method','primme_Free','primme_initialize']
if directory:
dirs = [directory]
else:
dirs = check.GenerateGuesses('Primme')
 
include = 'PRIMMESRC/COMMONSRC'
if not libs:
libs = ['-lprimme']
if petscconf.SCALAR == 'real':
functions = functions_base + ['dprimme']
else:
functions = functions_base + ['zprimme']
 
for d in dirs:
if d:
l = ['-L' + d] + libs
f = ['-I' + d + '/' + include]
else:
l = libs
f = []
if check.Link(functions,[],l+f):
conf.write('SLEPC_HAVE_PRIMME = -DSLEPC_HAVE_PRIMME\n')
conf.write('PRIMME_LIB =' + str.join(' ', l) + '\n')
conf.write('PRIMME_FLAGS =' + str.join(' ', f) + '\n')
return l+f
 
log.Println('ERROR: Unable to link with PRIMME library')
print 'ERROR: In directories',dirs
print 'ERROR: With flags',libs,
log.Exit('')
slepc-3_1-2/config/primme.py Property changes : Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
/tags/slepc-3_1-2/config/lapack.py New file
0,0 → 1,95
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# SLEPc - Scalable Library for Eigenvalue Problem Computations
# Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
#
# This file is part of SLEPc.
#
# 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/>.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
 
import os
import sys
 
import petscconf
import log
import check
 
def Check(conf):
log.Write('='*80)
log.Println('Checking LAPACK library...')
 
# LAPACK standard functions
l = ['laev2','gehrd','lanhs','lange','getri','hseqr','trexc','trevc','geevx','ggevx','gelqf','gesdd','tgexc','gges']
 
# LAPACK functions with different real and complex versions
if petscconf.SCALAR == 'real':
l += ['orghr','syevr','sygvd','ormlq']
if petscconf.PRECISION == 'single':
prefix = 's'
else:
prefix = 'd'
else:
l += ['unghr','heevr','hegvd','unmlq','ungtr','hetrd']
if petscconf.PRECISION == 'single':
prefix = 'c'
else:
prefix = 'z'
 
# add prefix to LAPACK names
functions = []
for i in l:
functions.append(prefix + i)
 
# LAPACK functions which are always used in real version
if petscconf.PRECISION == 'single':
functions += ['sstevr','sbdsdc','ssteqr','sorgtr','ssytrd','slamch','slag2']
else:
functions += ['dstevr','dbdsdc','dsteqr','dorgtr','dsytrd','dlamch','dlag2']
# check for all functions at once
all = []
for i in functions:
f = '#if defined(PETSC_BLASLAPACK_UNDERSCORE)\n'
f += i + '_\n'
f += '#elif defined(PETSC_BLASLAPACK_CAPS) || defined(PETSC_BLASLAPACK_STDCALL)\n'
f += i.upper() + '\n'
f += '#else\n'
f += i + '\n'
f += '#endif\n'
all.append(f)
 
log.Write('=== Checking all LAPACK functions...')
if check.Link(all,[],[]):
return []
 
# check functions one by one
missing = []
conf.write('SLEPC_MISSING_LAPACK =')
for i in functions:
f = '#if defined(PETSC_BLASLAPACK_UNDERSCORE)\n'
f += i + '_\n'
f += '#elif defined(PETSC_BLASLAPACK_CAPS) || defined(PETSC_BLASLAPACK_STDCALL)\n'
f += i.upper() + '\n'
f += '#else\n'
f += i + '\n'
f += '#endif\n'
log.Write('=== Checking LAPACK '+i+' function...')
if not check.Link([f],[],[]):
missing.append(i)
conf.write(' -DSLEPC_MISSING_LAPACK_' + i[1:].upper())
 
conf.write('\n')
return missing
slepc-3_1-2/config/lapack.py Property changes : Added: svn:eol-style
+ native
/tags/slepc-3_1-2/config/check.py New file
0,0 → 1,143
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# SLEPc - Scalable Library for Eigenvalue Problem Computations
# Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
#
# This file is part of SLEPc.
#
# 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/>.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
 
import os
import sys
import commands
 
import petscconf
import log
 
def LinkWithOutput(functions,callbacks,flags):
code = '#include "petscksp.h"\n'
code += 'EXTERN_C_BEGIN\n'
for f in functions:
code += 'EXTERN int\n' + f + '();\n'
code += 'EXTERN_C_END\n'
for c in callbacks:
code += 'int '+ c + '() { return 0; } \n'
 
code += 'int main() {\n'
code += 'PetscInitialize(PETSC_NULL,PETSC_NULL,PETSC_NULL,PETSC_NULL);\n'
code += 'VecCreate(PETSC_NULL,PETSC_NULL);\n'
code += 'MatCreate(PETSC_NULL,PETSC_NULL);\n'
code += 'KSPCreate(PETSC_NULL,PETSC_NULL);\n'
for f in functions:
code += f + '();\n'
code += 'return 0;\n}\n'
os.chdir('config')
cfile = open('checklink.c','w')
cfile.write(code)
cfile.close()
(result, output) = commands.getstatusoutput(petscconf.MAKE + ' checklink TESTFLAGS="'+str.join(' ',flags)+'"')
if os.path.exists('checklink.o'):
os.unlink('checklink.o')
os.chdir(os.pardir)
if result:
return (0,code + output)
else:
return (1,code + output)
def Link(functions,callbacks,flags):
(result, output) = LinkWithOutput(functions,callbacks,flags)
log.Write(output)
return result
 
def FortranLink(functions,callbacks,flags):
output = '\n=== With linker flags: '+str.join(' ',flags)
 
f = []
for i in functions:
f.append(i+'_')
c = []
for i in callbacks:
c.append(i+'_')
(result, output1) = LinkWithOutput(f,c,flags)
output1 = '\n====== With underscore Fortran names\n' + output1
if result: return ('UNDERSCORE',output1)
 
f = []
for i in functions:
f.append(i.upper())
c = []
for i in callbacks:
c.append(i.upper())
(result, output2) = LinkWithOutput(f,c,flags)
output2 = '\n====== With capital Fortran names\n' + output2
if result: return ('CAPS',output2)
 
(result, output3) = LinkWithOutput(functions,callbacks,flags)
output3 = '\n====== With unmodified Fortran names\n' + output3
if result: return ('STDCALL',output3)
return ('',output + output1 + output2 + output3)
 
def GenerateGuesses(name):
installdirs = ['/usr/local','/opt']
if 'HOME' in os.environ:
installdirs.insert(0,os.environ['HOME'])
 
dirs = []
for i in installdirs:
dirs = dirs + [i + '/lib']
for d in [name,name.upper(),name.lower()]:
dirs = dirs + [i + '/' + d]
dirs = dirs + [i + '/' + d + '/lib']
dirs = dirs + [i + '/lib/' + d]
for d in dirs[:]:
if not os.path.exists(d):
dirs.remove(d)
dirs = [''] + dirs
return dirs
 
def FortranLib(conf,name,dirs,libs,functions,callbacks = []):
log.Write('='*80)
log.Println('Checking '+name+' library...')
 
error = ''
mangling = ''
for d in dirs:
for l in libs:
if d:
flags = ['-L' + d] + l
else:
flags = l
(mangling, output) = FortranLink(functions,callbacks,flags)
error += output
if mangling: break
if mangling: break
 
if mangling:
log.Write(output)
else:
log.Write(error)
log.Println('ERROR: Unable to link with library '+ name)
print 'ERROR: In directories',dirs
print 'ERROR: With flags',libs,
log.Exit('')
 
conf.write('SLEPC_HAVE_' + name + ' = -DSLEPC_HAVE_' + name + ' -DSLEPC_' + name + '_HAVE_'+mangling+'\n')
conf.write(name + '_LIB = '+str.join(' ',flags)+'\n')
return flags
slepc-3_1-2/config/check.py Property changes : Added: svn:eol-style
+ native
/tags/slepc-3_1-2/config/trlan.py New file
0,0 → 1,47
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# SLEPc - Scalable Library for Eigenvalue Problem Computations
# Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
#
# This file is part of SLEPc.
#
# 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/>.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
 
import os
import sys
 
import petscconf
import check
 
def Check(conf,directory,libs):
 
if petscconf.SCALAR == 'complex':
sys.exit('ERROR: TRLAN does not support complex numbers.')
 
if petscconf.PRECISION == 'single':
sys.exit('ERROR: TRLAN does not support single precision.')
 
functions = ['trlan77']
if libs:
libs = [libs]
else:
libs = [['-ltrlan_mpi']]
 
if directory:
dirs = [directory]
else:
dirs = check.GenerateGuesses('TRLan')
return check.FortranLib(conf,'TRLAN',dirs,libs,functions)
slepc-3_1-2/config/trlan.py Property changes : Added: svn:eol-style
+ native
/tags/slepc-3_1-2/config/arpack.py New file
0,0 → 1,51
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# SLEPc - Scalable Library for Eigenvalue Problem Computations
# Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
#
# This file is part of SLEPc.
#
# 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/>.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
 
import os
import sys
 
import petscconf
import check
 
def Check(conf,directory,libs):
 
if petscconf.SCALAR == 'real':
if petscconf.PRECISION == 'single':
functions = ['psnaupd','psneupd','pssaupd','psseupd']
else:
functions = ['pdnaupd','pdneupd','pdsaupd','pdseupd']
else:
if petscconf.PRECISION == 'single':
functions = ['pcnaupd','pcneupd']
else:
functions = ['pznaupd','pzneupd']
 
if libs:
libs = [libs]
else:
libs = [['-lparpack','-larpack'],['-lparpack_MPI','-larpack'],['-lparpack_MPI-LINUX','-larpack_LINUX'],['-lparpack_MPI-SUN4','-larpack_SUN4']]
 
if directory:
dirs = [directory]
else:
dirs = check.GenerateGuesses('Arpack')
return check.FortranLib(conf,'ARPACK',dirs,libs,functions)
slepc-3_1-2/config/arpack.py Property changes : Added: svn:eol-style
+ native
/tags/slepc-3_1-2/config/configure.py New file
0,0 → 1,302
#!/usr/bin/env python
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# SLEPc - Scalable Library for Eigenvalue Problem Computations
# Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
#
# This file is part of SLEPc.
#
# 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/>.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
 
import os
import sys
import time
 
import petscversion
import petscconf
import log
import check
import arpack
import blzpack
import trlan
import lapack
import primme
import slepc4py
 
if not hasattr(sys, 'version_info') or not sys.version_info[1] >= 2:
print '**** You must have Python version 2.2 or higher to run config/configure.py ******'
print '* Python is easy to install for end users or sys-admin. *'
print '* http://www.python.org/download/ *'
print '* *'
print '* You CANNOT configure SLEPc without Python *'
print '*********************************************************************************'
sys.exit(4)
 
# support a few standard configure option types
for l in range(1,len(sys.argv)):
name = sys.argv[l]
if name.startswith('--enable'):
sys.argv[l] = name.replace('--enable','--with')
if name.find('=') == -1: sys.argv[l] += '=1'
if name.startswith('--disable'):
sys.argv[l] = name.replace('--disable','--with')
if name.find('=') == -1: sys.argv[l] += '=0'
elif name.endswith('=1'): sys.argv[l].replace('=1','=0')
if name.startswith('--without'):
sys.argv[l] = name.replace('--without','--with')
if name.find('=') == -1: sys.argv[l] += '=0'
elif name.endswith('=1'): sys.argv[l].replace('=1','=0')
 
# Check configure parameters
havearpack = 0
arpackdir = ''
arpacklibs = []
haveblzpack = 0
blzpackdir = ''
blzpacklibs = []
havetrlan = 0
trlandir = ''
trlanlibs = []
haveprimme = 0
primmedir = ''
primmelibs = []
getslepc4py = 0
prefixdir = ''
 
for i in sys.argv[1:]:
if i.startswith('--with-arpack-dir='):
arpackdir = i.split('=')[1]
havearpack = 1
elif i.startswith('--with-arpack-flags='):
arpacklibs = i.split('=')[1].split(',')
havearpack = 1
elif i.startswith('--with-arpack'):
havearpack = not i.endswith('=0')
elif i.startswith('--with-blzpack-dir='):
blzpackdir = i.split('=')[1]
haveblzpack = 1
elif i.startswith('--with-blzpack-flags='):
blzpacklibs = i.split('=')[1].split(',')
haveblzpack = 1
elif i.startswith('--with-blzpack'):
haveblzpack = not i.endswith('=0')
elif i.startswith('--with-trlan-dir='):
trlandir = i.split('=')[1]
havetrlan = 1
elif i.startswith('--with-trlan-flags='):
trlanlibs = i.split('=')[1].split(',')
havetrlan = 1
elif i.startswith('--with-trlan'):
havetrlan = not i.endswith('=0')
elif i.startswith('--with-primme-dir'):
primmedir = i.split('=')[1]
haveprimme = 1
elif i.startswith('--with-primme-flags='):
primmelibs = i.split('=')[1].split(',')
haveprimme = 1
elif i.startswith('--with-primme'):
haveprimme = not i.endswith('=0')
elif i.startswith('--download-slepc4py'):
getslepc4py = not i.endswith('=0')
elif i.startswith('--prefix='):
prefixdir = i.split('=')[1]
elif i.startswith('--h') or i.startswith('-h') or i.startswith('-?'):
print 'SLEPc Configure Help'
print '-'*80
print ' --prefix=<dir> : Specifiy location to install SLEPc (e.g., /usr/local)'
print 'ARPACK:'
print ' --with-arpack : Indicate if you wish to test for ARPACK (PARPACK)'
print ' --with-arpack-dir=<dir> : Indicate the directory for ARPACK libraries'
print ' --with-arpack-flags=<flags> : Indicate comma-separated flags for linking ARPACK'
print 'BLZPACK:'
print ' --with-blzpack : Indicate if you wish to test for BLZPACK'
print ' --with-blzpack-dir=<dir> : Indicate the directory for BLZPACK libraries'
print ' --with-blzpack-flags=<flags> : Indicate comma-separated flags for linking BLZPACK'
print 'TRLAN:'
print ' --with-trlan : Indicate if you wish to test for TRLAN'
print ' --with-trlan-dir=<dir> : Indicate the directory for TRLAN libraries'
print ' --with-trlan-flags=<flags> : Indicate comma-separated flags for linking TRLAN'
print 'PRIMME:'
print ' --with-primme : Indicate if you wish to test for PRIMME'
print ' --with-primme-dir=<dir> : Indicate the directory for PRIMME libraries'
print ' --with-primme-flags=<flags> : Indicate comma-separated flags for linking PRIMME'
print 'slepc4py:'
print ' --download-slepc4py : Download and install slepc4py in SLEPc directory'
sys.exit(0)
else:
sys.exit('ERROR: Invalid argument ' + i +'. Use -h for help')
 
prefixinstall = not prefixdir==''
 
# Check if enviroment is ok
print 'Checking environment...'
if 'SLEPC_DIR' in os.environ:
slepcdir = os.environ['SLEPC_DIR']
if not os.path.exists(slepcdir) or not os.path.exists(os.sep.join([slepcdir,'config'])):
sys.exit('ERROR: SLEPC_DIR enviroment variable is not valid')
if os.path.realpath(os.getcwd()) != os.path.realpath(slepcdir):
sys.exit('ERROR: SLEPC_DIR is not the current directory')
else:
slepcdir = os.getcwd();
if not os.path.exists(os.sep.join([slepcdir,'config'])):
sys.exit('ERROR: Current directory is not valid')
 
if 'PETSC_DIR' in os.environ:
petscdir = os.environ['PETSC_DIR']
if not os.path.exists(petscdir):
sys.exit('ERROR: PETSC_DIR enviroment variable is not valid')
else:
if prefixdir:
petscdir = prefixdir
os.environ['PETSC_DIR'] = petscdir
else:
sys.exit('ERROR: PETSC_DIR enviroment variable is not set')
 
# Check PETSc version
petscversion.Load(petscdir)
if petscversion.VERSION < '3.1':
sys.exit('ERROR: This SLEPc version is not compatible with PETSc version '+petscversion.VERSION)
if petscversion.PATCHLEVEL < '4' and petscversion.RELEASE == '1':
sys.exit('ERROR: PETSc 3.1 patchlevel 4 required. Please upgrade to petsc-3.1-p4 or later')
 
# Check some information about PETSc configuration
petscconf.Load(petscdir)
if not petscconf.PRECISION in ['double','single','matsingle']:
sys.exit('ERROR: This SLEPc version does not work with '+petscconf.PRECISION+' precision')
if prefixinstall and not petscconf.ISINSTALL:
sys.exit('ERROR: SLEPc cannot be configured for non-source installation if PETSc is not configured in the same way.')
 
# Create architecture directory and configuration files
archdir = os.sep.join([slepcdir,petscconf.ARCH])
if not os.path.exists(archdir):
try:
os.mkdir(archdir)
except:
sys.exit('ERROR: cannot create architecture directory ' + archdir)
confdir = os.sep.join([archdir,'conf'])
if not os.path.exists(confdir):
try:
os.mkdir(confdir)
except:
sys.exit('ERROR: cannot create configuration directory ' + confdir)
incdir = os.sep.join([archdir,'include'])
if not os.path.exists(incdir):
try:
os.mkdir(incdir)
except:
sys.exit('ERROR: cannot create include directory ' + incdir)
try:
slepcconf = open(os.sep.join([confdir,'slepcvariables']),'w')
if not prefixdir:
prefixdir = archdir
slepcconf.write('SLEPC_INSTALL_DIR =' + prefixdir +'\n')
except:
sys.exit('ERROR: cannot create configuration file in ' + confdir)
try:
slepcrules = open(os.sep.join([confdir,'slepcrules']),'w')
except:
sys.exit('ERROR: cannot create rules file in ' + confdir)
if prefixinstall and os.path.isfile(os.sep.join([prefixdir,'include','slepc.h'])):
sys.exit('ERROR: prefix directory ' + prefixdir + ' contains files from a previous installation')
 
# Open log file
log.Open(os.sep.join([confdir,'configure.log']))
log.Write('='*80)
log.Write('Starting Configure Run at '+time.ctime(time.time()))
log.Write('Configure Options: '+str.join(' ',sys.argv))
log.Write('Working directory: '+os.getcwd())
log.Write('Python version:\n' + sys.version)
log.Write('make: ' + petscconf.MAKE)
log.Write('PETSc source directory: ' + petscdir)
log.Write('PETSc install directory: ' + petscconf.INSTALL_DIR)
log.Write('PETSc version: ' + petscversion.VERSION)
log.Write('PETSc architecture: ' + petscconf.ARCH)
log.Write('SLEPc source directory: ' + slepcdir)
log.Write('SLEPc install directory: ' + prefixdir)
log.Write('='*80)
 
# Check if PETSc is working
log.Println('Checking PETSc installation...')
if petscversion.VERSION > '3.1':
log.Println('WARNING: PETSc version '+petscversion.VERSION+' is newer than SLEPc version')
if petscversion.RELEASE != '1':
log.Println('WARNING: using PETSc development version')
if petscconf.ISINSTALL:
if os.path.realpath(petscconf.INSTALL_DIR) != os.path.realpath(petscdir):
log.Println('WARNING: PETSC_DIR does not point to PETSc installation path')
if not check.Link([],[],[]):
log.Exit('ERROR: Unable to link with PETSc')
 
# Check for external packages
if havearpack:
arpacklibs = arpack.Check(slepcconf,arpackdir,arpacklibs)
if haveblzpack:
blzpacklibs = blzpack.Check(slepcconf,blzpackdir,blzpacklibs)
if havetrlan:
trlanlibs = trlan.Check(slepcconf,trlandir,trlanlibs)
if haveprimme:
primmelibs = primme.Check(slepcconf,primmedir,primmelibs)
 
# Check for missing LAPACK functions
missing = lapack.Check(slepcconf)
 
# Download and install slepc4py
if getslepc4py:
slepc4py.Install()
slepc4py.addMakeRule(slepcrules,prefixdir,prefixinstall,getslepc4py)
 
slepcconf.close()
slepcrules.close()
 
log.Println('')
log.Println('='*80)
log.Println('SLEPc Configuration')
log.Println('='*80)
log.Println('')
log.Println('SLEPc source directory:')
log.Println(' '+slepcdir)
log.Println('SLEPc install directory:')
log.Println(' '+prefixdir)
log.Println('PETSc directory:')
log.Println(' '+petscdir)
log.Println('Architecture "'+petscconf.ARCH+'" with '+petscconf.PRECISION+' precision '+petscconf.SCALAR+' numbers')
if havearpack:
log.Println('ARPACK library flags:')
log.Println(' '+str.join(' ',arpacklibs))
if haveblzpack:
log.Println('BLZPACK library flags:')
log.Println(' '+str.join(' ',blzpacklibs))
if havetrlan:
log.Println('TRLAN library flags:')
log.Println(' '+str.join(' ',trlanlibs))
if haveprimme:
log.Println('PRIMME library flags:')
log.Println(' '+str.join(' ',primmelibs))
if missing:
log.Println('LAPACK missing functions:')
log.Print(' ')
for i in missing: log.Print(i)
log.Println('')
log.Println('')
log.Println('WARNING: Some SLEPc functionality will not be available')
log.Println('PLEASE reconfigure and recompile PETSc with a full LAPACK implementation')
if petscconf.ISINSTALL:
log.Println('')
log.Println(' **')
log.Println(' ** Before running "make" your PETSC_ARCH must be specified with:')
log.Println(' ** ** setenv PETSC_ARCH '+petscconf.ARCH+' (csh/tcsh)')
log.Println(' ** ** PETSC_ARCH='+petscconf.ARCH+' ; export PETSC_ARCH (sh/bash)')
log.Println(' **')
print
slepc-3_1-2/config/configure.py Property changes : Added: svn:executable
+ *
Added: svn:eol-style
+ native
/tags/slepc-3_1-2/config/log.py New file
0,0 → 1,50
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# SLEPc - Scalable Library for Eigenvalue Problem Computations
# Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
#
# This file is part of SLEPc.
#
# 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/>.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
 
import sys
 
import petscconf
 
def Open(filename):
global f
f = open(filename,'w')
return
 
def Println(string):
print string
f.write(string)
f.write('\n')
 
def Print(string):
print string,
f.write(string+' ')
def Write(string):
f.write(string)
f.write('\n')
def Exit(string):
f.write(string)
f.write('\n')
f.close()
print string
sys.exit('ERROR: See "' + petscconf.ARCH + '/conf/configure.log" file for details')
 
slepc-3_1-2/config/log.py Property changes : Added: svn:eol-style
+ native
/tags/slepc-3_1-2/config/slepc4py.py New file
0,0 → 1,131
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# SLEPc - Scalable Library for Eigenvalue Problem Computations
# Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
#
# This file is part of SLEPc.
#
# 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/>.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
 
import os
import sys
import log
import petscconf
import urllib
import urlparse
import tarfile
 
def Install():
'''
Download and uncompress the slepc4py tarball
'''
log.Write('='*80)
log.Println('Installing slepc4py...')
 
# Test whether PETSc was installed with petsc4py
petscdir = os.environ['PETSC_DIR']
petscconf.Load(petscdir)
archdir = os.sep.join([petscdir,petscconf.ARCH])
if petscconf.ISINSTALL:
petsc4pydir = os.sep.join([petscdir,'lib/petsc4py'])
else:
petsc4pydir = os.sep.join([archdir,'lib/petsc4py'])
if not os.path.exists(petsc4pydir):
sys.exit('ERROR: current PETSc configuration does not include petsc4py support' + petsc4pydir)
 
# Create externalpackages directory
externdir = 'externalpackages'
if not os.path.exists(externdir):
try:
os.mkdir(externdir)
except:
sys.exit('ERROR: cannot create directory ' + externdir)
 
# Download tarball
packagename = 'slepc4py-1.0.0'
url = 'http://slepc4py.googlecode.com/files/'+packagename+'.tar.gz'
archiveZip = 'slepc4py.tgz'
localFile = os.sep.join([externdir,archiveZip])
log.Println('Downloading '+url+' to '+localFile)
 
if os.path.exists(localFile):
os.remove(localFile)
try:
urllib.urlretrieve(url, localFile)
except Exception, e:
name = 'slepc4py'
filename = os.path.basename(urlparse.urlparse(url)[2])
failureMessage = '''\
Unable to download package %s from: %s
* If your network is disconnected - please reconnect and rerun config/configure.py
* Alternatively, you can download the above URL manually, to /yourselectedlocation/%s
and use the configure option:
--download-%s=/yourselectedlocation/%s
''' % (name, url, filename, name, filename)
raise RuntimeError(failureMessage)
 
# Uncompress tarball
destDir = os.sep.join([externdir,packagename])
log.Println('Uncompressing '+localFile+' to directory '+destDir)
if os.path.exists(destDir):
for root, dirs, files in os.walk(destDir, topdown=False):
for name in files:
os.remove(os.path.join(root, name))
for name in dirs:
os.rmdir(os.path.join(root, name))
try:
tar = tarfile.open(localFile, "r:gz")
tar.extractall(path=externdir)
tar.close()
except RuntimeError, e:
raise RuntimeError('Error uncompressing '+archiveZip+': '+str(e))
 
os.remove(localFile)
 
 
def addMakeRule(slepcrules,installdir,prefixinstall,getslepc4py):
'''
Add a rule to the makefile in order to build slepc4py
'''
if getslepc4py:
target = 'slepc4py'
slepcrules.write(target+':\n')
externdir = 'externalpackages'
packagename = 'slepc4py-1.0.0'
destDir = os.sep.join([externdir,packagename])
cmd = '@cd '+destDir
slepcrules.write('\t'+cmd+'; \\\n')
cmd = 'python setup.py clean --all'
slepcrules.write('\t'+cmd+'; \\\n')
cmd = 'python setup.py install --install-lib='+os.path.join(installdir,'lib')
slepcrules.write('\t'+cmd+'\n')
cmd = '@echo "====================================="'
slepcrules.write('\t'+cmd+'\n')
cmd = '@echo "To use slepc4py, add '+os.path.join(installdir,'lib')+' to PYTHONPATH"'
slepcrules.write('\t'+cmd+'\n')
cmd = '@echo "====================================="'
slepcrules.write('\t'+cmd+'\n')
else:
if prefixinstall:
target = 'slepc4py'
slepcrules.write(target+':\n')
cmd = '@echo " "'
slepcrules.write('\t'+cmd+'\n')
 
target = 'slepc4py_noinstall'
if getslepc4py and not prefixinstall:
slepcrules.write(target+': slepc4py\n')
else:
slepcrules.write(target+':\n')
/tags/slepc-3_1-2/config/petscconf.py New file
0,0 → 1,53
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# SLEPc - Scalable Library for Eigenvalue Problem Computations
# Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
#
# This file is part of SLEPc.
#
# 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/>.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
 
import os
import sys
 
def Load(petscdir):
global ARCH,DIR,MAKE,SCALAR,PRECISION,ISINSTALL,INSTALL_DIR
if 'PETSC_ARCH' in os.environ:
ISINSTALL = 0
ARCH = os.environ['PETSC_ARCH']
PETSCVARIABLES = os.sep.join([petscdir,ARCH,'conf','petscvariables'])
else:
ISINSTALL = 1
ARCH = 'installed-petsc'
PETSCVARIABLES = os.sep.join([petscdir,'conf','petscvariables'])
 
try:
f = open(PETSCVARIABLES)
for l in f.readlines():
(k,v) = l.split('=',1)
k = k.strip()
v = v.strip()
if k == 'PETSC_SCALAR':
SCALAR = v
elif k == 'PETSC_PRECISION':
PRECISION = v
elif k == 'MAKE':
MAKE = v
elif k == 'INSTALL_DIR':
INSTALL_DIR = v
f.close()
except:
sys.exit('ERROR: PETSc is not configured for architecture ' + ARCH)
slepc-3_1-2/config/petscconf.py Property changes : Added: svn:eol-style
+ native
/tags/slepc-3_1-2/config/petscversion.py New file
0,0 → 1,45
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# SLEPc - Scalable Library for Eigenvalue Problem Computations
# Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
#
# This file is part of SLEPc.
#
# 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/>.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
 
import os
import sys
 
def Load(petscdir):
global VERSION,RELEASE,PATCHLEVEL
try:
f = open(os.sep.join([petscdir,'include','petscversion.h']))
for l in f.readlines():
l = l.split()
if len(l) == 3:
if l[1] == 'PETSC_VERSION_RELEASE':
RELEASE = l[2]
if l[1] == 'PETSC_VERSION_MAJOR':
major = l[2]
elif l[1] == 'PETSC_VERSION_MINOR':
minor = l[2]
elif l[1] == 'PETSC_VERSION_SUBMINOR':
subminor = l[2]
elif l[1] == 'PETSC_VERSION_PATCH':
PATCHLEVEL = l[2]
f.close()
VERSION = major + '.' + minor
except:
sys.exit('ERROR: file error while reading PETSC version')
slepc-3_1-2/config/petscversion.py Property changes : Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
/tags/slepc-3_1-2/config/blzpack.py New file
0,0 → 1,48
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# SLEPc - Scalable Library for Eigenvalue Problem Computations
# Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
#
# This file is part of SLEPc.
#
# 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/>.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
 
import os
import sys
 
import petscconf
import check
 
def Check(conf,directory,libs):
 
if petscconf.SCALAR == 'complex':
sys.exit('ERROR: BLZPACK does not support complex numbers.')
if petscconf.PRECISION == 'single':
functions = ['blzdrs']
else:
functions = ['blzdrd']
 
if libs:
libs = [libs]
else:
libs = [['-lblzpack']]
 
if directory:
dirs = [directory]
else:
dirs = check.GenerateGuesses('Blzpack')
 
return check.FortranLib(conf,'BLZPACK',dirs,libs,functions)
slepc-3_1-2/config/blzpack.py Property changes : Added: svn:eol-style
+ native
/tags/slepc-3_1-2/config/makefile New file
0,0 → 1,29
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# SLEPc - Scalable Library for Eigenvalue Problem Computations
# Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
#
# This file is part of SLEPc.
#
# 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/>.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
 
include ${PETSC_DIR}/conf/variables
include ${PETSC_DIR}/conf/rules
 
checklink: checklink.o chkopts
${CLINKER} -o checklink checklink.o ${TESTFLAGS} ${PETSC_KSP_LIB}
@${RM} -f checklink checklink.o
 
LOCDIR = ./
slepc-3_1-2/config/makefile Property changes : Added: svn:eol-style
+ native
/tags/slepc-3_1-2/config/generatefortranstubs.py New file
0,0 → 1,192
#!/usr/bin/env python
#!/bin/env python
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# SLEPc - Scalable Library for Eigenvalue Problem Computations
# Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
#
# This file is part of SLEPc.
#
# 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/>.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# Generates fortran stubs for PETSc using Sowings bfort program
#
import os
#
# Opens all generated files and fixes them
#
def FixFile(filename):
import re
ff = open(filename)
data = ff.read()
ff.close()
 
# gotta be a better way to do this
data = re.subn('\nvoid ','\nvoid PETSC_STDCALL ',data)[0]
data = re.subn('\nPetscErrorCode ','\nvoid PETSC_STDCALL ',data)[0]
data = re.subn('Petsc([ToRm]*)Pointer\(int\)','Petsc\\1Pointer(void*)',data)[0]
data = re.subn('PetscToPointer\(a\) \(a\)','PetscToPointer(a) (*(long *)(a))',data)[0]
data = re.subn('PetscFromPointer\(a\) \(int\)\(a\)','PetscFromPointer(a) (long)(a)',data)[0]
data = re.subn('PetscToPointer\( \*\(int\*\)','PetscToPointer(',data)[0]
data = re.subn('MPI_Comm comm','MPI_Comm *comm',data)[0]
data = re.subn('\(MPI_Comm\)PetscToPointer\( \(comm\) \)','MPI_Comm_f2c(*(MPI_Fint*)(comm))',data)[0]
data = re.subn('\(PetscInt\* \)PetscToPointer','',data)[0]
match = re.compile(r"""\b(PETSC)(_DLL|VEC_DLL|MAT_DLL|DM_DLL|KSP_DLL|SNES_DLL|TS_DLL|FORTRAN_DLL)(EXPORT)""")
data = match.sub(r'',data)
 
ff = open(filename, 'w')
ff.write('#include "petscsys.h"\n#include "petscfix.h"\n'+data)
ff.close()
return
 
def FixDir(petscdir,dir):
mansec = 'unknown'
cnames = []
hnames = []
parentdir =os.path.abspath(os.path.join(dir,'..'))
for f in os.listdir(dir):
ext = os.path.splitext(f)[1]
if ext == '.c':
FixFile(os.path.join(dir, f))
cnames.append(f)
elif ext == '.h90':
hnames.append(f)
if (cnames != [] or hnames != []):
mfile=os.path.abspath(os.path.join(parentdir,'makefile'))
try:
fd=open(mfile,'r')
except:
print 'Error! missing file:', mfile
return
inbuf = fd.read()
fd.close()
cppflags = ""
libbase = ""
locdir = ""
for line in inbuf.splitlines():
if line.find('CPPFLAGS') >=0:
cppflags = line
if line.find('LIBBASE') >=0:
libbase = line
elif line.find('LOCDIR') >=0:
locdir = line.rstrip() + 'ftn-auto/'
elif line.find('MANSEC') >=0:
mansec = line.split('=')[1].lower().strip()
 
# now assemble the makefile
outbuf = '\n'
outbuf += "#requirespackage 'PETSC_HAVE_FORTRAN'\n"
outbuf += 'ALL: lib\n'
outbuf += cppflags + '\n'
outbuf += 'CFLAGS =\n'
outbuf += 'FFLAGS =\n'
outbuf += 'SOURCEC = ' +' '.join(cnames)+ '\n'
outbuf += 'OBJSC = ' +' '.join(cnames).replace('.c','.o')+ '\n'
outbuf += 'SOURCEF =\n'
outbuf += 'SOURCEH = ' +' '.join(hnames)+ '\n'
outbuf += 'DIRS =\n'
outbuf += libbase + '\n'
outbuf += locdir + '\n'
# outbuf += 'include ${PETSC_DIR}/conf/base\n'
# outbuf += 'include ${PETSC_DIR}/conf/test\n'
outbuf += 'include ${SLEPC_DIR}/conf/slepc_common \n'
ff = open(os.path.join(dir, 'makefile'), 'w')
ff.write(outbuf)
ff.close()
 
# if dir is empty - remove it
if os.path.exists(dir) and os.path.isdir(dir) and os.listdir(dir) == []:
os.rmdir(dir)
 
# Now process f90module.f90 file - and update include/finclude/ftn-auto
modfile = os.path.join(parentdir,'f90module.f90')
if os.path.exists(modfile):
fd = open(modfile)
txt = fd.read()
fd.close()
 
if txt and mansec == 'unknown':
print 'makefile has missing MANSEC',parentdir
elif txt:
ftype = 'w'
f90inc = os.path.join(petscdir,'include','finclude','ftn-auto','slepc'+mansec+'.h90')
if os.path.exists(f90inc): ftype = 'a'
fd = open(f90inc,ftype)
fd.write(txt)
fd.close()
os.remove(modfile)
return
 
def PrepFtnDir(dir):
if os.path.exists(dir) and not os.path.isdir(dir):
raise RuntimeError('Error - specified path is not a dir: ' + dir)
elif not os.path.exists(dir):
os.mkdir(dir)
else:
files = os.listdir(dir)
for file in files:
os.remove(os.path.join(dir,file))
return
 
def processDir(arg,dirname,names):
import commands
petscdir = arg[0]
bfort = arg[1]
newls = []
outdir = os.path.join(dirname,'ftn-auto')
 
# skip include/finclude/ftn-auto - as this is processed separately
if os.path.realpath(os.path.join(petscdir,'include','finclude','ftn-auto')) == os.path.realpath(outdir): return
 
for l in names:
if os.path.splitext(l)[1] =='.c' or os.path.splitext(l)[1] == '.h':
newls.append(l)
if newls:
PrepFtnDir(outdir)
options = ['-dir '+outdir, '-mnative', '-ansi', '-nomsgs', '-noprofile', '-anyname', '-mapptr',
'-mpi', '-mpi2', '-ferr', '-ptrprefix Petsc', '-ptr64 PETSC_USE_POINTER_CONVERSION',
'-fcaps PETSC_HAVE_FORTRAN_CAPS', '-fuscore PETSC_HAVE_FORTRAN_UNDERSCORE',
'-f90mod_skip_header','-f90modfile','f90module.f90']
(status,output) = commands.getstatusoutput('cd '+dirname+';'+bfort+' '+' '.join(options+newls))
if status:
raise RuntimeError('Error running bfort '+output)
FixDir(petscdir,outdir)
for name in ['.hg','SCCS', 'output', 'BitKeeper', 'examples', 'externalpackages', 'bilinear', 'ftn-auto','fortran','bin','maint','ftn-custom','config','f90-custom']:
if name in names:
names.remove(name)
# check for configure generated PETSC_ARCHes
rmnames=[]
for name in names:
if os.path.isdir(os.path.join(name,'conf')):
rmnames.append(name)
for rmname in rmnames:
names.remove(rmname)
return
 
def main(bfort):
petscdir = os.getcwd()
tmpdir = os.path
ftnautoinc = os.path.join(petscdir,'include','finclude','ftn-auto')
PrepFtnDir(ftnautoinc)
os.path.walk(petscdir, processDir, [petscdir, bfort])
FixDir(petscdir,ftnautoinc)
return
#
# The classes in this file can also be used in other python-programs by using 'import'
#
if __name__ == '__main__':
import sys
if len(sys.argv) < 2:
sys.exit('Must give the BFORT program as the first argument')
main(sys.argv[1])
slepc-3_1-2/config/generatefortranstubs.py Property changes : Added: svn:executable
+ *
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
slepc-3_1-2/config Property changes : Added: svn:ignore
+ checklink.c
*.pyc
/tags/slepc-3_1-2/src/mat/examples/speaker107c.petsc Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
slepc-3_1-2/src/mat/examples/speaker107c.petsc Property changes : Added: svn:mime-type
+ application/octet-stream
/tags/slepc-3_1-2/src/mat/examples/bfw62a.petsc Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
slepc-3_1-2/src/mat/examples/bfw62a.petsc Property changes : Added: svn:mime-type
+ application/octet-stream
/tags/slepc-3_1-2/src/mat/examples/bfw62b.petsc Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
slepc-3_1-2/src/mat/examples/bfw62b.petsc Property changes : Added: svn:mime-type
+ application/octet-stream
/tags/slepc-3_1-2/src/mat/examples/rdb200.petsc Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
slepc-3_1-2/src/mat/examples/rdb200.petsc Property changes : Added: svn:mime-type
+ application/octet-stream
/tags/slepc-3_1-2/src/mat/examples/speaker107k.petsc Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
slepc-3_1-2/src/mat/examples/speaker107k.petsc Property changes : Added: svn:mime-type
+ application/octet-stream
/tags/slepc-3_1-2/src/mat/examples/speaker107m.petsc Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
slepc-3_1-2/src/mat/examples/speaker107m.petsc Property changes : Added: svn:mime-type
+ application/octet-stream
/tags/slepc-3_1-2/src/mat/examples/readme New file
0,0 → 1,18
 
SLEPc example matrices
----------------------
 
Saved in MATMPIAIJ format with a PetscViewerBinary.
 
 
File Name Description
----------------------------------------------------------------------------
rdb200 Brusselator real unsymmetric, 200 by 200, 1120 entries
 
bfw62a Waveguide real unsymmetric, 62 by 62, 450 entries
bfw62b real symmetric indefinite, 62 by 62, 342 entries
 
speaker107m Speaker quadratic eigenvalue problem
speaker107c
speaker107k
 
slepc-3_1-2/src/mat/examples/readme Property changes : Added: svn:eol-style
+ native
/tags/slepc-3_1-2/src/qep/interface/ftn-custom/zqepf.c New file
0,0 → 1,222
/*
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SLEPc - Scalable Library for Eigenvalue Problem Computations
Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
 
This file is part of SLEPc.
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/>.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
 
#include "private/fortranimpl.h"
#include "slepcqep.h"
#include "private/qepimpl.h"
 
#ifdef PETSC_HAVE_FORTRAN_CAPS
#define qepview_ QEPVIEW
#define qepsetoptionsprefix_ QEPSETOPTIONSPREFIX
#define qepappendoptionsprefix_ QEPAPPENDOPTIONSPREFIX
#define qepgetoptionsprefix_ QEPGETOPTIONSPREFIX
#define qepcreate_ QEPCREATE
#define qepsettype_ QEPSETTYPE
#define qepgettype_ QEPGETTYPE
#define qepmonitorall_ QEPMONITORALL
#define qepmonitorlg_ QEPMONITORLG
#define qepmonitorlgall_ QEPMONITORLGALL
#define qepmonitorset_ QEPMONITORSET
#define qepmonitorconverged_ QEPMONITORCONVERGED
#define qepmonitorfirst_ QEPMONITORFIRST
#define qepgetip_ QEPGETIP
#define qepgetwhicheigenpairs_ QEPGETWHICHEIGENPAIRS
#define qepgetproblemtype_ QEPGETPROBLEMTYPE
#define qepgetconvergedreason_ QEPGETCONVERGEDREASON
#elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
#define qepview_ qepview
#define qepsetoptionsprefix_ qepsetoptionsprefix
#define qepappendoptionsprefix_ qepappendoptionsprefix
#define qepgetoptionsprefix_ qepgetoptionsprefix
#define qepcreate_ qepcreate
#define qepsettype_ qepsettype
#define qepgettype_ qepgettype
#define qepmonitorall_ qepmonitorall
#define qepmonitorlg_ qepmonitorlg
#define qepmonitorlgall_ qepmonitorlgall
#define qepmonitorset_ qepmonitorset
#define qepmonitorconverged_ qepmonitorconverged
#define qepmonitorfirst_ qepmonitorfirst
#define qepgetip_ qepgetip
#define qepgetwhicheigenpairs_ qepgetwhicheigenpairs
#define qepgetproblemtype_ qepgetproblemtype
#define qepgetconvergedreason_ qepgetconvergedreason
#endif
 
EXTERN_C_BEGIN
 
/*
These are not usually called from Fortran but allow Fortran users
to transparently set these monitors from .F code, hence no STDCALL
*/
void qepmonitorall_(QEP *qep,PetscInt *it,PetscInt *nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr)
{
*ierr = QEPMonitorAll(*qep,*it,*nconv,eigr,eigi,errest,*nest,ctx);
}
 
void qepmonitorlg_(QEP *qep,PetscInt *it,PetscInt *nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr)
{
*ierr = QEPMonitorLG(*qep,*it,*nconv,eigr,eigi,errest,*nest,ctx);
}
 
void qepmonitorlgall_(QEP *qep,PetscInt *it,PetscInt *nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr)
{
*ierr = QEPMonitorLGAll(*qep,*it,*nconv,eigr,eigi,errest,*nest,ctx);
}
 
void qepmonitorconverged_(QEP *qep,PetscInt *it,PetscInt *nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr)
{
*ierr = QEPMonitorConverged(*qep,*it,*nconv,eigr,eigi,errest,*nest,ctx);
}
 
void qepmonitorfirst_(QEP *qep,PetscInt *it,PetscInt *nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr)
{
*ierr = QEPMonitorFirst(*qep,*it,*nconv,eigr,eigi,errest,*nest,ctx);
}
 
EXTERN_C_END
/* These are not extern C because they are passed into non-extern C user level functions */
static PetscErrorCode ourmonitor(QEP qep,PetscInt i,PetscInt nc,PetscScalar *er,PetscScalar *ei,PetscReal *d,PetscInt l,void* ctx)
{
PetscErrorCode ierr = 0;
void *mctx = (void*) ((PetscObject)qep)->fortran_func_pointers[1];
(*(void (PETSC_STDCALL *)(QEP*,PetscInt*,PetscInt*,PetscScalar*,PetscScalar*,PetscReal*,PetscInt*,void*,PetscErrorCode*))
(((PetscObject)qep)->fortran_func_pointers[0]))(&qep,&i,&nc,er,ei,d,&l,mctx,&ierr);CHKERRQ(ierr);
return 0;
}
 
static PetscErrorCode ourdestroy(void* ctx)
{
PetscErrorCode ierr = 0;
QEP qep = (QEP)ctx;
void *mctx = (void*) ((PetscObject)qep)->fortran_func_pointers[1];
(*(void (PETSC_STDCALL *)(void*,PetscErrorCode*))(((PetscObject)qep)->fortran_func_pointers[2]))(mctx,&ierr);CHKERRQ(ierr);
return 0;
}
 
EXTERN_C_BEGIN
 
void PETSC_STDCALL qepview_(QEP *qep,PetscViewer *viewer, PetscErrorCode *ierr)
{
PetscViewer v;
PetscPatchDefaultViewers_Fortran(viewer,v);
*ierr = QEPView(*qep,v);
}
 
void PETSC_STDCALL qepsettype_(QEP *qep,CHAR type PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))
{
char *t;
 
FIXCHAR(type,len,t);
*ierr = QEPSetType(*qep,t);
FREECHAR(type,t);
}
 
void PETSC_STDCALL qepgettype_(QEP *qep,CHAR name PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))
{
const QEPType tname;
 
*ierr = QEPGetType(*qep,&tname);if (*ierr) return;
*ierr = PetscStrncpy(name,tname,len);
FIXRETURNCHAR(PETSC_TRUE,name,len);
}
 
void PETSC_STDCALL qepsetoptionsprefix_(QEP *qep,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))
{
char *t;
 
FIXCHAR(prefix,len,t);
*ierr = QEPSetOptionsPrefix(*qep,t);
FREECHAR(prefix,t);
}
 
void PETSC_STDCALL qepappendoptionsprefix_(QEP *qep,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))
{
char *t;
 
FIXCHAR(prefix,len,t);
*ierr = QEPAppendOptionsPrefix(*qep,t);
FREECHAR(prefix,t);
}
 
void PETSC_STDCALL qepcreate_(MPI_Fint *comm,QEP *qep,PetscErrorCode *ierr)
{
*ierr = QEPCreate(MPI_Comm_f2c(*(comm)),qep);
}
 
void PETSC_STDCALL qepmonitorset_(QEP *qep,void (PETSC_STDCALL *monitor)(QEP*,PetscInt*,PetscInt*,PetscScalar*,PetscScalar*,PetscReal*,PetscInt*,void*,PetscErrorCode*),
void *mctx,void (PETSC_STDCALL *monitordestroy)(void *,PetscErrorCode *),PetscErrorCode *ierr)
{
CHKFORTRANNULLFUNCTION(monitordestroy);
PetscObjectAllocateFortranPointers(*qep,3);
if ((PetscVoidFunction)monitor == (PetscVoidFunction)qepmonitorall_) {
*ierr = QEPMonitorSet(*qep,QEPMonitorAll,0,0);
} else if ((PetscVoidFunction)monitor == (PetscVoidFunction)qepmonitorlg_) {
*ierr = QEPMonitorSet(*qep,QEPMonitorLG,0,0);
} else if ((PetscVoidFunction)monitor == (PetscVoidFunction)qepmonitorlgall_) {
*ierr = QEPMonitorSet(*qep,QEPMonitorLGAll,0,0);
} else if ((PetscVoidFunction)monitor == (PetscVoidFunction)qepmonitorconverged_) {
*ierr = QEPMonitorSet(*qep,QEPMonitorConverged,0,0);
} else if ((PetscVoidFunction)monitor == (PetscVoidFunction)qepmonitorfirst_) {
*ierr = QEPMonitorSet(*qep,QEPMonitorFirst,0,0);
} else {
((PetscObject)*qep)->fortran_func_pointers[0] = (PetscVoidFunction)monitor;
((PetscObject)*qep)->fortran_func_pointers[1] = (PetscVoidFunction)mctx;
if (FORTRANNULLFUNCTION(monitordestroy)) {
*ierr = QEPMonitorSet(*qep,ourmonitor,*qep,0);
} else {
((PetscObject)*qep)->fortran_func_pointers[2] = (PetscVoidFunction)monitordestroy;
*ierr = QEPMonitorSet(*qep,ourmonitor,*qep,ourdestroy);
}
}
}
 
void PETSC_STDCALL qepgetoptionsprefix_(QEP *qep,CHAR prefix PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))
{
const char *tname;
 
*ierr = QEPGetOptionsPrefix(*qep,&tname); if (*ierr) return;
*ierr = PetscStrncpy(prefix,tname,len);
}
 
void PETSC_STDCALL qepgetip_(QEP *qep,IP *ip,PetscErrorCode *ierr)
{
*ierr = QEPGetIP(*qep,ip);
}
 
void PETSC_STDCALL qepgetwhicheigenpairs_(QEP *qep,QEPWhich *which,PetscErrorCode *ierr)
{
*ierr = QEPGetWhichEigenpairs(*qep,which);
}
 
void PETSC_STDCALL qepgetproblemtype_(QEP *qep,QEPProblemType *type,PetscErrorCode *ierr)
{
*ierr = QEPGetProblemType(*qep,type);
}
 
void PETSC_STDCALL qepgetconvergedreason_(QEP *qep,QEPConvergedReason *reason,PetscErrorCode *ierr)
{
*ierr = QEPGetConvergedReason(*qep,reason);
}
 
EXTERN_C_END
 
/tags/slepc-3_1-2/src/qep/interface/ftn-custom/makefile New file
0,0 → 1,33
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# SLEPc - Scalable Library for Eigenvalue Problem Computations
# Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
#
# This file is part of SLEPc.
#
# 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/>.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
 
#requirespackage 'PETSC_HAVE_FORTRAN'
ALL: lib
CFLAGS =
FFLAGS =
SOURCEC = zqepf.c
OBJSC = zqepf.o
SOURCEF =
SOURCEH =
DIRS =
LIBBASE = libslepc
LOCDIR = src/qep/interface/ftn-custom/
include ${SLEPC_DIR}/conf/slepc_common
/tags/slepc-3_1-2/src/qep/interface/qepsolve.c New file
0,0 → 1,794
/*
QEP routines related to the solution process.
 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SLEPc - Scalable Library for Eigenvalue Problem Computations
Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
 
This file is part of SLEPc.
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/>.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
 
#include "private/qepimpl.h" /*I "slepcqep.h" I*/
 
#undef __FUNCT__
#define __FUNCT__ "QEPSolve"
/*@
QEPSolve - Solves the quadratic eigensystem.
 
Collective on QEP
 
Input Parameter:
. qep - eigensolver context obtained from QEPCreate()
 
Options Database:
+ -qep_view - print information about the solver used
. -qep_view_binary - save the matrices to the default binary file
- -qep_plot_eigs - plot computed eigenvalues
 
Level: beginner
 
.seealso: QEPCreate(), QEPSetUp(), QEPDestroy(), QEPSetTolerances()
@*/
PetscErrorCode QEPSolve(QEP qep)
{
PetscErrorCode ierr;
PetscInt i;
PetscReal re,im;
PetscTruth flg;
PetscViewer viewer;
PetscDraw draw;
PetscDrawSP drawsp;
char filename[PETSC_MAX_PATH_LEN];
 
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
 
flg = PETSC_FALSE;
ierr = PetscOptionsGetTruth(((PetscObject)qep)->prefix,"-qep_view_binary",&flg,PETSC_NULL);CHKERRQ(ierr);
if (flg) {
ierr = MatView(qep->M,PETSC_VIEWER_BINARY_(((PetscObject)qep)->comm));CHKERRQ(ierr);
ierr = MatView(qep->C,PETSC_VIEWER_BINARY_(((PetscObject)qep)->comm));CHKERRQ(ierr);
ierr = MatView(qep->K,PETSC_VIEWER_BINARY_(((PetscObject)qep)->comm));CHKERRQ(ierr);
}
 
/* reset the convergence flag from the previous solves */
qep->reason = QEP_CONVERGED_ITERATING;
 
if (!qep->setupcalled){ ierr = QEPSetUp(qep);CHKERRQ(ierr); }
ierr = IPResetOperationCounters(qep->ip);CHKERRQ(ierr);
qep->nconv = 0;
qep->its = 0;
qep->matvecs = 0;
qep->linits = 0;
for (i=0;i<qep->ncv;i++) qep->eigr[i]=qep->eigi[i]=qep->errest[i]=0.0;
QEPMonitor(qep,qep->its,qep->nconv,qep->eigr,qep->eigi,qep->errest,qep->ncv);
 
ierr = PetscLogEventBegin(QEP_Solve,qep,0,0,0);CHKERRQ(ierr);
ierr = (*qep->ops->solve)(qep);CHKERRQ(ierr);
ierr = PetscLogEventEnd(QEP_Solve,qep,0,0,0);CHKERRQ(ierr);
 
if (!qep->reason) {
SETERRQ(1,"Internal error, solver returned without setting converged reason");
}
 
#ifndef PETSC_USE_COMPLEX
/* reorder conjugate eigenvalues (positive imaginary first) */
for (i=0;i<qep->nconv-1;i++) {
if (qep->eigi[i] != 0) {
if (qep->eigi[i] < 0) {
qep->eigi[i] = -qep->eigi[i];
qep->eigi[i+1] = -qep->eigi[i+1];
ierr = VecScale(qep->V[i+1],-1.0);CHKERRQ(ierr);
}
i++;
}
}
#endif
 
/* sort eigenvalues according to qep->which parameter */
ierr = PetscFree(qep->perm);CHKERRQ(ierr);
if (qep->nconv > 0) {
ierr = PetscMalloc(sizeof(PetscInt)*qep->nconv,&qep->perm);CHKERRQ(ierr);
ierr = QEPSortEigenvalues(qep,qep->nconv,qep->eigr,qep->eigi,qep->perm);CHKERRQ(ierr);
}
 
ierr = PetscOptionsGetString(((PetscObject)qep)->prefix,"-qep_view",filename,PETSC_MAX_PATH_LEN,&flg);CHKERRQ(ierr);
if (flg && !PetscPreLoadingOn) {
ierr = PetscViewerASCIIOpen(((PetscObject)qep)->comm,filename,&viewer);CHKERRQ(ierr);
ierr = QEPView(qep,viewer);CHKERRQ(ierr);
ierr = PetscViewerDestroy(viewer);CHKERRQ(ierr);
}
 
flg = PETSC_FALSE;
ierr = PetscOptionsGetTruth(((PetscObject)qep)->prefix,"-qep_plot_eigs",&flg,PETSC_NULL);CHKERRQ(ierr);
if (flg) {
ierr = PetscViewerDrawOpen(PETSC_COMM_SELF,0,"Computed Eigenvalues",
PETSC_DECIDE,PETSC_DECIDE,300,300,&viewer);CHKERRQ(ierr);
ierr = PetscViewerDrawGetDraw(viewer,0,&draw);CHKERRQ(ierr);
ierr = PetscDrawSPCreate(draw,1,&drawsp);CHKERRQ(ierr);
for(i=0;i<qep->nconv;i++) {
#if defined(PETSC_USE_COMPLEX)
re = PetscRealPart(qep->eigr[i]);
im = PetscImaginaryPart(qep->eigi[i]);
#else
re = qep->eigr[i];
im = qep->eigi[i];
#endif
ierr = PetscDrawSPAddPoint(drawsp,&re,&im);CHKERRQ(ierr);
}
ierr = PetscDrawSPDraw(drawsp);CHKERRQ(ierr);
ierr = PetscDrawSPDestroy(drawsp);CHKERRQ(ierr);
ierr = PetscViewerDestroy(viewer);CHKERRQ(ierr);
}
 
/* Remove the initial subspace */
qep->nini = 0;
 
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPGetIterationNumber"
/*@
QEPGetIterationNumber - Gets the current iteration number. If the
call to QEPSolve() is complete, then it returns the number of iterations
carried out by the solution method.
Not Collective
 
Input Parameter:
. qep - the quadratic eigensolver context
 
Output Parameter:
. its - number of iterations
 
Level: intermediate
 
Note:
During the i-th iteration this call returns i-1. If QEPSolve() is
complete, then parameter "its" contains either the iteration number at
which convergence was successfully reached, or failure was detected.
Call QEPGetConvergedReason() to determine if the solver converged or
failed and why.
 
.seealso: QEPGetConvergedReason(), QEPSetTolerances()
@*/
PetscErrorCode QEPGetIterationNumber(QEP qep,PetscInt *its)
{
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
PetscValidIntPointer(its,2);
*its = qep->its;
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPGetConverged"
/*@
QEPGetConverged - Gets the number of converged eigenpairs.
 
Not Collective
 
Input Parameter:
. qep - the quadratic eigensolver context
Output Parameter:
. nconv - number of converged eigenpairs
 
Note:
This function should be called after QEPSolve() has finished.
 
Level: beginner
 
.seealso: QEPSetDimensions(), QEPSolve()
@*/
PetscErrorCode QEPGetConverged(QEP qep,PetscInt *nconv)
{
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
PetscValidIntPointer(nconv,2);
*nconv = qep->nconv;
PetscFunctionReturn(0);
}
 
 
#undef __FUNCT__
#define __FUNCT__ "QEPGetConvergedReason"
/*@C
QEPGetConvergedReason - Gets the reason why the QEPSolve() iteration was
stopped.
 
Not Collective
 
Input Parameter:
. qep - the quadratic eigensolver context
 
Output Parameter:
. reason - negative value indicates diverged, positive value converged
 
Possible values for reason:
+ QEP_CONVERGED_TOL - converged up to tolerance
. QEP_DIVERGED_ITS - required more than its to reach convergence
- QEP_DIVERGED_BREAKDOWN - generic breakdown in method
 
Note:
Can only be called after the call to QEPSolve() is complete.
 
Level: intermediate
 
.seealso: QEPSetTolerances(), QEPSolve(), QEPConvergedReason
@*/
PetscErrorCode QEPGetConvergedReason(QEP qep,QEPConvergedReason *reason)
{
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
PetscValidIntPointer(reason,2);
*reason = qep->reason;
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPGetEigenpair"
/*@
QEPGetEigenpair - Gets the i-th solution of the eigenproblem as computed by
QEPSolve(). The solution consists in both the eigenvalue and the eigenvector.
 
Not Collective, but vectors are shared by all processors that share the QEP
 
Input Parameters:
+ qep - quadratic eigensolver context
- i - index of the solution
 
Output Parameters:
+ eigr - real part of eigenvalue
. eigi - imaginary part of eigenvalue
. Vr - real part of eigenvector
- Vi - imaginary part of eigenvector
 
Notes:
If the eigenvalue is real, then eigi and Vi are set to zero. If PETSc is
configured with complex scalars the eigenvalue is stored
directly in eigr (eigi is set to zero) and the eigenvector in Vr (Vi is
set to zero).
 
The index i should be a value between 0 and nconv-1 (see QEPGetConverged()).
Eigenpairs are indexed according to the ordering criterion established
with QEPSetWhichEigenpairs().
 
Level: beginner
 
.seealso: QEPSolve(), QEPGetConverged(), QEPSetWhichEigenpairs()
@*/
PetscErrorCode QEPGetEigenpair(QEP qep, PetscInt i, PetscScalar *eigr, PetscScalar *eigi, Vec Vr, Vec Vi)
{
PetscInt k;
PetscErrorCode ierr;
 
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
if (!qep->eigr || !qep->eigi || !qep->V) {
SETERRQ(PETSC_ERR_ARG_WRONGSTATE, "QEPSolve must be called first");
}
if (i<0 || i>=qep->nconv) {
SETERRQ(PETSC_ERR_ARG_OUTOFRANGE, "Argument 2 out of range");
}
 
if (!qep->perm) k = i;
else k = qep->perm[i];
 
/* eigenvalue */
#ifdef PETSC_USE_COMPLEX
if (eigr) *eigr = qep->eigr[k];
if (eigi) *eigi = 0;
#else
if (eigr) *eigr = qep->eigr[k];
if (eigi) *eigi = qep->eigi[k];
#endif
/* eigenvector */
#ifdef PETSC_USE_COMPLEX
if (Vr) { ierr = VecCopy(qep->V[k],Vr);CHKERRQ(ierr); }
if (Vi) { ierr = VecSet(Vi,0.0);CHKERRQ(ierr); }
#else
if (qep->eigi[k]>0) { /* first value of conjugate pair */
if (Vr) { ierr = VecCopy(qep->V[k],Vr);CHKERRQ(ierr); }
if (Vi) { ierr = VecCopy(qep->V[k+1],Vi);CHKERRQ(ierr); }
} else if (qep->eigi[k]<0) { /* second value of conjugate pair */
if (Vr) { ierr = VecCopy(qep->V[k-1],Vr);CHKERRQ(ierr); }
if (Vi) {
ierr = VecCopy(qep->V[k],Vi);CHKERRQ(ierr);
ierr = VecScale(Vi,-1.0);CHKERRQ(ierr);
}
} else { /* real eigenvalue */
if (Vr) { ierr = VecCopy(qep->V[k],Vr);CHKERRQ(ierr); }
if (Vi) { ierr = VecSet(Vi,0.0);CHKERRQ(ierr); }
}
#endif
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPGetErrorEstimate"
/*@
QEPGetErrorEstimate - Returns the error estimate associated to the i-th
computed eigenpair.
 
Not Collective
 
Input Parameter:
+ qep - quadratic eigensolver context
- i - index of eigenpair
 
Output Parameter:
. errest - the error estimate
 
Notes:
This is the error estimate used internally by the eigensolver. The actual
error bound can be computed with QEPComputeRelativeError(). See also the users
manual for details.
 
Level: advanced
 
.seealso: QEPComputeRelativeError()
@*/
PetscErrorCode QEPGetErrorEstimate(QEP qep, PetscInt i, PetscReal *errest)
{
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
if (!qep->eigr || !qep->eigi) {
SETERRQ(PETSC_ERR_ARG_WRONGSTATE, "QEPSolve must be called first");
}
if (i<0 || i>=qep->nconv) {
SETERRQ(PETSC_ERR_ARG_OUTOFRANGE, "Argument 2 out of range");
}
if (qep->perm) i = qep->perm[i];
if (errest) *errest = qep->errest[i];
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPComputeResidualNorm_Private"
/*
QEPComputeResidualNorm_Private - Computes the norm of the residual vector
associated with an eigenpair.
*/
PetscErrorCode QEPComputeResidualNorm_Private(QEP qep, PetscScalar kr, PetscScalar ki, Vec xr, Vec xi, PetscReal *norm)
{
PetscErrorCode ierr;
Vec u,w;
Mat M=qep->M,C=qep->C,K=qep->K;
#ifndef PETSC_USE_COMPLEX
Vec v,y,z;
PetscReal ni,nr;
PetscScalar a1,a2;
#endif
PetscFunctionBegin;
ierr = VecDuplicate(qep->V[0],&u);CHKERRQ(ierr);
ierr = VecDuplicate(u,&w);CHKERRQ(ierr);
#ifndef PETSC_USE_COMPLEX
if (ki == 0 ||
PetscAbsScalar(ki) < PetscAbsScalar(kr*PETSC_MACHINE_EPSILON)) {
#endif
ierr = MatMult(K,xr,u);CHKERRQ(ierr); /* u=K*x */
if (PetscAbsScalar(kr) > PETSC_MACHINE_EPSILON) {
ierr = MatMult(C,xr,w);CHKERRQ(ierr); /* w=C*x */
ierr = VecAXPY(u,kr,w);CHKERRQ(ierr); /* u=l*C*x+K*x */
ierr = MatMult(M,xr,w);CHKERRQ(ierr); /* w=M*x */
ierr = VecAXPY(u,kr*kr,w);CHKERRQ(ierr); /* u=l^2*M*x+l*C*x+K*x */
}
ierr = VecNorm(u,NORM_2,norm);CHKERRQ(ierr);
#ifndef PETSC_USE_COMPLEX
} else {
ierr = VecDuplicate(u,&v);CHKERRQ(ierr);
ierr = VecDuplicate(u,&y);CHKERRQ(ierr);
ierr = VecDuplicate(u,&z);CHKERRQ(ierr);
a1 = kr*kr-ki*ki;
a2 = 2.0*kr*ki;
ierr = MatMult(K,xr,u);CHKERRQ(ierr); /* u=K*xr */
if (SlepcAbsEigenvalue(kr,ki) > PETSC_MACHINE_EPSILON) {
ierr = MatMult(C,xr,v);CHKERRQ(ierr); /* v=C*xr */
ierr = MatMult(C,xi,w);CHKERRQ(ierr); /* w=C*xi */
ierr = MatMult(M,xr,y);CHKERRQ(ierr); /* y=M*xr */
ierr = MatMult(M,xi,z);CHKERRQ(ierr); /* z=M*xi */
ierr = VecAXPY(u,kr,v);CHKERRQ(ierr); /* u=kr*C*xr+K*xr */
ierr = VecAXPY(u,-ki,w);CHKERRQ(ierr); /* u=kr*C*xr-ki*C*xi+K*xr */
ierr = VecAXPY(u,a1,y);CHKERRQ(ierr); /* u=a1*M*xr+kr*C*xr-ki*C*xi+K*xr */
ierr = VecAXPY(u,-a2,z);CHKERRQ(ierr); /* u=a1*M*xr-a2*M*xi+kr*C*xr-ki*C*xi+K*xr */
}
ierr = VecNorm(u,NORM_2,&nr);CHKERRQ(ierr);
ierr = MatMult(K,xi,u);CHKERRQ(ierr); /* u=K*xi */
if (SlepcAbsEigenvalue(kr,ki) > PETSC_MACHINE_EPSILON) {
ierr = VecAXPY(u,kr,w);CHKERRQ(ierr); /* u=kr*C*xi+K*xi */
ierr = VecAXPY(u,ki,v);CHKERRQ(ierr); /* u=kr*C*xi+ki*C*xi+K*xi */
ierr = VecAXPY(u,a1,z);CHKERRQ(ierr); /* u=a1*M*xi+kr*C*xi+ki*C*xi+K*xi */
ierr = VecAXPY(u,a2,y);CHKERRQ(ierr); /* u=a1*M*xi+a2*M*ki+kr*C*xi+ki*C*xi+K*xi */
}
ierr = VecNorm(u,NORM_2,&ni);CHKERRQ(ierr);
*norm = SlepcAbsEigenvalue(nr,ni);
ierr = VecDestroy(v);CHKERRQ(ierr);
ierr = VecDestroy(y);CHKERRQ(ierr);
ierr = VecDestroy(z);CHKERRQ(ierr);
}
#endif
 
ierr = VecDestroy(w);CHKERRQ(ierr);
ierr = VecDestroy(u);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPComputeResidualNorm"
/*@
QEPComputeResidualNorm - Computes the norm of the residual vector associated with
the i-th computed eigenpair.
 
Collective on QEP
 
Input Parameter:
. qep - the quadratic eigensolver context
. i - the solution index
 
Output Parameter:
. norm - the residual norm, computed as ||(l^2*M+l*C+K)x||_2 where l is the
eigenvalue and x is the eigenvector.
If l=0 then the residual norm is computed as ||Kx||_2.
 
Notes:
The index i should be a value between 0 and nconv-1 (see QEPGetConverged()).
Eigenpairs are indexed according to the ordering criterion established
with QEPSetWhichEigenpairs().
 
Level: beginner
 
.seealso: QEPSolve(), QEPGetConverged(), QEPSetWhichEigenpairs()
@*/
PetscErrorCode QEPComputeResidualNorm(QEP qep, PetscInt i, PetscReal *norm)
{
PetscErrorCode ierr;
Vec xr,xi;
PetscScalar kr,ki;
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
PetscValidPointer(norm,3);
ierr = VecDuplicate(qep->V[0],&xr);CHKERRQ(ierr);
ierr = VecDuplicate(qep->V[0],&xi);CHKERRQ(ierr);
ierr = QEPGetEigenpair(qep,i,&kr,&ki,xr,xi);CHKERRQ(ierr);
ierr = QEPComputeResidualNorm_Private(qep,kr,ki,xr,xi,norm);CHKERRQ(ierr);
ierr = VecDestroy(xr);CHKERRQ(ierr);
ierr = VecDestroy(xi);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPComputeRelativeError_Private"
/*
QEPComputeRelativeError_Private - Computes the relative error bound
associated with an eigenpair.
*/
PetscErrorCode QEPComputeRelativeError_Private(QEP qep, PetscScalar kr, PetscScalar ki, Vec xr, Vec xi, PetscReal *error)
{
PetscErrorCode ierr;
PetscReal norm, er;
#ifndef PETSC_USE_COMPLEX
PetscReal ei;
#endif
PetscFunctionBegin;
ierr = QEPComputeResidualNorm_Private(qep,kr,ki,xr,xi,&norm);CHKERRQ(ierr);
 
#ifndef PETSC_USE_COMPLEX
if (ki == 0 ||
PetscAbsScalar(ki) < PetscAbsScalar(kr*PETSC_MACHINE_EPSILON)) {
#endif
ierr = VecNorm(xr,NORM_2,&er);CHKERRQ(ierr);
if (PetscAbsScalar(kr) > norm) {
*error = norm/(PetscAbsScalar(kr)*er);
} else {
*error = norm/er;
}
#ifndef PETSC_USE_COMPLEX
} else {
ierr = VecNorm(xr,NORM_2,&er);CHKERRQ(ierr);
ierr = VecNorm(xi,NORM_2,&ei);CHKERRQ(ierr);
if (SlepcAbsEigenvalue(kr,ki) > norm) {
*error = norm/(SlepcAbsEigenvalue(kr,ki)*SlepcAbsEigenvalue(er,ei));
} else {
*error = norm/SlepcAbsEigenvalue(er,ei);
}
}
#endif
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPComputeRelativeError"
/*@
QEPComputeRelativeError - Computes the relative error bound associated
with the i-th computed eigenpair.
 
Collective on QEP
 
Input Parameter:
. qep - the quadratic eigensolver context
. i - the solution index
 
Output Parameter:
. error - the relative error bound, computed as ||(l^2*M+l*C+K)x||_2/||lx||_2 where
l is the eigenvalue and x is the eigenvector.
If l=0 the relative error is computed as ||Kx||_2/||x||_2.
 
Level: beginner
 
.seealso: QEPSolve(), QEPComputeResidualNorm(), QEPGetErrorEstimate()
@*/
PetscErrorCode QEPComputeRelativeError(QEP qep, PetscInt i, PetscReal *error)
{
PetscErrorCode ierr;
Vec xr,xi;
PetscScalar kr,ki;
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
PetscValidPointer(error,3);
ierr = VecDuplicate(qep->V[0],&xr);CHKERRQ(ierr);
ierr = VecDuplicate(qep->V[0],&xi);CHKERRQ(ierr);
ierr = QEPGetEigenpair(qep,i,&kr,&ki,xr,xi);CHKERRQ(ierr);
ierr = QEPComputeRelativeError_Private(qep,kr,ki,xr,xi,error);CHKERRQ(ierr);
ierr = VecDestroy(xr);CHKERRQ(ierr);
ierr = VecDestroy(xi);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPSortEigenvalues"
/*@
QEPSortEigenvalues - Sorts a list of eigenvalues according to the criterion
specified via QEPSetWhichEigenpairs().
 
Not Collective
 
Input Parameters:
+ qep - the quadratic eigensolver context
. n - number of eigenvalues in the list
. eigr - pointer to the array containing the eigenvalues
- eigi - imaginary part of the eigenvalues (only when using real numbers)
 
Output Parameter:
. perm - resulting permutation
 
Note:
The result is a list of indices in the original eigenvalue array
corresponding to the first nev eigenvalues sorted in the specified
criterion.
 
Level: developer
 
.seealso: QEPSortEigenvaluesReal(), QEPSetWhichEigenpairs()
@*/
PetscErrorCode QEPSortEigenvalues(QEP qep,PetscInt n,PetscScalar *eigr,PetscScalar *eigi,PetscInt *perm)
{
PetscErrorCode ierr;
PetscScalar re,im;
PetscInt i,j,result,tmp;
 
PetscFunctionBegin;
for (i=0; i<n; i++) { perm[i] = i; }
/* insertion sort */
for (i=n-1; i>=0; i--) {
re = eigr[perm[i]];
im = eigi[perm[i]];
j = i + 1;
#ifndef PETSC_USE_COMPLEX
if (im != 0) {
/* complex eigenvalue */
i--;
im = eigi[perm[i]];
}
#endif
while (j<n) {
ierr = QEPCompareEigenvalues(qep,re,im,eigr[perm[j]],eigi[perm[j]],&result);CHKERRQ(ierr);
if (result >= 0) break;
#ifndef PETSC_USE_COMPLEX
/* keep together every complex conjugated eigenpair */
if (im == 0) {
if (eigi[perm[j]] == 0) {
#endif
tmp = perm[j-1]; perm[j-1] = perm[j]; perm[j] = tmp;
j++;
#ifndef PETSC_USE_COMPLEX
} else {
tmp = perm[j-1]; perm[j-1] = perm[j]; perm[j] = perm[j+1]; perm[j+1] = tmp;
j+=2;
}
} else {
if (eigi[perm[j]] == 0) {
tmp = perm[j-2]; perm[j-2] = perm[j]; perm[j] = perm[j-1]; perm[j-1] = tmp;
j++;
} else {
tmp = perm[j-2]; perm[j-2] = perm[j]; perm[j] = tmp;
tmp = perm[j-1]; perm[j-1] = perm[j+1]; perm[j+1] = tmp;
j+=2;
}
}
#endif
}
}
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPSortEigenvaluesReal"
/*@
QEPSortEigenvaluesReal - Sorts a list of eigenvalues according to a certain
criterion (version for real eigenvalues only).
 
Not Collective
 
Input Parameters:
+ qep - the quadratic eigensolver context
. n - number of eigenvalue in the list
- eig - pointer to the array containing the eigenvalues (real)
 
Output Parameter:
. perm - resulting permutation
 
Note:
The result is a list of indices in the original eigenvalue array
corresponding to the first nev eigenvalues sorted in the specified
criterion.
 
Level: developer
 
.seealso: QEPSortEigenvalues(), QEPSetWhichEigenpairs(), QEPCompareEigenvalues()
@*/
PetscErrorCode QEPSortEigenvaluesReal(QEP qep,PetscInt n,PetscReal *eig,PetscInt *perm)
{
PetscErrorCode ierr;
PetscScalar re;
PetscInt i,j,result,tmp;
 
PetscFunctionBegin;
for (i=0; i<n; i++) { perm[i] = i; }
/* insertion sort */
for (i=1; i<n; i++) {
re = eig[perm[i]];
j = i-1;
ierr = QEPCompareEigenvalues(qep,re,0.0,eig[perm[j]],0.0,&result);CHKERRQ(ierr);
while (result>0 && j>=0) {
tmp = perm[j]; perm[j] = perm[j+1]; perm[j+1] = tmp; j--;
if (j>=0) {
ierr = QEPCompareEigenvalues(qep,re,0.0,eig[perm[j]],0.0,&result);CHKERRQ(ierr);
}
}
}
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPCompareEigenvalues"
/*@
QEPCompareEigenvalues - Compares two (possibly complex) eigenvalues according
to a certain criterion.
 
Not Collective
 
Input Parameters:
+ qep - the quadratic eigensolver context
. ar - real part of the 1st eigenvalue
. ai - imaginary part of the 1st eigenvalue
. br - real part of the 2nd eigenvalue
- bi - imaginary part of the 2nd eigenvalue
 
Output Parameter:
. res - result of comparison
 
Notes:
Returns an integer less than, equal to, or greater than zero if the first
eigenvalue is considered to be respectively less than, equal to, or greater
than the second one.
 
The criterion of comparison is related to the 'which' parameter set with
QEPSetWhichEigenpairs().
 
Level: developer
 
.seealso: QEPSortEigenvalues(), QEPSetWhichEigenpairs()
@*/
PetscErrorCode QEPCompareEigenvalues(QEP qep,PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *result)
{
PetscReal a,b;
 
PetscFunctionBegin;
switch(qep->which) {
case QEP_LARGEST_MAGNITUDE:
case QEP_SMALLEST_MAGNITUDE:
a = SlepcAbsEigenvalue(ar,ai);
b = SlepcAbsEigenvalue(br,bi);
break;
case QEP_LARGEST_REAL:
case QEP_SMALLEST_REAL:
a = PetscRealPart(ar);
b = PetscRealPart(br);
break;
case QEP_LARGEST_IMAGINARY:
case QEP_SMALLEST_IMAGINARY:
#if defined(PETSC_USE_COMPLEX)
a = PetscImaginaryPart(ar);
b = PetscImaginaryPart(br);
#else
a = PetscAbsReal(ai);
b = PetscAbsReal(bi);
#endif
break;
default: SETERRQ(1,"Wrong value of which");
}
switch(qep->which) {
case QEP_LARGEST_MAGNITUDE:
case QEP_LARGEST_REAL:
case QEP_LARGEST_IMAGINARY:
if (a<b) *result = -1;
else if (a>b) *result = 1;
else *result = 0;
break;
default:
if (a>b) *result = -1;
else if (a<b) *result = 1;
else *result = 0;
}
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPGetOperationCounters"
/*@
QEPGetOperationCounters - Gets the total number of matrix-vector products, dot
products, and linear solve iterations used by the QEP object during the last
QEPSolve() call.
 
Not Collective
 
Input Parameter:
. qep - quadratic eigensolver context
 
Output Parameter:
+ matvecs - number of matrix-vector product operations
. dots - number of dot product operations
- lits - number of linear iterations
 
Notes:
These counters are reset to zero at each successive call to QEPSolve().
 
Level: intermediate
 
@*/
PetscErrorCode QEPGetOperationCounters(QEP qep,PetscInt* matvecs,PetscInt* dots,PetscInt* lits)
{
PetscErrorCode ierr;
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
if (matvecs) *matvecs = qep->matvecs;
if (dots) {
ierr = IPGetOperationCounters(qep->ip,dots);CHKERRQ(ierr);
}
if (lits) *lits = qep->linits;
PetscFunctionReturn(0);
}
/tags/slepc-3_1-2/src/qep/interface/qepmon.c New file
0,0 → 1,369
/*
QEP routines related to monitors.
 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SLEPc - Scalable Library for Eigenvalue Problem Computations
Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
 
This file is part of SLEPc.
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/>.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
 
#include "private/qepimpl.h" /*I "slepcqep.h" I*/
 
#undef __FUNCT__
#define __FUNCT__ "QEPMonitorSet"
/*@C
QEPMonitorSet - Sets an ADDITIONAL function to be called at every
iteration to monitor the error estimates for each requested eigenpair.
Collective on QEP
 
Input Parameters:
+ qep - eigensolver context obtained from QEPCreate()
. monitor - pointer to function (if this is PETSC_NULL, it turns off monitoring)
. mctx - [optional] context for private data for the
monitor routine (use PETSC_NULL if no context is desired)
- monitordestroy - [optional] routine that frees monitor context
(may be PETSC_NULL)
 
Calling Sequence of monitor:
$ monitor (QEP qep, int its, int nconv, PetscScalar *eigr, PetscScalar *eigi, PetscReal* errest, int nest, void *mctx)
 
+ qep - quadratic eigensolver context obtained from QEPCreate()
. its - iteration number
. nconv - number of converged eigenpairs
. eigr - real part of the eigenvalues
. eigi - imaginary part of the eigenvalues
. errest - relative error estimates for each eigenpair
. nest - number of error estimates
- mctx - optional monitoring context, as set by QEPMonitorSet()
 
Options Database Keys:
+ -qep_monitor - print only the first error estimate
. -qep_monitor_all - print error estimates at each iteration
. -qep_monitor_conv - print the eigenvalue approximations only when
convergence has been reached
. -qep_monitor_draw - sets line graph monitor for the first unconverged
approximate eigenvalue
. -qep_monitor_draw_all - sets line graph monitor for all unconverged
approximate eigenvalue
- -qep_monitor_cancel - cancels all monitors that have been hardwired into
a code by calls to QEPMonitorSet(), but does not cancel those set via
the options database.
 
Notes:
Several different monitoring routines may be set by calling
QEPMonitorSet() multiple times; all will be called in the
order in which they were set.
 
Level: intermediate
 
.seealso: QEPMonitorFirst(), QEPMonitorAll(), QEPMonitorLG(), QEPMonitorLGAll(), QEPMonitorCancel()
@*/
PetscErrorCode QEPMonitorSet(QEP qep,PetscErrorCode (*monitor)(QEP,PetscInt,PetscInt,PetscScalar*,PetscScalar*,PetscReal*,PetscInt,void*),
void *mctx,PetscErrorCode (*monitordestroy)(void*))
{
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
if (qep->numbermonitors >= MAXQEPMONITORS) {
SETERRQ(PETSC_ERR_ARG_OUTOFRANGE,"Too many QEP monitors set");
}
qep->monitor[qep->numbermonitors] = monitor;
qep->monitorcontext[qep->numbermonitors] = (void*)mctx;
qep->monitordestroy[qep->numbermonitors++] = monitordestroy;
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPMonitorCancel"
/*@
QEPMonitorCancel - Clears all monitors for a QEP object.
 
Collective on QEP
 
Input Parameters:
. qep - eigensolver context obtained from QEPCreate()
 
Options Database Key:
. -qep_monitor_cancel - Cancels all monitors that have been hardwired
into a code by calls to QEPMonitorSet(),
but does not cancel those set via the options database.
 
Level: intermediate
 
.seealso: QEPMonitorSet()
@*/
PetscErrorCode QEPMonitorCancel(QEP qep)
{
PetscErrorCode ierr;
PetscInt i;
 
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
for (i=0; i<qep->numbermonitors; i++) {
if (qep->monitordestroy[i]) {
ierr = (*qep->monitordestroy[i])(qep->monitorcontext[i]);CHKERRQ(ierr);
}
}
qep->numbermonitors = 0;
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPGetMonitorContext"
/*@C
QEPGetMonitorContext - Gets the monitor context, as set by
QEPSetMonitor() for the FIRST monitor only.
 
Not Collective
 
Input Parameter:
. qep - eigensolver context obtained from QEPCreate()
 
Output Parameter:
. ctx - monitor context
 
Level: intermediate
 
.seealso: QEPSetMonitor(), QEPDefaultMonitor()
@*/
PetscErrorCode QEPGetMonitorContext(QEP qep, void **ctx)
{
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
*ctx = (qep->monitorcontext[0]);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPMonitorAll"
/*@C
QEPMonitorAll - Print the current approximate values and
error estimates at each iteration of the quadratic eigensolver.
 
Collective on QEP
 
Input Parameters:
+ qep - quadratic eigensolver context
. its - iteration number
. nconv - number of converged eigenpairs so far
. eigr - real part of the eigenvalues
. eigi - imaginary part of the eigenvalues
. errest - error estimates
. nest - number of error estimates to display
- dummy - unused monitor context
 
Level: intermediate
 
.seealso: QEPMonitorSet()
@*/
PetscErrorCode QEPMonitorAll(QEP qep,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *dummy)
{
PetscErrorCode ierr;
PetscInt i;
PetscViewerASCIIMonitor viewer = (PetscViewerASCIIMonitor) dummy;
 
PetscFunctionBegin;
if (its) {
if (!dummy) {ierr = PetscViewerASCIIMonitorCreate(((PetscObject)qep)->comm,"stdout",0,&viewer);CHKERRQ(ierr);}
ierr = PetscViewerASCIIMonitorPrintf(viewer,"%3d QEP nconv=%d Values (Errors)",its,nconv);CHKERRQ(ierr);
for (i=0;i<nest;i++) {
#if defined(PETSC_USE_COMPLEX)
ierr = PetscViewerASCIIMonitorPrintf(viewer," %g%+gi",PetscRealPart(eigr[i]),PetscImaginaryPart(eigr[i]));CHKERRQ(ierr);
#else
ierr = PetscViewerASCIIMonitorPrintf(viewer," %g",eigr[i]);CHKERRQ(ierr);
if (eigi[i]!=0.0) { ierr = PetscViewerASCIIMonitorPrintf(viewer,"%+gi",eigi[i]);CHKERRQ(ierr); }
#endif
ierr = PetscViewerASCIIMonitorPrintf(viewer," (%10.8e)",errest[i]);CHKERRQ(ierr);
}
ierr = PetscViewerASCIIMonitorPrintf(viewer,"\n");CHKERRQ(ierr);
if (!dummy) {ierr = PetscViewerASCIIMonitorDestroy(viewer);CHKERRQ(ierr);}
}
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPMonitorFirst"
/*@C
QEPMonitorFirst - Print the first unconverged approximate value and
error estimate at each iteration of the quadratic eigensolver.
 
Collective on QEP
 
Input Parameters:
+ qep - quadratic eigensolver context
. its - iteration number
. nconv - number of converged eigenpairs so far
. eigr - real part of the eigenvalues
. eigi - imaginary part of the eigenvalues
. errest - error estimates
. nest - number of error estimates to display
- dummy - unused monitor context
 
Level: intermediate
 
.seealso: QEPMonitorSet()
@*/
PetscErrorCode QEPMonitorFirst(QEP qep,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *dummy)
{
PetscErrorCode ierr;
PetscViewerASCIIMonitor viewer = (PetscViewerASCIIMonitor) dummy;
 
PetscFunctionBegin;
if (its && nconv<nest) {
if (!dummy) {ierr = PetscViewerASCIIMonitorCreate(((PetscObject)qep)->comm,"stdout",0,&viewer);CHKERRQ(ierr);}
ierr = PetscViewerASCIIMonitorPrintf(viewer,"%3d QEP nconv=%d first unconverged value (error)",its,nconv);CHKERRQ(ierr);
#if defined(PETSC_USE_COMPLEX)
ierr = PetscViewerASCIIMonitorPrintf(viewer," %g%+gi",PetscRealPart(eigr[nconv]),PetscImaginaryPart(eigr[nconv]));CHKERRQ(ierr);
#else
ierr = PetscViewerASCIIMonitorPrintf(viewer," %g",eigr[nconv]);CHKERRQ(ierr);
if (eigi[nconv]!=0.0) { ierr = PetscViewerASCIIMonitorPrintf(viewer,"%+gi",eigi[nconv]);CHKERRQ(ierr); }
#endif
ierr = PetscViewerASCIIMonitorPrintf(viewer," (%10.8e)\n",errest[nconv]);CHKERRQ(ierr);
if (!dummy) {ierr = PetscViewerASCIIMonitorDestroy(viewer);CHKERRQ(ierr);}
}
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPMonitorConverged"
/*@C
QEPMonitorConverged - Print the approximate values and
error estimates as they converge.
 
Collective on QEP
 
Input Parameters:
+ qep - quadratic eigensolver context
. its - iteration number
. nconv - number of converged eigenpairs so far
. eigr - real part of the eigenvalues
. eigi - imaginary part of the eigenvalues
. errest - error estimates
. nest - number of error estimates to display
- dummy - unused monitor context
 
Level: intermediate
 
.seealso: QEPMonitorSet()
@*/
PetscErrorCode QEPMonitorConverged(QEP qep,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *dummy)
{
PetscErrorCode ierr;
PetscInt i;
QEPMONITOR_CONV *ctx = (QEPMONITOR_CONV*) dummy;
 
PetscFunctionBegin;
if (!its) {
ctx->oldnconv = 0;
} else {
for (i=ctx->oldnconv;i<nconv;i++) {
ierr = PetscViewerASCIIMonitorPrintf(ctx->viewer,"%3d QEP converged value (error) #%d",its,i);CHKERRQ(ierr);
#if defined(PETSC_USE_COMPLEX)
ierr = PetscViewerASCIIMonitorPrintf(ctx->viewer," %g%+gi",PetscRealPart(eigr[i]),PetscImaginaryPart(eigr[i]));CHKERRQ(ierr);
#else
ierr = PetscViewerASCIIMonitorPrintf(ctx->viewer," %g",eigr[i]);CHKERRQ(ierr);
if (eigi[i]!=0.0) { ierr = PetscViewerASCIIMonitorPrintf(ctx->viewer,"%+gi",eigi[i]);CHKERRQ(ierr); }
#endif
ierr = PetscViewerASCIIMonitorPrintf(ctx->viewer," (%10.8e)\n",errest[i]);CHKERRQ(ierr);
}
ctx->oldnconv = nconv;
}
PetscFunctionReturn(0);
}
 
PetscErrorCode QEPMonitorDestroy_Converged(QEPMONITOR_CONV *ctx)
{
PetscErrorCode ierr;
PetscFunctionBegin;
ierr = PetscViewerASCIIMonitorDestroy(ctx->viewer);CHKERRQ(ierr);
ierr = PetscFree(ctx);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPMonitorLG"
PetscErrorCode QEPMonitorLG(QEP qep,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx)
{
PetscViewer viewer = (PetscViewer) monctx;
PetscDraw draw;
PetscDrawLG lg;
PetscErrorCode ierr;
PetscReal x,y;
 
PetscFunctionBegin;
 
if (!viewer) { viewer = PETSC_VIEWER_DRAW_(((PetscObject)qep)->comm); }
 
ierr = PetscViewerDrawGetDraw(viewer,0,&draw);CHKERRQ(ierr);
ierr = PetscViewerDrawGetDrawLG(viewer,0,&lg);CHKERRQ(ierr);
if (!its) {
ierr = PetscDrawSetTitle(draw,"Error estimates");CHKERRQ(ierr);
ierr = PetscDrawSetDoubleBuffer(draw);CHKERRQ(ierr);
ierr = PetscDrawLGSetDimension(lg,1);CHKERRQ(ierr);
ierr = PetscDrawLGReset(lg);CHKERRQ(ierr);
ierr = PetscDrawLGSetLimits(lg,0,1.0,log10(qep->tol)-2,0.0);CHKERRQ(ierr);
}
 
x = (PetscReal) its;
if (errest[nconv] > 0.0) y = log10(errest[nconv]); else y = 0.0;
ierr = PetscDrawLGAddPoint(lg,&x,&y);CHKERRQ(ierr);
 
ierr = PetscDrawLGDraw(lg);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPMonitorLGAll"
PetscErrorCode QEPMonitorLGAll(QEP qep,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx)
{
PetscViewer viewer = (PetscViewer) monctx;
PetscDraw draw;
PetscDrawLG lg;
PetscErrorCode ierr;
PetscReal *x,*y;
PetscInt i;
int n = PetscMin(qep->nev,255);
 
PetscFunctionBegin;
 
if (!viewer) { viewer = PETSC_VIEWER_DRAW_(((PetscObject)qep)->comm); }
 
ierr = PetscViewerDrawGetDraw(viewer,0,&draw);CHKERRQ(ierr);
ierr = PetscViewerDrawGetDrawLG(viewer,0,&lg);CHKERRQ(ierr);
if (!its) {
ierr = PetscDrawSetTitle(draw,"Error estimates");CHKERRQ(ierr);
ierr = PetscDrawSetDoubleBuffer(draw);CHKERRQ(ierr);
ierr = PetscDrawLGSetDimension(lg,n);CHKERRQ(ierr);
ierr = PetscDrawLGReset(lg);CHKERRQ(ierr);
ierr = PetscDrawLGSetLimits(lg,0,1.0,log10(qep->tol)-2,0.0);CHKERRQ(ierr);
}
 
ierr = PetscMalloc(sizeof(PetscReal)*n,&x);CHKERRQ(ierr);
ierr = PetscMalloc(sizeof(PetscReal)*n,&y);CHKERRQ(ierr);
for (i=0;i<n;i++) {
x[i] = (PetscReal) its;
if (i < nest && errest[i] > 0.0) y[i] = log10(errest[i]);
else y[i] = 0.0;
}
ierr = PetscDrawLGAddPoint(lg,x,y);CHKERRQ(ierr);
 
ierr = PetscDrawLGDraw(lg);CHKERRQ(ierr);
ierr = PetscFree(x);CHKERRQ(ierr);
ierr = PetscFree(y);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
/tags/slepc-3_1-2/src/qep/interface/qepregis.c New file
0,0 → 1,52
/*
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SLEPc - Scalable Library for Eigenvalue Problem Computations
Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
 
This file is part of SLEPc.
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/>.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
 
#include "private/qepimpl.h" /*I "slepcqep.h" I*/
 
EXTERN_C_BEGIN
EXTERN PetscErrorCode QEPCreate_LINEAR(QEP);
EXTERN PetscErrorCode QEPCreate_QARNOLDI(QEP);
EXTERN_C_END
#undef __FUNCT__
#define __FUNCT__ "QEPRegisterAll"
/*@C
QEPRegisterAll - Registers all the solvers in the QEP package.
 
Not Collective
 
Level: advanced
 
.seealso: QEPRegisterDynamic()
@*/
PetscErrorCode QEPRegisterAll(char *path)
{
PetscErrorCode ierr;
 
PetscFunctionBegin;
 
ierr = QEPRegisterDynamic(QEPLINEAR, path,"QEPCreate_LINEAR",
QEPCreate_LINEAR);CHKERRQ(ierr);
ierr = QEPRegisterDynamic(QEPQARNOLDI, path,"QEPCreate_QARNOLDI",
QEPCreate_QARNOLDI);CHKERRQ(ierr);
 
PetscFunctionReturn(0);
}
/tags/slepc-3_1-2/src/qep/interface/qepdense.c New file
0,0 → 1,145
/*
This file contains routines for handling small-size dense quadratic problems.
All routines are based on calls to LAPACK routines. Matrices passed in
as arguments are assumed to be square matrices stored in column-major
format with a leading dimension equal to the number of rows.
 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SLEPc - Scalable Library for Eigenvalue Problem Computations
Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
 
This file is part of SLEPc.
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/>.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
 
#include "private/qepimpl.h" /*I "slepcqep.h" I*/
#include "slepcblaslapack.h"
 
#undef __FUNCT__
#define __FUNCT__ "QEPSortDenseSchur"
/*@
QEPSortDenseSchur - Reorders the Schur decomposition computed by
EPSDenseSchur().
 
Not Collective
 
Input Parameters:
+ qep - the qep solver context
. n - dimension of the matrix
. k - first active column
- ldt - leading dimension of T
 
Input/Output Parameters:
+ T - the upper (quasi-)triangular matrix
. Q - the orthogonal matrix of Schur vectors
. wr - pointer to the array to store the computed eigenvalues
- wi - imaginary part of the eigenvalues (only when using real numbers)
 
Notes:
This function reorders the eigenvalues in wr,wi located in positions k
to n according to the sort order specified in EPSetWhicheigenpairs.
The Schur decomposition Z*T*Z^T, is also reordered by means of rotations
so that eigenvalues in the diagonal blocks of T follow the same order.
 
Both T and Q are overwritten.
This routine uses LAPACK routines xTREXC.
 
Level: developer
 
.seealso: EPSDenseHessenberg(), EPSDenseSchur(), EPSDenseTridiagonal()
@*/
PetscErrorCode QEPSortDenseSchur(QEP qep,PetscInt n_,PetscInt k,PetscScalar *T,PetscInt ldt_,PetscScalar *Q,PetscScalar *wr,PetscScalar *wi)
{
#if defined(SLEPC_MISSING_LAPACK_TREXC)
PetscFunctionBegin;
SETERRQ(PETSC_ERR_SUP,"TREXC - Lapack routine is unavailable.");
#else
PetscErrorCode ierr;
PetscScalar re,im;
PetscInt i,j,pos,result;
PetscBLASInt ifst,ilst,info,n,ldt;
#if !defined(PETSC_USE_COMPLEX)
PetscScalar *work;
#endif
PetscFunctionBegin;
ierr = PetscLogEventBegin(QEP_Dense,0,0,0,0);CHKERRQ(ierr);
n = PetscBLASIntCast(n_);
ldt = PetscBLASIntCast(ldt_);
#if !defined(PETSC_USE_COMPLEX)
ierr = PetscMalloc(n*sizeof(PetscScalar),&work);CHKERRQ(ierr);
#endif
/* selection sort */
for (i=k;i<n-1;i++) {
re = wr[i];
im = wi[i];
pos = 0;
j=i+1; /* j points to the next eigenvalue */
#if !defined(PETSC_USE_COMPLEX)
if (im != 0) j=i+2;
#endif
/* find minimum eigenvalue */
for (;j<n;j++) {
ierr = QEPCompareEigenvalues(qep,re,im,wr[j],wi[j],&result);CHKERRQ(ierr);
if (result < 0) {
re = wr[j];
im = wi[j];
pos = j;
}
#if !defined(PETSC_USE_COMPLEX)
if (wi[j] != 0) j++;
#endif
}
if (pos) {
/* interchange blocks */
ifst = PetscBLASIntCast(pos + 1);
ilst = PetscBLASIntCast(i + 1);
#if !defined(PETSC_USE_COMPLEX)
LAPACKtrexc_("V",&n,T,&ldt,Q,&n,&ifst,&ilst,work,&info);
#else
LAPACKtrexc_("V",&n,T,&ldt,Q,&n,&ifst,&ilst,&info);
#endif
if (info) SETERRQ1(PETSC_ERR_LIB,"Error in Lapack xTREXC %d",info);
/* recover original eigenvalues from T matrix */
for (j=i;j<n;j++) {
wr[j] = T[j*ldt+j];
#if !defined(PETSC_USE_COMPLEX)
if (j<n-1 && T[j*ldt+j+1] != 0.0) {
/* complex conjugate eigenvalue */
wi[j] = sqrt(PetscAbsReal(T[j*ldt+j+1])) *
sqrt(PetscAbsReal(T[(j+1)*ldt+j]));
wr[j+1] = wr[j];
wi[j+1] = -wi[j];
j++;
} else
#endif
wi[j] = 0.0;
}
}
#if !defined(PETSC_USE_COMPLEX)
if (wi[i] != 0) i++;
#endif
}
 
#if !defined(PETSC_USE_COMPLEX)
ierr = PetscFree(work);CHKERRQ(ierr);
#endif
ierr = PetscLogEventEnd(QEP_Dense,0,0,0,0);CHKERRQ(ierr);
PetscFunctionReturn(0);
 
#endif
}
/tags/slepc-3_1-2/src/qep/interface/qepsetup.c New file
0,0 → 1,386
/*
QEP routines related to problem setup.
 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SLEPc - Scalable Library for Eigenvalue Problem Computations
Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
 
This file is part of SLEPc.
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/>.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
 
#include "private/qepimpl.h" /*I "slepcqep.h" I*/
 
#undef __FUNCT__
#define __FUNCT__ "QEPSetUp"
/*@
QEPSetUp - Sets up all the internal data structures necessary for the
execution of the QEP solver.
 
Collective on QEP
 
Input Parameter:
. qep - solver context
 
Notes:
This function need not be called explicitly in most cases, since QEPSolve()
calls it. It can be useful when one wants to measure the set-up time
separately from the solve time.
 
Level: advanced
 
.seealso: QEPCreate(), QEPSolve(), QEPDestroy()
@*/
PetscErrorCode QEPSetUp(QEP qep)
{
PetscErrorCode ierr;
PetscInt i,k;
PetscScalar *pV;
PetscTruth khas,mhas,lindep;
PetscReal knorm,mnorm,norm;
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
 
if (qep->setupcalled) PetscFunctionReturn(0);
 
ierr = PetscLogEventBegin(QEP_SetUp,qep,0,0,0);CHKERRQ(ierr);
 
/* Set default solver type */
if (!((PetscObject)qep)->type_name) {
ierr = QEPSetType(qep,QEPLINEAR);CHKERRQ(ierr);
}
 
/* Check matrices */
if (!qep->M || !qep->C || !qep->K)
SETERRQ(PETSC_ERR_ARG_WRONGSTATE, "QEPSetOperators must be called first");
/* Set problem dimensions */
ierr = MatGetSize(qep->M,&qep->n,PETSC_NULL);CHKERRQ(ierr);
ierr = MatGetLocalSize(qep->M,&qep->nloc,PETSC_NULL);CHKERRQ(ierr);
 
/* Set default problem type */
if (!qep->problem_type) {
ierr = QEPSetProblemType(qep,QEP_GENERAL);CHKERRQ(ierr);
}
 
/* Compute scaling factor if not set by user */
if (qep->sfactor==0.0) {
ierr = MatHasOperation(qep->K,MATOP_NORM,&khas);CHKERRQ(ierr);
ierr = MatHasOperation(qep->M,MATOP_NORM,&mhas);CHKERRQ(ierr);
if (khas && mhas) {
ierr = MatNorm(qep->K,NORM_INFINITY,&knorm);CHKERRQ(ierr);
ierr = MatNorm(qep->M,NORM_INFINITY,&mnorm);CHKERRQ(ierr);
qep->sfactor = sqrt(knorm/mnorm);
}
else qep->sfactor = 1.0;
}
 
/* initialize the random number generator */
ierr = PetscRandomCreate(((PetscObject)qep)->comm,&qep->rand);CHKERRQ(ierr);
ierr = PetscRandomSetFromOptions(qep->rand);CHKERRQ(ierr);
 
/* Call specific solver setup */
ierr = (*qep->ops->setup)(qep);CHKERRQ(ierr);
 
if (qep->ncv > 2*qep->n)
SETERRQ(PETSC_ERR_ARG_OUTOFRANGE,"ncv must be twice the problem size at most");
if (qep->nev > qep->ncv)
SETERRQ(PETSC_ERR_ARG_OUTOFRANGE,"nev bigger than ncv");
 
/* Free memory for previous solution */
if (qep->eigr) {
ierr = PetscFree(qep->eigr);CHKERRQ(ierr);
ierr = PetscFree(qep->eigi);CHKERRQ(ierr);
ierr = PetscFree(qep->perm);CHKERRQ(ierr);
ierr = PetscFree(qep->errest);CHKERRQ(ierr);
ierr = VecGetArray(qep->V[0],&pV);CHKERRQ(ierr);
for (i=0;i<qep->ncv;i++) {
ierr = VecDestroy(qep->V[i]);CHKERRQ(ierr);
}
ierr = PetscFree(pV);CHKERRQ(ierr);
ierr = PetscFree(qep->V);CHKERRQ(ierr);
}
 
/* Allocate memory for next solution */
ierr = PetscMalloc(qep->ncv*sizeof(PetscScalar),&qep->eigr);CHKERRQ(ierr);
ierr = PetscMalloc(qep->ncv*sizeof(PetscScalar),&qep->eigi);CHKERRQ(ierr);
ierr = PetscMalloc(qep->ncv*sizeof(PetscInt),&qep->perm);CHKERRQ(ierr);
ierr = PetscMalloc(qep->ncv*sizeof(PetscReal),&qep->errest);CHKERRQ(ierr);
ierr = PetscMalloc(qep->ncv*sizeof(Vec),&qep->V);CHKERRQ(ierr);
ierr = PetscMalloc(qep->ncv*qep->nloc*sizeof(PetscScalar),&pV);CHKERRQ(ierr);
for (i=0;i<qep->ncv;i++) {
ierr = VecCreateMPIWithArray(((PetscObject)qep)->comm,qep->nloc,PETSC_DECIDE,pV+i*qep->nloc,&qep->V[i]);CHKERRQ(ierr);
}
 
/* process initial vectors */
if (qep->nini<0) {
qep->nini = -qep->nini;
if (qep->nini>qep->ncv) SETERRQ(1,"The number of initial vectors is larger than ncv")
k = 0;
for (i=0;i<qep->nini;i++) {
ierr = VecCopy(qep->IS[i],qep->V[k]);CHKERRQ(ierr);
ierr = VecDestroy(qep->IS[i]);CHKERRQ(ierr);
ierr = IPOrthogonalize(qep->ip,0,PETSC_NULL,k,PETSC_NULL,qep->V,qep->V[k],PETSC_NULL,&norm,&lindep);CHKERRQ(ierr);
if (norm==0.0 || lindep) PetscInfo(qep,"Linearly dependent initial vector found, removing...\n");
else {
ierr = VecScale(qep->V[k],1.0/norm);CHKERRQ(ierr);
k++;
}
}
qep->nini = k;
ierr = PetscFree(qep->IS);CHKERRQ(ierr);
}
if (qep->ninil<0) {
if (!qep->leftvecs) PetscInfo(qep,"Ignoring initial left vectors\n");
else {
qep->ninil = -qep->ninil;
if (qep->ninil>qep->ncv) SETERRQ(1,"The number of initial left vectors is larger than ncv")
k = 0;
for (i=0;i<qep->ninil;i++) {
ierr = VecCopy(qep->ISL[i],qep->W[k]);CHKERRQ(ierr);
ierr = VecDestroy(qep->ISL[i]);CHKERRQ(ierr);
ierr = IPOrthogonalize(qep->ip,0,PETSC_NULL,k,PETSC_NULL,qep->W,qep->W[k],PETSC_NULL,&norm,&lindep);CHKERRQ(ierr);
if (norm==0.0 || lindep) PetscInfo(qep,"Linearly dependent initial left vector found, removing...\n");
else {
ierr = VecScale(qep->W[k],1.0/norm);CHKERRQ(ierr);
k++;
}
}
qep->ninil = k;
ierr = PetscFree(qep->ISL);CHKERRQ(ierr);
}
}
 
ierr = PetscLogEventEnd(QEP_SetUp,qep,0,0,0);CHKERRQ(ierr);
qep->setupcalled = 1;
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPSetOperators"
/*@
QEPSetOperators - Sets the matrices associated with the quadratic eigenvalue problem.
 
Collective on QEP and Mat
 
Input Parameters:
+ qep - the eigenproblem solver context
. M - the first coefficient matrix
. C - the second coefficient matrix
- K - the third coefficient matrix
 
Notes:
The quadratic eigenproblem is defined as (l^2*M + l*C + K)*x = 0, where l is
the eigenvalue and x is the eigenvector.
 
Level: beginner
 
.seealso: QEPSolve(), QEPGetOperators()
@*/
PetscErrorCode QEPSetOperators(QEP qep,Mat M,Mat C,Mat K)
{
PetscErrorCode ierr;
PetscInt m,n,m0;
 
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
PetscValidHeaderSpecific(M,MAT_COOKIE,2);
PetscValidHeaderSpecific(C,MAT_COOKIE,3);
PetscValidHeaderSpecific(K,MAT_COOKIE,4);
PetscCheckSameComm(qep,1,M,2);
PetscCheckSameComm(qep,1,C,3);
PetscCheckSameComm(qep,1,K,4);
 
/* Check for square matrices */
ierr = MatGetSize(M,&m,&n);CHKERRQ(ierr);
if (m!=n) { SETERRQ(1,"M is a non-square matrix"); }
m0=m;
ierr = MatGetSize(C,&m,&n);CHKERRQ(ierr);
if (m!=n) { SETERRQ(1,"C is a non-square matrix"); }
if (m!=m0) { SETERRQ(1,"Dimensions of M and C do not match"); }
ierr = MatGetSize(K,&m,&n);CHKERRQ(ierr);
if (m!=n) { SETERRQ(1,"K is a non-square matrix"); }
if (m!=m0) { SETERRQ(1,"Dimensions of M and K do not match"); }
 
/* Store a copy of the matrices */
ierr = PetscObjectReference((PetscObject)M);CHKERRQ(ierr);
if (qep->M) {
ierr = MatDestroy(qep->M);CHKERRQ(ierr);
}
qep->M = M;
ierr = PetscObjectReference((PetscObject)C);CHKERRQ(ierr);
if (qep->C) {
ierr = MatDestroy(qep->C);CHKERRQ(ierr);
}
qep->C = C;
ierr = PetscObjectReference((PetscObject)K);CHKERRQ(ierr);
if (qep->K) {
ierr = MatDestroy(qep->K);CHKERRQ(ierr);
}
qep->K = K;
 
qep->setupcalled = 0;
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPGetOperators"
/*@
QEPGetOperators - Gets the matrices associated with the quadratic eigensystem.
 
Collective on QEP and Mat
 
Input Parameter:
. qep - the QEP context
 
Output Parameters:
+ M - the first coefficient matrix
. C - the second coefficient matrix
- K - the third coefficient matrix
 
Level: intermediate
 
.seealso: QEPSolve(), QEPSetOperators()
@*/
PetscErrorCode QEPGetOperators(QEP qep, Mat *M, Mat *C,Mat *K)
{
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
if (M) { PetscValidPointer(M,2); *M = qep->M; }
if (C) { PetscValidPointer(C,3); *C = qep->C; }
if (K) { PetscValidPointer(K,4); *K = qep->K; }
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPSetInitialSpace"
/*@
QEPSetInitialSpace - Specify a basis of vectors that constitute the initial
space, that is, the subspace from which the solver starts to iterate.
 
Collective on QEP and Vec
 
Input Parameter:
+ qep - the quadratic eigensolver context
. n - number of vectors
- is - set of basis vectors of the initial space
 
Notes:
Some solvers start to iterate on a single vector (initial vector). In that case,
the other vectors are ignored.
 
These vectors do not persist from one QEPSolve() call to the other, so the
initial space should be set every time.
 
The vectors do not need to be mutually orthonormal, since they are explicitly
orthonormalized internally.
 
Common usage of this function is when the user can provide a rough approximation
of the wanted eigenspace. Then, convergence may be faster.
 
Level: intermediate
 
.seealso: QEPSetInitialSpaceLeft()
@*/
PetscErrorCode QEPSetInitialSpace(QEP qep,PetscInt n,Vec *is)
{
PetscErrorCode ierr;
PetscInt i;
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
if (n<0) SETERRQ(PETSC_ERR_ARG_OUTOFRANGE,"Argument n cannot be negative");
 
/* free previous non-processed vectors */
if (qep->nini<0) {
for (i=0;i<-qep->nini;i++) {
ierr = VecDestroy(qep->IS[i]);CHKERRQ(ierr);
}
ierr = PetscFree(qep->IS);CHKERRQ(ierr);
}
 
/* get references of passed vectors */
ierr = PetscMalloc(n*sizeof(Vec),&qep->IS);CHKERRQ(ierr);
for (i=0;i<n;i++) {
ierr = PetscObjectReference((PetscObject)is[i]);CHKERRQ(ierr);
qep->IS[i] = is[i];
}
 
qep->nini = -n;
qep->setupcalled = 0;
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPSetInitialSpaceLeft"
/*@
QEPSetInitialSpaceLeft - Specify a basis of vectors that constitute the initial
left space, that is, the subspace from which the solver starts to iterate for
building the left subspace (in methods that work with two subspaces).
 
Collective on QEP and Vec
 
Input Parameter:
+ qep - the quadratic eigensolver context
. n - number of vectors
- is - set of basis vectors of the initial left space
 
Notes:
Some solvers start to iterate on a single vector (initial left vector). In that case,
the other vectors are ignored.
 
These vectors do not persist from one QEPSolve() call to the other, so the
initial left space should be set every time.
 
The vectors do not need to be mutually orthonormal, since they are explicitly
orthonormalized internally.
 
Common usage of this function is when the user can provide a rough approximation
of the wanted left eigenspace. Then, convergence may be faster.
 
Level: intermediate
 
.seealso: QEPSetInitialSpace()
@*/
PetscErrorCode QEPSetInitialSpaceLeft(QEP qep,PetscInt n,Vec *is)
{
PetscErrorCode ierr;
PetscInt i;
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
if (n<0) SETERRQ(PETSC_ERR_ARG_OUTOFRANGE,"Argument n cannot be negative");
 
/* free previous non-processed vectors */
if (qep->ninil<0) {
for (i=0;i<-qep->ninil;i++) {
ierr = VecDestroy(qep->ISL[i]);CHKERRQ(ierr);
}
ierr = PetscFree(qep->ISL);CHKERRQ(ierr);
}
 
/* get references of passed vectors */
ierr = PetscMalloc(n*sizeof(Vec),&qep->ISL);CHKERRQ(ierr);
for (i=0;i<n;i++) {
ierr = PetscObjectReference((PetscObject)is[i]);CHKERRQ(ierr);
qep->ISL[i] = is[i];
}
 
qep->ninil = -n;
qep->setupcalled = 0;
PetscFunctionReturn(0);
}
 
/tags/slepc-3_1-2/src/qep/interface/qepbasic.c New file
0,0 → 1,581
/*
The basic QEP routines, Create, View, etc. are here.
 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SLEPc - Scalable Library for Eigenvalue Problem Computations
Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
 
This file is part of SLEPc.
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/>.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
 
#include "private/qepimpl.h" /*I "slepcqep.h" I*/
 
PetscFList QEPList = 0;
PetscCookie QEP_COOKIE = 0;
PetscLogEvent QEP_SetUp = 0, QEP_Solve = 0, QEP_Dense = 0;
static PetscTruth QEPPackageInitialized = PETSC_FALSE;
 
#undef __FUNCT__
#define __FUNCT__ "QEPFinalizePackage"
/*@C
QEPFinalizePackage - This function destroys everything in the Slepc interface to the QEP package. It is
called from SlepcFinalize().
 
Level: developer
 
.seealso: SlepcFinalize()
@*/
PetscErrorCode QEPFinalizePackage(void)
{
PetscFunctionBegin;
QEPPackageInitialized = PETSC_FALSE;
QEPList = 0;
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPInitializePackage"
/*@C
QEPInitializePackage - This function initializes everything in the QEP package. It is called
from PetscDLLibraryRegister() when using dynamic libraries, and on the first call to QEPCreate()
when using static libraries.
 
Input Parameter:
path - The dynamic library path, or PETSC_NULL
 
Level: developer
 
.seealso: SlepcInitialize()
@*/
PetscErrorCode QEPInitializePackage(char *path) {
char logList[256];
char *className;
PetscTruth opt;
PetscErrorCode ierr;
 
PetscFunctionBegin;
if (QEPPackageInitialized) PetscFunctionReturn(0);
QEPPackageInitialized = PETSC_TRUE;
/* Register Classes */
ierr = PetscCookieRegister("Quadratic Eigenproblem Solver",&QEP_COOKIE);CHKERRQ(ierr);
/* Register Constructors */
ierr = QEPRegisterAll(path);CHKERRQ(ierr);
/* Register Events */
ierr = PetscLogEventRegister("QEPSetUp",QEP_COOKIE,&QEP_SetUp);CHKERRQ(ierr);
ierr = PetscLogEventRegister("QEPSolve",QEP_COOKIE,&QEP_Solve);CHKERRQ(ierr);
ierr = PetscLogEventRegister("QEPDense",QEP_COOKIE,&QEP_Dense);CHKERRQ(ierr);
/* Process info exclusions */
ierr = PetscOptionsGetString(PETSC_NULL,"-log_info_exclude",logList,256,&opt);CHKERRQ(ierr);
if (opt) {
ierr = PetscStrstr(logList,"qep",&className);CHKERRQ(ierr);
if (className) {
ierr = PetscInfoDeactivateClass(QEP_COOKIE);CHKERRQ(ierr);
}
}
/* Process summary exclusions */
ierr = PetscOptionsGetString(PETSC_NULL,"-log_summary_exclude",logList,256,&opt);CHKERRQ(ierr);
if (opt) {
ierr = PetscStrstr(logList,"qep",&className);CHKERRQ(ierr);
if (className) {
ierr = PetscLogEventDeactivateClass(QEP_COOKIE);CHKERRQ(ierr);
}
}
ierr = PetscRegisterFinalize(QEPFinalizePackage);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPView"
/*@C
QEPView - Prints the QEP data structure.
 
Collective on QEP
 
Input Parameters:
+ qep - the quadratic eigenproblem solver context
- viewer - optional visualization context
 
Options Database Key:
. -qep_view - Calls QEPView() at end of QEPSolve()
 
Note:
The available visualization contexts include
+ PETSC_VIEWER_STDOUT_SELF - standard output (default)
- PETSC_VIEWER_STDOUT_WORLD - synchronized standard
output where only the first processor opens
the file. All other processors send their
data to the first processor to print.
 
The user can open an alternative visualization context with
PetscViewerASCIIOpen() - output to a specified file.
 
Level: beginner
 
.seealso: PetscViewerASCIIOpen()
@*/
PetscErrorCode QEPView(QEP qep,PetscViewer viewer)
{
PetscErrorCode ierr;
const char *type;
PetscTruth isascii;
 
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
if (!viewer) viewer = PETSC_VIEWER_STDOUT_(((PetscObject)qep)->comm);
PetscValidHeaderSpecific(viewer,PETSC_VIEWER_COOKIE,2);
PetscCheckSameComm(qep,1,viewer,2);
 
#if defined(PETSC_USE_COMPLEX)
#define HERM "hermitian"
#else
#define HERM "symmetric"
#endif
ierr = PetscTypeCompare((PetscObject)viewer,PETSC_VIEWER_ASCII,&isascii);CHKERRQ(ierr);
if (isascii) {
ierr = PetscViewerASCIIPrintf(viewer,"QEP Object:\n");CHKERRQ(ierr);
switch (qep->problem_type) {
case QEP_GENERAL: type = "general quadratic eigenvalue problem"; break;
case QEP_HERMITIAN: type = HERM " quadratic eigenvalue problem"; break;
case QEP_GYROSCOPIC: type = "gyroscopic quadratic eigenvalue problem"; break;
case 0: type = "not yet set"; break;
default: SETERRQ(1,"Wrong value of qep->problem_type");
}
ierr = PetscViewerASCIIPrintf(viewer," problem type: %s\n",type);CHKERRQ(ierr);
ierr = QEPGetType(qep,&type);CHKERRQ(ierr);
if (type) {
ierr = PetscViewerASCIIPrintf(viewer," method: %s\n",type);CHKERRQ(ierr);
} else {
ierr = PetscViewerASCIIPrintf(viewer," method: not yet set\n");CHKERRQ(ierr);
}
ierr = PetscViewerASCIIPrintf(viewer," selected portion of the spectrum: ");CHKERRQ(ierr);
if (!qep->which) {
ierr = PetscViewerASCIIPrintf(viewer,"not yet set\n");CHKERRQ(ierr);
} else switch (qep->which) {
case QEP_LARGEST_MAGNITUDE:
ierr = PetscViewerASCIIPrintf(viewer,"largest eigenvalues in magnitude\n");CHKERRQ(ierr);
break;
case QEP_SMALLEST_MAGNITUDE:
ierr = PetscViewerASCIIPrintf(viewer,"smallest eigenvalues in magnitude\n");CHKERRQ(ierr);
break;
case QEP_LARGEST_REAL:
ierr = PetscViewerASCIIPrintf(viewer,"largest real parts\n");CHKERRQ(ierr);
break;
case QEP_SMALLEST_REAL:
ierr = PetscViewerASCIIPrintf(viewer,"smallest real parts\n");CHKERRQ(ierr);
break;
case QEP_LARGEST_IMAGINARY:
ierr = PetscViewerASCIIPrintf(viewer,"largest imaginary parts\n");CHKERRQ(ierr);
break;
case QEP_SMALLEST_IMAGINARY:
ierr = PetscViewerASCIIPrintf(viewer,"smallest imaginary parts\n");CHKERRQ(ierr);
break;
default: SETERRQ(1,"Wrong value of qep->which");
}
if (qep->leftvecs) {
ierr = PetscViewerASCIIPrintf(viewer," computing left eigenvectors also\n");CHKERRQ(ierr);
}
ierr = PetscViewerASCIIPrintf(viewer," number of eigenvalues (nev): %d\n",qep->nev);CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(viewer," number of column vectors (ncv): %d\n",qep->ncv);CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(viewer," maximum dimension of projected problem (mpd): %d\n",qep->mpd);CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(viewer," maximum number of iterations: %d\n", qep->max_it);
ierr = PetscViewerASCIIPrintf(viewer," tolerance: %g\n",qep->tol);CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(viewer," scaling factor: %g\n",qep->sfactor);CHKERRQ(ierr);
if (qep->nini!=0) {
ierr = PetscViewerASCIIPrintf(viewer," dimension of user-provided initial space: %d\n",PetscAbs(qep->nini));CHKERRQ(ierr);
}
if (qep->ninil!=0) {
ierr = PetscViewerASCIIPrintf(viewer," dimension of user-provided initial left space: %d\n",PetscAbs(qep->ninil));CHKERRQ(ierr);
}
if (qep->ops->view) {
ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr);
ierr = (*qep->ops->view)(qep,viewer);CHKERRQ(ierr);
ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr);
}
ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr);
ierr = IPView(qep->ip,viewer); CHKERRQ(ierr);
ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr);
} else {
if (qep->ops->view) {
ierr = (*qep->ops->view)(qep,viewer);CHKERRQ(ierr);
}
}
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPCreate"
/*@C
QEPCreate - Creates the default QEP context.
 
Collective on MPI_Comm
 
Input Parameter:
. comm - MPI communicator
 
Output Parameter:
. qep - location to put the QEP context
 
Note:
The default QEP type is QEPLINEAR
 
Level: beginner
 
.seealso: QEPSetUp(), QEPSolve(), QEPDestroy(), QEP
@*/
PetscErrorCode QEPCreate(MPI_Comm comm,QEP *outqep)
{
PetscErrorCode ierr;
QEP qep;
 
PetscFunctionBegin;
PetscValidPointer(outqep,2);
*outqep = 0;
 
ierr = PetscHeaderCreate(qep,_p_QEP,struct _QEPOps,QEP_COOKIE,-1,"QEP",comm,QEPDestroy,QEPView);CHKERRQ(ierr);
*outqep = qep;
 
ierr = PetscMemzero(qep->ops,sizeof(struct _QEPOps));CHKERRQ(ierr);
 
qep->max_it = 0;
qep->nev = 1;
qep->ncv = 0;
qep->mpd = 0;
qep->nini = 0;
qep->ninil = 0;
qep->tol = 1e-7;
qep->sfactor = 0.0;
qep->conv_func = QEPDefaultConverged;
qep->conv_ctx = PETSC_NULL;
qep->which = (QEPWhich)0;
qep->which_func = PETSC_NULL;
qep->which_ctx = PETSC_NULL;
qep->leftvecs = PETSC_FALSE;
qep->problem_type = (QEPProblemType)0;
qep->V = PETSC_NULL;
qep->IS = PETSC_NULL;
qep->ISL = PETSC_NULL;
qep->T = PETSC_NULL;
qep->eigr = PETSC_NULL;
qep->eigi = PETSC_NULL;
qep->errest = PETSC_NULL;
qep->data = PETSC_NULL;
qep->nconv = 0;
qep->its = 0;
qep->perm = PETSC_NULL;
qep->matvecs = 0;
qep->linits = 0;
qep->nwork = 0;
qep->work = PETSC_NULL;
qep->setupcalled = 0;
qep->reason = QEP_CONVERGED_ITERATING;
qep->numbermonitors = 0;
qep->trackall = PETSC_FALSE;
 
ierr = IPCreate(comm,&qep->ip); CHKERRQ(ierr);
ierr = IPSetOptionsPrefix(qep->ip,((PetscObject)qep)->prefix);
ierr = IPAppendOptionsPrefix(qep->ip,"qep_");
PetscLogObjectParent(qep,qep->ip);
ierr = PetscPublishAll(qep);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
#undef __FUNCT__
#define __FUNCT__ "QEPSetType"
/*@C
QEPSetType - Selects the particular solver to be used in the QEP object.
 
Collective on QEP
 
Input Parameters:
+ qep - the quadratic eigensolver context
- type - a known method
 
Options Database Key:
. -qep_type <method> - Sets the method; use -help for a list
of available methods
Notes:
See "slepc/include/slepcqep.h" for available methods. The default
is QEPLINEAR.
 
Normally, it is best to use the QEPSetFromOptions() command and
then set the QEP type from the options database rather than by using
this routine. Using the options database provides the user with
maximum flexibility in evaluating the different available methods.
The QEPSetType() routine is provided for those situations where it
is necessary to set the iterative solver independently of the command
line or options database.
 
Level: intermediate
 
.seealso: QEPType
@*/
PetscErrorCode QEPSetType(QEP qep,const QEPType type)
{
PetscErrorCode ierr,(*r)(QEP);
PetscTruth match;
 
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
PetscValidCharPointer(type,2);
 
ierr = PetscTypeCompare((PetscObject)qep,type,&match);CHKERRQ(ierr);
if (match) PetscFunctionReturn(0);
 
if (qep->data) {
/* destroy the old private QEP context */
ierr = (*qep->ops->destroy)(qep); CHKERRQ(ierr);
qep->data = 0;
}
 
ierr = PetscFListFind(QEPList,((PetscObject)qep)->comm,type,(void (**)(void))&r);CHKERRQ(ierr);
 
if (!r) SETERRQ1(1,"Unknown QEP type given: %s",type);
 
qep->setupcalled = 0;
ierr = PetscMemzero(qep->ops,sizeof(struct _QEPOps));CHKERRQ(ierr);
ierr = (*r)(qep);CHKERRQ(ierr);
 
ierr = PetscObjectChangeTypeName((PetscObject)qep,type);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPGetType"
/*@C
QEPGetType - Gets the QEP type as a string from the QEP object.
 
Not Collective
 
Input Parameter:
. qep - the eigensolver context
 
Output Parameter:
. name - name of QEP method
 
Level: intermediate
 
.seealso: QEPSetType()
@*/
PetscErrorCode QEPGetType(QEP qep,const QEPType *type)
{
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
PetscValidPointer(type,2);
*type = ((PetscObject)qep)->type_name;
PetscFunctionReturn(0);
}
 
/*MC
QEPRegisterDynamic - Adds a method to the quadratic eigenproblem solver package.
 
Synopsis:
QEPRegisterDynamic(char *name_solver,char *path,char *name_create,PetscErrorCode (*routine_create)(QEP))
 
Not Collective
 
Input Parameters:
+ name_solver - name of a new user-defined solver
. path - path (either absolute or relative) the library containing this solver
. name_create - name of routine to create the solver context
- routine_create - routine to create the solver context
 
Notes:
QEPRegisterDynamic() may be called multiple times to add several user-defined solvers.
 
If dynamic libraries are used, then the fourth input argument (routine_create)
is ignored.
 
Sample usage:
.vb
QEPRegisterDynamic("my_solver",/home/username/my_lib/lib/libO/solaris/mylib.a,
"MySolverCreate",MySolverCreate);
.ve
 
Then, your solver can be chosen with the procedural interface via
$ QEPSetType(qep,"my_solver")
or at runtime via the option
$ -qep_type my_solver
 
Level: advanced
 
Environmental variables such as ${PETSC_ARCH}, ${SLEPC_DIR},
and others of the form ${any_environmental_variable} occuring in pathname will be
replaced with appropriate values.
 
.seealso: QEPRegisterDestroy(), QEPRegisterAll()
 
M*/
 
#undef __FUNCT__
#define __FUNCT__ "QEPRegister"
/*@C
QEPRegister - See QEPRegisterDynamic()
 
Level: advanced
@*/
PetscErrorCode QEPRegister(const char *sname,const char *path,const char *name,PetscErrorCode (*function)(QEP))
{
PetscErrorCode ierr;
char fullname[256];
 
PetscFunctionBegin;
ierr = PetscFListConcat(path,name,fullname);CHKERRQ(ierr);
ierr = PetscFListAdd(&QEPList,sname,fullname,(void (*)(void))function);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPRegisterDestroy"
/*@
QEPRegisterDestroy - Frees the list of QEP methods that were
registered by QEPRegisterDynamic().
 
Not Collective
 
Level: advanced
 
.seealso: QEPRegisterDynamic(), QEPRegisterAll()
@*/
PetscErrorCode QEPRegisterDestroy(void)
{
PetscErrorCode ierr;
 
PetscFunctionBegin;
ierr = PetscFListDestroy(&QEPList);CHKERRQ(ierr);
ierr = QEPRegisterAll(PETSC_NULL);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPDestroy"
/*@
QEPDestroy - Destroys the QEP context.
 
Collective on QEP
 
Input Parameter:
. qep - eigensolver context obtained from QEPCreate()
 
Level: beginner
 
.seealso: QEPCreate(), QEPSetUp(), QEPSolve()
@*/
PetscErrorCode QEPDestroy(QEP qep)
{
PetscErrorCode ierr;
PetscScalar *pV;
PetscInt i;
 
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
if (--((PetscObject)qep)->refct > 0) PetscFunctionReturn(0);
 
/* if memory was published with AMS then destroy it */
ierr = PetscObjectDepublish(qep);CHKERRQ(ierr);
 
if (qep->ops->destroy) {
ierr = (*qep->ops->destroy)(qep); CHKERRQ(ierr);
}
ierr = PetscFree(qep->T);CHKERRQ(ierr);
 
if (qep->eigr) {
ierr = PetscFree(qep->eigr);CHKERRQ(ierr);
ierr = PetscFree(qep->eigi);CHKERRQ(ierr);
ierr = PetscFree(qep->perm);CHKERRQ(ierr);
ierr = PetscFree(qep->errest);CHKERRQ(ierr);
ierr = VecGetArray(qep->V[0],&pV);CHKERRQ(ierr);
for (i=0;i<qep->ncv;i++) {
ierr = VecDestroy(qep->V[i]);CHKERRQ(ierr);
}
ierr = PetscFree(pV);CHKERRQ(ierr);
ierr = PetscFree(qep->V);CHKERRQ(ierr);
}
 
ierr = QEPMonitorCancel(qep);CHKERRQ(ierr);
 
ierr = IPDestroy(qep->ip);CHKERRQ(ierr);
ierr = PetscRandomDestroy(qep->rand);CHKERRQ(ierr);
 
if (qep->M) { ierr = MatDestroy(qep->M);CHKERRQ(ierr); }
if (qep->C) { ierr = MatDestroy(qep->C);CHKERRQ(ierr); }
if (qep->K) { ierr = MatDestroy(qep->K);CHKERRQ(ierr); }
 
ierr = PetscHeaderDestroy(qep);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPSetIP"
/*@
QEPSetIP - Associates an inner product object to the quadratic eigensolver.
 
Collective on QEP and IP
 
Input Parameters:
+ qep - eigensolver context obtained from QEPCreate()
- ip - the inner product object
 
Note:
Use QEPGetIP() to retrieve the inner product context (for example,
to free it at the end of the computations).
 
Level: advanced
 
.seealso: QEPGetIP()
@*/
PetscErrorCode QEPSetIP(QEP qep,IP ip)
{
PetscErrorCode ierr;
 
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
PetscValidHeaderSpecific(ip,IP_COOKIE,2);
PetscCheckSameComm(qep,1,ip,2);
ierr = PetscObjectReference((PetscObject)ip);CHKERRQ(ierr);
ierr = IPDestroy(qep->ip); CHKERRQ(ierr);
qep->ip = ip;
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPGetIP"
/*@C
QEPGetIP - Obtain the inner product object associated
to the quadratic eigensolver object.
 
Not Collective
 
Input Parameters:
. qep - eigensolver context obtained from QEPCreate()
 
Output Parameter:
. ip - inner product context
 
Level: advanced
 
.seealso: QEPSetIP()
@*/
PetscErrorCode QEPGetIP(QEP qep,IP *ip)
{
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
PetscValidPointer(ip,2);
*ip = qep->ip;
PetscFunctionReturn(0);
}
 
/tags/slepc-3_1-2/src/qep/interface/qepdefault.c New file
0,0 → 1,226
/*
This file contains some simple default routines for common QEP operations.
 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SLEPc - Scalable Library for Eigenvalue Problem Computations
Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
 
This file is part of SLEPc.
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/>.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
 
#include "private/qepimpl.h" /*I "slepcqep.h" I*/
#include "private/slepcimpl.h"
#include "slepcblaslapack.h"
 
#undef __FUNCT__
#define __FUNCT__ "QEPDestroy_Default"
PetscErrorCode QEPDestroy_Default(QEP qep)
{
PetscErrorCode ierr;
 
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
ierr = PetscFree(qep->data);CHKERRQ(ierr);
 
/* free work vectors */
ierr = QEPDefaultFreeWork(qep);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPDefaultGetWork"
/*
QEPDefaultGetWork - Gets a number of work vectors.
*/
PetscErrorCode QEPDefaultGetWork(QEP qep, PetscInt nw)
{
PetscErrorCode ierr;
PetscInt i;
 
PetscFunctionBegin;
 
if (qep->nwork != nw) {
if (qep->nwork > 0) {
ierr = VecDestroyVecs(qep->work,qep->nwork); CHKERRQ(ierr);
}
qep->nwork = nw;
ierr = PetscMalloc(nw*sizeof(Vec),&qep->work);CHKERRQ(ierr);
for (i=0;i<nw;i++) {
ierr = MatGetVecs(qep->M,PETSC_NULL,qep->work+i); CHKERRQ(ierr);
}
ierr = PetscLogObjectParents(qep,nw,qep->work);
}
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPDefaultFreeWork"
/*
QEPDefaultFreeWork - Free work vectors.
*/
PetscErrorCode QEPDefaultFreeWork(QEP qep)
{
PetscErrorCode ierr;
 
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
if (qep->work) {
ierr = VecDestroyVecs(qep->work,qep->nwork);CHKERRQ(ierr);
}
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPDefaultConverged"
/*
QEPDefaultConverged - Checks convergence relative to the eigenvalue.
*/
PetscErrorCode QEPDefaultConverged(QEP qep,PetscScalar eigr,PetscScalar eigi,PetscReal res,PetscReal *errest,void *ctx)
{
PetscReal w;
PetscFunctionBegin;
w = SlepcAbsEigenvalue(eigr,eigi);
*errest = res;
if (w > res) *errest = res / w;
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPAbsoluteConverged"
/*
QEPAbsoluteConverged - Checks convergence absolutely.
*/
PetscErrorCode QEPAbsoluteConverged(QEP qep,PetscScalar eigr,PetscScalar eigi,PetscReal res,PetscReal *errest,void *ctx)
{
PetscFunctionBegin;
*errest = res;
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPComputeVectors_Schur"
PetscErrorCode QEPComputeVectors_Schur(QEP qep)
{
#if defined(SLEPC_MISSING_LAPACK_TREVC)
SETERRQ(PETSC_ERR_SUP,"TREVC - Lapack routine is unavailable.");
#else
PetscErrorCode ierr;
PetscInt i;
PetscBLASInt ncv,nconv,mout,info,one = 1;
PetscScalar *Z,*work,tmp;
#if defined(PETSC_USE_COMPLEX)
PetscReal *rwork;
#else
PetscReal normi;
#endif
PetscReal norm;
PetscFunctionBegin;
ncv = PetscBLASIntCast(qep->ncv);
nconv = PetscBLASIntCast(qep->nconv);
ierr = PetscMalloc(nconv*nconv*sizeof(PetscScalar),&Z);CHKERRQ(ierr);
ierr = PetscMalloc(3*nconv*sizeof(PetscScalar),&work);CHKERRQ(ierr);
#if defined(PETSC_USE_COMPLEX)
ierr = PetscMalloc(nconv*sizeof(PetscReal),&rwork);CHKERRQ(ierr);
#endif
 
/* right eigenvectors */
#if !defined(PETSC_USE_COMPLEX)
LAPACKtrevc_("R","A",PETSC_NULL,&nconv,qep->T,&ncv,PETSC_NULL,&nconv,Z,&nconv,&nconv,&mout,work,&info);
#else
LAPACKtrevc_("R","A",PETSC_NULL,&nconv,qep->T,&ncv,PETSC_NULL,&nconv,Z,&nconv,&nconv,&mout,work,rwork,&info);
#endif
if (info) SETERRQ1(PETSC_ERR_LIB,"Error in Lapack xTREVC %i",info);
 
/* normalize eigenvectors */
for (i=0;i<qep->nconv;i++) {
#if !defined(PETSC_USE_COMPLEX)
if (qep->eigi[i] != 0.0) {
norm = BLASnrm2_(&nconv,Z+i*nconv,&one);
normi = BLASnrm2_(&nconv,Z+(i+1)*nconv,&one);
tmp = 1.0 / SlepcAbsEigenvalue(norm,normi);
BLASscal_(&nconv,&tmp,Z+i*nconv,&one);
BLASscal_(&nconv,&tmp,Z+(i+1)*nconv,&one);
i++;
} else
#endif
{
norm = BLASnrm2_(&nconv,Z+i*nconv,&one);
tmp = 1.0 / norm;
BLASscal_(&nconv,&tmp,Z+i*nconv,&one);
}
}
/* AV = V * Z */
ierr = SlepcUpdateVectors(qep->nconv,qep->V,0,qep->nconv,Z,qep->nconv,PETSC_FALSE);CHKERRQ(ierr);
ierr = PetscFree(Z);CHKERRQ(ierr);
ierr = PetscFree(work);CHKERRQ(ierr);
#if defined(PETSC_USE_COMPLEX)
ierr = PetscFree(rwork);CHKERRQ(ierr);
#endif
PetscFunctionReturn(0);
#endif
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPKrylovConvergence"
/*
QEPKrylovConvergence - This is the analogue to EPSKrylovConvergence, but
for quadratic Krylov methods.
 
Differences:
- Always non-symmetric
- Does not check for STSHIFT
- No correction factor
- No support for true residual
*/
PetscErrorCode QEPKrylovConvergence(QEP qep,PetscInt kini,PetscInt nits,PetscScalar *S,PetscInt lds,PetscScalar *Q,PetscInt nv,PetscReal beta,PetscInt *kout,PetscScalar *work)
{
PetscErrorCode ierr;
PetscInt k,marker;
PetscScalar re,im,*Z,*work2;
PetscReal resnorm;
PetscTruth iscomplex;
 
PetscFunctionBegin;
Z = work; work2 = work+2*nv;
marker = -1;
for (k=kini;k<kini+nits;k++) {
/* eigenvalue */
re = qep->eigr[k];
im = qep->eigi[k];
iscomplex = PETSC_FALSE;
if (k<nv-1 && S[k+1+k*lds] != 0.0) iscomplex = PETSC_TRUE;
/* residual norm */
ierr = DenseSelectedEvec(S,lds,Q,Z,k,iscomplex,nv,work2);CHKERRQ(ierr);
if (iscomplex) resnorm = beta*SlepcAbsEigenvalue(Z[nv-1],Z[2*nv-1]);
else resnorm = beta*PetscAbsScalar(Z[nv-1]);
/* error estimate */
ierr = (*qep->conv_func)(qep,re,im,resnorm,&qep->errest[k],qep->conv_ctx);CHKERRQ(ierr);
if (marker==-1 && qep->errest[k] >= qep->tol) marker = k;
if (iscomplex) { qep->errest[k+1] = qep->errest[k]; k++; }
if (marker!=-1 && !qep->trackall) break;
}
if (marker!=-1) k = marker;
*kout = k;
 
PetscFunctionReturn(0);
}
 
 
/tags/slepc-3_1-2/src/qep/interface/qepopts.c New file
0,0 → 1,834
/*
QEP routines related to options that can be set via the command-line
or procedurally.
 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SLEPc - Scalable Library for Eigenvalue Problem Computations
Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
 
This file is part of SLEPc.
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/>.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
 
#include "private/qepimpl.h" /*I "slepcqep.h" I*/
 
#undef __FUNCT__
#define __FUNCT__ "QEPSetFromOptions"
/*@
QEPSetFromOptions - Sets QEP options from the options database.
This routine must be called before QEPSetUp() if the user is to be
allowed to set the solver type.
 
Collective on QEP
 
Input Parameters:
. qep - the quadratic eigensolver context
 
Notes:
To see all options, run your program with the -help option.
 
Level: beginner
@*/
PetscErrorCode QEPSetFromOptions(QEP qep)
{
PetscErrorCode ierr;
char type[256],monfilename[PETSC_MAX_PATH_LEN];
PetscTruth flg,val;
PetscReal r;
PetscInt i,j,k;
PetscViewerASCIIMonitor monviewer;
QEPMONITOR_CONV *ctx;
 
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
ierr = PetscOptionsBegin(((PetscObject)qep)->comm,((PetscObject)qep)->prefix,"Quadratic Eigenvalue Problem (QEP) Solver Options","QEP");CHKERRQ(ierr);
ierr = PetscOptionsList("-qep_type","Quadratic Eigenvalue Problem method","QEPSetType",QEPList,(char*)(((PetscObject)qep)->type_name?((PetscObject)qep)->type_name:QEPLINEAR),type,256,&flg);CHKERRQ(ierr);
if (flg) {
ierr = QEPSetType(qep,type);CHKERRQ(ierr);
} else if (!((PetscObject)qep)->type_name) {
ierr = QEPSetType(qep,QEPLINEAR);CHKERRQ(ierr);
}
 
ierr = PetscOptionsTruthGroupBegin("-qep_general","general quadratic eigenvalue problem","QEPSetProblemType",&flg);CHKERRQ(ierr);
if (flg) {ierr = QEPSetProblemType(qep,QEP_GENERAL);CHKERRQ(ierr);}
ierr = PetscOptionsTruthGroup("-qep_hermitian","hermitian quadratic eigenvalue problem","QEPSetProblemType",&flg);CHKERRQ(ierr);
if (flg) {ierr = QEPSetProblemType(qep,QEP_HERMITIAN);CHKERRQ(ierr);}
ierr = PetscOptionsTruthGroupEnd("-qep_gyroscopic","gyroscopic quadratic eigenvalue problem","QEPSetProblemType",&flg);CHKERRQ(ierr);
if (flg) {ierr = QEPSetProblemType(qep,QEP_GYROSCOPIC);CHKERRQ(ierr);}
 
r = PETSC_IGNORE;
ierr = PetscOptionsReal("-qep_scale","Scale factor","QEPSetScaleFactor",qep->sfactor,&r,PETSC_NULL);CHKERRQ(ierr);
ierr = QEPSetScaleFactor(qep,r);CHKERRQ(ierr);
 
r = i = PETSC_IGNORE;
ierr = PetscOptionsInt("-qep_max_it","Maximum number of iterations","QEPSetTolerances",qep->max_it,&i,PETSC_NULL);CHKERRQ(ierr);
ierr = PetscOptionsReal("-qep_tol","Tolerance","QEPSetTolerances",qep->tol,&r,PETSC_NULL);CHKERRQ(ierr);
ierr = QEPSetTolerances(qep,r,i);CHKERRQ(ierr);
ierr = PetscOptionsTruthGroupBegin("-qep_convergence_default","Default (relative error) convergence test","QEPSetConvergenceTest",&flg);CHKERRQ(ierr);
if (flg) {ierr = QEPSetConvergenceTest(qep,QEPDefaultConverged,PETSC_NULL);CHKERRQ(ierr);}
ierr = PetscOptionsTruthGroupEnd("-qep_convergence_absolute","Absolute error convergence test","QEPSetConvergenceTest",&flg);CHKERRQ(ierr);
if (flg) {ierr = QEPSetConvergenceTest(qep,QEPAbsoluteConverged,PETSC_NULL);CHKERRQ(ierr);}
 
i = j = k = PETSC_IGNORE;
ierr = PetscOptionsInt("-qep_nev","Number of eigenvalues to compute","QEPSetDimensions",qep->nev,&i,PETSC_NULL);CHKERRQ(ierr);
ierr = PetscOptionsInt("-qep_ncv","Number of basis vectors","QEPSetDimensions",qep->ncv,&j,PETSC_NULL);CHKERRQ(ierr);
ierr = PetscOptionsInt("-qep_mpd","Maximum dimension of projected problem","QEPSetDimensions",qep->mpd,&k,PETSC_NULL);CHKERRQ(ierr);
ierr = QEPSetDimensions(qep,i,j,k);CHKERRQ(ierr);
/* -----------------------------------------------------------------------*/
/*
Cancels all monitors hardwired into code before call to QEPSetFromOptions()
*/
flg = PETSC_FALSE;
ierr = PetscOptionsTruth("-qep_monitor_cancel","Remove any hardwired monitor routines","QEPMonitorCancel",flg,&flg,PETSC_NULL);CHKERRQ(ierr);
if (flg) {
ierr = QEPMonitorCancel(qep); CHKERRQ(ierr);
}
/*
Prints approximate eigenvalues and error estimates at each iteration
*/
ierr = PetscOptionsString("-qep_monitor","Monitor first unconverged approximate eigenvalue and error estimate","QEPMonitorSet","stdout",monfilename,PETSC_MAX_PATH_LEN,&flg);CHKERRQ(ierr);
if (flg) {
ierr = PetscViewerASCIIMonitorCreate(((PetscObject)qep)->comm,monfilename,((PetscObject)qep)->tablevel,&monviewer);CHKERRQ(ierr);
ierr = QEPMonitorSet(qep,QEPMonitorFirst,monviewer,(PetscErrorCode (*)(void*))PetscViewerASCIIMonitorDestroy);CHKERRQ(ierr);
}
ierr = PetscOptionsString("-qep_monitor_conv","Monitor approximate eigenvalues and error estimates as they converge","QEPMonitorSet","stdout",monfilename,PETSC_MAX_PATH_LEN,&flg);CHKERRQ(ierr);
if (flg) {
ierr = PetscNew(QEPMONITOR_CONV,&ctx);CHKERRQ(ierr);
ierr = PetscViewerASCIIMonitorCreate(((PetscObject)qep)->comm,monfilename,((PetscObject)qep)->tablevel,&ctx->viewer);CHKERRQ(ierr);
ierr = QEPMonitorSet(qep,QEPMonitorConverged,ctx,(PetscErrorCode (*)(void*))QEPMonitorDestroy_Converged);CHKERRQ(ierr);
}
ierr = PetscOptionsString("-qep_monitor_all","Monitor approximate eigenvalues and error estimates","QEPMonitorSet","stdout",monfilename,PETSC_MAX_PATH_LEN,&flg);CHKERRQ(ierr);
if (flg) {
ierr = PetscViewerASCIIMonitorCreate(((PetscObject)qep)->comm,monfilename,((PetscObject)qep)->tablevel,&monviewer);CHKERRQ(ierr);
ierr = QEPMonitorSet(qep,QEPMonitorAll,monviewer,(PetscErrorCode (*)(void*))PetscViewerASCIIMonitorDestroy);CHKERRQ(ierr);
ierr = QEPSetTrackAll(qep,PETSC_TRUE);CHKERRQ(ierr);
}
flg = PETSC_FALSE;
ierr = PetscOptionsTruth("-qep_monitor_draw","Monitor first unconverged approximate error estimate graphically","QEPMonitorSet",flg,&flg,PETSC_NULL);CHKERRQ(ierr);
if (flg) {
ierr = QEPMonitorSet(qep,QEPMonitorLG,PETSC_NULL,PETSC_NULL);CHKERRQ(ierr);
}
flg = PETSC_FALSE;
ierr = PetscOptionsTruth("-qep_monitor_draw_all","Monitor error estimates graphically","QEPMonitorSet",flg,&flg,PETSC_NULL);CHKERRQ(ierr);
if (flg) {
ierr = QEPMonitorSet(qep,QEPMonitorLGAll,PETSC_NULL,PETSC_NULL);CHKERRQ(ierr);
ierr = QEPSetTrackAll(qep,PETSC_TRUE);CHKERRQ(ierr);
}
/* -----------------------------------------------------------------------*/
 
ierr = PetscOptionsTruthGroupBegin("-qep_largest_magnitude","compute largest eigenvalues in magnitude","QEPSetWhichEigenpairs",&flg);CHKERRQ(ierr);
if (flg) {ierr = QEPSetWhichEigenpairs(qep,QEP_LARGEST_MAGNITUDE);CHKERRQ(ierr);}
ierr = PetscOptionsTruthGroup("-qep_smallest_magnitude","compute smallest eigenvalues in magnitude","QEPSetWhichEigenpairs",&flg);CHKERRQ(ierr);
if (flg) {ierr = QEPSetWhichEigenpairs(qep,QEP_SMALLEST_MAGNITUDE);CHKERRQ(ierr);}
ierr = PetscOptionsTruthGroup("-qep_largest_real","compute largest real parts","QEPSetWhichEigenpairs",&flg);CHKERRQ(ierr);
if (flg) {ierr = QEPSetWhichEigenpairs(qep,QEP_LARGEST_REAL);CHKERRQ(ierr);}
ierr = PetscOptionsTruthGroup("-qep_smallest_real","compute smallest real parts","QEPSetWhichEigenpairs",&flg);CHKERRQ(ierr);
if (flg) {ierr = QEPSetWhichEigenpairs(qep,QEP_SMALLEST_REAL);CHKERRQ(ierr);}
ierr = PetscOptionsTruthGroup("-qep_largest_imaginary","compute largest imaginary parts","QEPSetWhichEigenpairs",&flg);CHKERRQ(ierr);
if (flg) {ierr = QEPSetWhichEigenpairs(qep,QEP_LARGEST_IMAGINARY);CHKERRQ(ierr);}
ierr = PetscOptionsTruthGroupEnd("-qep_smallest_imaginary","compute smallest imaginary parts","QEPSetWhichEigenpairs",&flg);CHKERRQ(ierr);
if (flg) {ierr = QEPSetWhichEigenpairs(qep,QEP_SMALLEST_IMAGINARY);CHKERRQ(ierr);}
 
ierr = PetscOptionsTruth("-qep_left_vectors","Compute left eigenvectors also","QEPSetLeftVectorsWanted",qep->leftvecs,&val,&flg);CHKERRQ(ierr);
if (flg) {
ierr = QEPSetLeftVectorsWanted(qep,val);CHKERRQ(ierr);
}
 
ierr = PetscOptionsName("-qep_view","Print detailed information on solver used","QEPView",0);CHKERRQ(ierr);
ierr = PetscOptionsName("-qep_view_binary","Save the matrices associated to the eigenproblem","QEPSetFromOptions",0);CHKERRQ(ierr);
ierr = PetscOptionsName("-qep_plot_eigs","Make a plot of the computed eigenvalues","QEPSolve",0);CHKERRQ(ierr);
if (qep->ops->setfromoptions) {
ierr = (*qep->ops->setfromoptions)(qep);CHKERRQ(ierr);
}
ierr = PetscOptionsEnd();CHKERRQ(ierr);
 
ierr = IPSetFromOptions(qep->ip); CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPGetTolerances"
/*@
QEPGetTolerances - Gets the tolerance and maximum iteration count used
by the QEP convergence tests.
 
Not Collective
 
Input Parameter:
. qep - the quadratic eigensolver context
Output Parameters:
+ tol - the convergence tolerance
- maxits - maximum number of iterations
 
Notes:
The user can specify PETSC_NULL for any parameter that is not needed.
 
Level: intermediate
 
.seealso: QEPSetTolerances()
@*/
PetscErrorCode QEPGetTolerances(QEP qep,PetscReal *tol,PetscInt *maxits)
{
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
if (tol) *tol = qep->tol;
if (maxits) *maxits = qep->max_it;
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPSetTolerances"
/*@
QEPSetTolerances - Sets the tolerance and maximum iteration count used
by the QEP convergence tests.
 
Collective on QEP
 
Input Parameters:
+ qep - the quadratic eigensolver context
. tol - the convergence tolerance
- maxits - maximum number of iterations to use
 
Options Database Keys:
+ -qep_tol <tol> - Sets the convergence tolerance
- -qep_max_it <maxits> - Sets the maximum number of iterations allowed
 
Notes:
Use PETSC_IGNORE for an argument that need not be changed.
 
Use PETSC_DECIDE for maxits to assign a reasonably good value, which is
dependent on the solution method.
 
Level: intermediate
 
.seealso: QEPGetTolerances()
@*/
PetscErrorCode QEPSetTolerances(QEP qep,PetscReal tol,PetscInt maxits)
{
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
if (tol != PETSC_IGNORE) {
if (tol == PETSC_DEFAULT) {
qep->tol = 1e-7;
} else {
if (tol < 0.0) SETERRQ(PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of tol. Must be > 0");
qep->tol = tol;
}
}
if (maxits != PETSC_IGNORE) {
if (maxits == PETSC_DEFAULT || maxits == PETSC_DECIDE) {
qep->max_it = 0;
qep->setupcalled = 0;
} else {
if (maxits < 0) SETERRQ(PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of maxits. Must be > 0");
qep->max_it = maxits;
}
}
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPGetDimensions"
/*@
QEPGetDimensions - Gets the number of eigenvalues to compute
and the dimension of the subspace.
 
Not Collective
 
Input Parameter:
. qep - the quadratic eigensolver context
Output Parameters:
+ nev - number of eigenvalues to compute
. ncv - the maximum dimension of the subspace to be used by the solver
- mpd - the maximum dimension allowed for the projected problem
 
Notes:
The user can specify PETSC_NULL for any parameter that is not needed.
 
Level: intermediate
 
.seealso: QEPSetDimensions()
@*/
PetscErrorCode QEPGetDimensions(QEP qep,PetscInt *nev,PetscInt *ncv,PetscInt *mpd)
{
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
if (nev) *nev = qep->nev;
if (ncv) *ncv = qep->ncv;
if (mpd) *mpd = qep->mpd;
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPSetDimensions"
/*@
QEPSetDimensions - Sets the number of eigenvalues to compute
and the dimension of the subspace.
 
Collective on QEP
 
Input Parameters:
+ qep - the quadratic eigensolver context
. nev - number of eigenvalues to compute
. ncv - the maximum dimension of the subspace to be used by the solver
- mpd - the maximum dimension allowed for the projected problem
 
Options Database Keys:
+ -qep_nev <nev> - Sets the number of eigenvalues
. -qep_ncv <ncv> - Sets the dimension of the subspace
- -qep_mpd <mpd> - Sets the maximum projected dimension
 
Notes:
Use PETSC_IGNORE to retain the previous value of any parameter.
 
Use PETSC_DECIDE for ncv and mpd to assign a reasonably good value, which is
dependent on the solution method.
 
The parameters ncv and mpd are intimately related, so that the user is advised
to set one of them at most. Normal usage is the following
+ - In cases where nev is small, the user sets ncv (a reasonable default is 2*nev).
- - In cases where nev is large, the user sets mpd.
 
The value of ncv should always be between nev and (nev+mpd), typically
ncv=nev+mpd. If nev is not too large, mpd=nev is a reasonable choice, otherwise
a smaller value should be used.
 
Level: intermediate
 
.seealso: QEPGetDimensions()
@*/
PetscErrorCode QEPSetDimensions(QEP qep,PetscInt nev,PetscInt ncv,PetscInt mpd)
{
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
 
if( nev != PETSC_IGNORE ) {
if (nev<1) SETERRQ(PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of nev. Must be > 0");
qep->nev = nev;
qep->setupcalled = 0;
}
if( ncv != PETSC_IGNORE ) {
if (ncv == PETSC_DECIDE || ncv == PETSC_DEFAULT) {
qep->ncv = 0;
} else {
if (ncv<1) SETERRQ(PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of ncv. Must be > 0");
qep->ncv = ncv;
}
qep->setupcalled = 0;
}
if( mpd != PETSC_IGNORE ) {
if (mpd == PETSC_DECIDE || mpd == PETSC_DEFAULT) {
qep->mpd = 0;
} else {
if (mpd<1) SETERRQ(PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of mpd. Must be > 0");
qep->mpd = mpd;
}
}
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPSetWhichEigenpairs"
/*@
QEPSetWhichEigenpairs - Specifies which portion of the spectrum is
to be sought.
 
Collective on QEP
 
Input Parameters:
+ qep - eigensolver context obtained from QEPCreate()
- which - the portion of the spectrum to be sought
 
Possible values:
The parameter 'which' can have one of these values
+ QEP_LARGEST_MAGNITUDE - largest eigenvalues in magnitude (default)
. QEP_SMALLEST_MAGNITUDE - smallest eigenvalues in magnitude
. QEP_LARGEST_REAL - largest real parts
. QEP_SMALLEST_REAL - smallest real parts
. QEP_LARGEST_IMAGINARY - largest imaginary parts
- QEP_SMALLEST_IMAGINARY - smallest imaginary parts
 
Options Database Keys:
+ -qep_largest_magnitude - Sets largest eigenvalues in magnitude
. -qep_smallest_magnitude - Sets smallest eigenvalues in magnitude
. -qep_largest_real - Sets largest real parts
. -qep_smallest_real - Sets smallest real parts
. -qep_largest_imaginary - Sets largest imaginary parts
- -qep_smallest_imaginary - Sets smallest imaginary parts
 
Notes:
Not all eigensolvers implemented in QEP account for all the possible values
stated above. If SLEPc is compiled for real numbers QEP_LARGEST_IMAGINARY
and QEP_SMALLEST_IMAGINARY use the absolute value of the imaginary part
for eigenvalue selection.
Level: intermediate
 
.seealso: QEPGetWhichEigenpairs(), QEPWhich
@*/
PetscErrorCode QEPSetWhichEigenpairs(QEP qep,QEPWhich which)
{
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
if (which!=PETSC_IGNORE) {
if (which==PETSC_DECIDE || which==PETSC_DEFAULT) qep->which = (QEPWhich)0;
else switch (which) {
case QEP_LARGEST_MAGNITUDE:
case QEP_SMALLEST_MAGNITUDE:
case QEP_LARGEST_REAL:
case QEP_SMALLEST_REAL:
case QEP_LARGEST_IMAGINARY:
case QEP_SMALLEST_IMAGINARY:
if (qep->which != which) {
qep->setupcalled = 0;
qep->which = which;
}
break;
default:
SETERRQ(PETSC_ERR_ARG_OUTOFRANGE,"Invalid 'which' value");
}
}
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPGetWhichEigenpairs"
/*@C
QEPGetWhichEigenpairs - Returns which portion of the spectrum is to be
sought.
 
Not Collective
 
Input Parameter:
. qep - eigensolver context obtained from QEPCreate()
 
Output Parameter:
. which - the portion of the spectrum to be sought
 
Notes:
See QEPSetWhichEigenpairs() for possible values of 'which'.
 
Level: intermediate
 
.seealso: QEPSetWhichEigenpairs(), QEPWhich
@*/
PetscErrorCode QEPGetWhichEigenpairs(QEP qep,QEPWhich *which)
{
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
PetscValidPointer(which,2);
*which = qep->which;
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPSetLeftVectorsWanted"
/*@
QEPSetLeftVectorsWanted - Specifies which eigenvectors are required.
 
Collective on QEP
 
Input Parameters:
+ qep - the quadratic eigensolver context
- leftvecs - whether left eigenvectors are required or not
 
Options Database Keys:
. -qep_left_vectors <boolean> - Sets/resets the boolean flag 'leftvecs'
 
Notes:
If the user sets leftvecs=PETSC_TRUE then the solver uses a variant of
the algorithm that computes both right and left eigenvectors. This is
usually much more costly. This option is not available in all solvers.
 
Level: intermediate
 
.seealso: QEPGetLeftVectorsWanted(), QEPGetEigenvectorLeft()
@*/
PetscErrorCode QEPSetLeftVectorsWanted(QEP qep,PetscTruth leftvecs)
{
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
if (qep->leftvecs != leftvecs) {
qep->leftvecs = leftvecs;
qep->setupcalled = 0;
}
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPGetLeftVectorsWanted"
/*@C
QEPGetLeftVectorsWanted - Returns the flag indicating whether left
eigenvectors are required or not.
 
Not Collective
 
Input Parameter:
. qep - the eigensolver context
 
Output Parameter:
. leftvecs - the returned flag
 
Level: intermediate
 
.seealso: QEPSetLeftVectorsWanted()
@*/
PetscErrorCode QEPGetLeftVectorsWanted(QEP qep,PetscTruth *leftvecs)
{
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
PetscValidPointer(leftvecs,2);
*leftvecs = qep->leftvecs;
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPGetScaleFactor"
/*@
QEPGetScaleFactor - Gets the factor used for scaling the quadratic eigenproblem.
 
Not Collective
 
Input Parameter:
. qep - the quadratic eigensolver context
Output Parameters:
. alpha - the scaling factor
 
Notes:
If the user did not specify a scaling factor, then after QEPSolve() the
default value is returned.
 
Level: intermediate
 
.seealso: QEPSetScaleFactor(), QEPSolve()
@*/
PetscErrorCode QEPGetScaleFactor(QEP qep,PetscReal *alpha)
{
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
if (alpha) *alpha = qep->sfactor;
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPSetScaleFactor"
/*@
QEPSetScaleFactor - Sets the scaling factor to be used for scaling the
quadratic problem before attempting to solve.
 
Collective on QEP
 
Input Parameters:
+ qep - the quadratic eigensolver context
- alpha - the scaling factor
 
Options Database Keys:
. -qep_scale <alpha> - Sets the scaling factor
 
Notes:
For the problem (l^2*M + l*C + K)*x = 0, the effect of scaling is to work
with matrices (alpha^2*M, alpha*C, K), then scale the computed eigenvalue.
 
The default is to scale with alpha = norm(K)/norm(M).
 
Level: intermediate
 
.seealso: QEPGetScaleFactor()
@*/
PetscErrorCode QEPSetScaleFactor(QEP qep,PetscReal alpha)
{
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
if (alpha != PETSC_IGNORE) {
if (alpha == PETSC_DEFAULT || alpha == PETSC_DECIDE) {
qep->sfactor = 0.0;
} else {
if (alpha < 0.0) SETERRQ(PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of alpha. Must be > 0");
qep->sfactor = alpha;
}
}
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPSetProblemType"
/*@
QEPSetProblemType - Specifies the type of the quadratic eigenvalue problem.
 
Collective on QEP
 
Input Parameters:
+ qep - the quadratic eigensolver context
- type - a known type of quadratic eigenvalue problem
 
Options Database Keys:
+ -qep_general - general problem with no particular structure
. -qep_hermitian - problem whose coefficient matrices are Hermitian
- -qep_gyroscopic - problem with Hamiltonian structure
Notes:
Allowed values for the problem type are: general (QEP_GENERAL), Hermitian
(QEP_HERMITIAN), and gyroscopic (QEP_GYROSCOPIC).
 
This function is used to instruct SLEPc to exploit certain structure in
the quadratic eigenproblem. By default, no particular structure is assumed.
 
If the problem matrices are Hermitian (symmetric in the real case) or
Hermitian/skew-Hermitian then the solver can exploit this fact to perform
less operations or provide better stability.
 
Level: intermediate
 
.seealso: QEPSetOperators(), QEPSetType(), QEPGetProblemType(), QEPProblemType
@*/
PetscErrorCode QEPSetProblemType(QEP qep,QEPProblemType type)
{
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
if (type!=QEP_GENERAL && type!=QEP_HERMITIAN && type!=QEP_GYROSCOPIC)
SETERRQ(PETSC_ERR_ARG_WRONG,"Unknown eigenvalue problem type");
qep->problem_type = type;
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPGetProblemType"
/*@C
QEPGetProblemType - Gets the problem type from the QEP object.
 
Not Collective
 
Input Parameter:
. qep - the quadratic eigensolver context
 
Output Parameter:
. type - name of QEP problem type
 
Level: intermediate
 
.seealso: QEPSetProblemType(), QEPProblemType
@*/
PetscErrorCode QEPGetProblemType(QEP qep,QEPProblemType *type)
{
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
PetscValidPointer(type,2);
*type = qep->problem_type;
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPSetConvergenceTest"
/*@C
QEPSetConvergenceTest - Sets a function to compute the error estimate used in
the convergence test.
 
Collective on QEP
 
Input Parameters:
+ qep - eigensolver context obtained from QEPCreate()
. func - a pointer to the convergence test function
- ctx - a context pointer (the last parameter to the convergence test function)
 
Calling Sequence of func:
$ func(QEP qep,PetscScalar eigr,PetscScalar eigi,PetscReal res,PetscReal* errest,void *ctx)
 
+ qep - eigensolver context obtained from QEPCreate()
. eigr - real part of the eigenvalue
. eigi - imaginary part of the eigenvalue
. res - residual norm associated to the eigenpair
. errest - (output) computed error estimate
- ctx - optional context, as set by QEPSetConvergenceTest()
 
Note:
If the error estimate returned by the convergence test function is less than
the tolerance, then the eigenvalue is accepted as converged.
 
Level: advanced
 
.seealso: QEPSetTolerances()
@*/
EXTERN PetscErrorCode QEPSetConvergenceTest(QEP qep,PetscErrorCode (*func)(QEP,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*),void* ctx)
{
PetscFunctionBegin;
qep->conv_func = func;
qep->conv_ctx = ctx;
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPSetTrackAll"
/*@
QEPSetTrackAll - Specifies if the solver must compute the residual of all
approximate eigenpairs or not.
 
Collective on QEP
 
Input Parameters:
+ qep - the eigensolver context
- trackall - whether compute all residuals or not
 
Notes:
If the user sets trackall=PETSC_TRUE then the solver explicitly computes
the residual for each eigenpair approximation. Computing the residual is
usually an expensive operation and solvers commonly compute the associated
residual to the first unconverged eigenpair.
The options '-qep_monitor_all' and '-qep_monitor_draw_all' automatically
activates this option.
 
Level: intermediate
 
.seealso: EPSGetTrackAll()
@*/
PetscErrorCode QEPSetTrackAll(QEP qep,PetscTruth trackall)
{
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
qep->trackall = trackall;
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPGetTrackAll"
/*@
QEPGetTrackAll - Returns the flag indicating whether all residuals must be computed explicitly or not.
 
Not Collective
 
Input Parameter:
. qep - the eigensolver context
 
Output Parameter:
. trackall - the returned flag
 
Level: intermediate
 
.seealso: EPSSetTrackAll()
@*/
PetscErrorCode QEPGetTrackAll(QEP qep,PetscTruth *trackall)
{
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
PetscValidPointer(trackall,2);
*trackall = qep->trackall;
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPSetOptionsPrefix"
/*@C
QEPSetOptionsPrefix - Sets the prefix used for searching for all
QEP options in the database.
 
Collective on QEP
 
Input Parameters:
+ qep - the quadratic eigensolver context
- prefix - the prefix string to prepend to all QEP option requests
 
Notes:
A hyphen (-) must NOT be given at the beginning of the prefix name.
The first character of all runtime options is AUTOMATICALLY the
hyphen.
 
For example, to distinguish between the runtime options for two
different QEP contexts, one could call
.vb
QEPSetOptionsPrefix(qep1,"qeig1_")
QEPSetOptionsPrefix(qep2,"qeig2_")
.ve
 
Level: advanced
 
.seealso: QEPAppendOptionsPrefix(), QEPGetOptionsPrefix()
@*/
PetscErrorCode QEPSetOptionsPrefix(QEP qep,const char *prefix)
{
PetscErrorCode ierr;
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
ierr = PetscObjectSetOptionsPrefix((PetscObject)qep,prefix);CHKERRQ(ierr);
ierr = IPSetOptionsPrefix(qep->ip,prefix);CHKERRQ(ierr);
ierr = IPAppendOptionsPrefix(qep->ip,"qep_");CHKERRQ(ierr);
PetscFunctionReturn(0);
}
#undef __FUNCT__
#define __FUNCT__ "QEPAppendOptionsPrefix"
/*@C
QEPAppendOptionsPrefix - Appends to the prefix used for searching for all
QEP options in the database.
 
Collective on QEP
 
Input Parameters:
+ qep - the quadratic eigensolver context
- prefix - the prefix string to prepend to all QEP option requests
 
Notes:
A hyphen (-) must NOT be given at the beginning of the prefix name.
The first character of all runtime options is AUTOMATICALLY the hyphen.
 
Level: advanced
 
.seealso: QEPSetOptionsPrefix(), QEPGetOptionsPrefix()
@*/
PetscErrorCode QEPAppendOptionsPrefix(QEP qep,const char *prefix)
{
PetscErrorCode ierr;
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
ierr = PetscObjectAppendOptionsPrefix((PetscObject)qep, prefix);CHKERRQ(ierr);
ierr = IPSetOptionsPrefix(qep->ip,prefix);CHKERRQ(ierr);
ierr = IPAppendOptionsPrefix(qep->ip,"qep_");CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPGetOptionsPrefix"
/*@C
QEPGetOptionsPrefix - Gets the prefix used for searching for all
QEP options in the database.
 
Not Collective
 
Input Parameters:
. qep - the quadratic eigensolver context
 
Output Parameters:
. prefix - pointer to the prefix string used is returned
 
Notes: On the fortran side, the user should pass in a string 'prefix' of
sufficient length to hold the prefix.
 
Level: advanced
 
.seealso: QEPSetOptionsPrefix(), QEPAppendOptionsPrefix()
@*/
PetscErrorCode QEPGetOptionsPrefix(QEP qep,const char *prefix[])
{
PetscErrorCode ierr;
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
PetscValidPointer(prefix,2);
ierr = PetscObjectGetOptionsPrefix((PetscObject)qep,prefix);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
/tags/slepc-3_1-2/src/qep/interface/makefile New file
0,0 → 1,37
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# SLEPc - Scalable Library for Eigenvalue Problem Computations
# Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
#
# This file is part of SLEPc.
#
# 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/>.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
 
ALL: lib
 
CFLAGS =
FFLAGS =
SOURCEC = qepmon.c qepbasic.c qepdefault.c qepregis.c qepopts.c qepsetup.c qepsolve.c qepdense.c
SOURCEF =
SOURCEH =
OBJSC = qepmon.o qepbasic.o qepdefault.o qepregis.o qepopts.o qepsetup.o qepsolve.o qepdense.o
LIBBASE = libslepc
DIRS =
MANSEC = QEP
LOCDIR = src/qep/interface/
 
include ${SLEPC_DIR}/conf/slepc_common
 
 
/tags/slepc-3_1-2/src/qep/impls/qarnoldi/qarnoldi.c New file
0,0 → 1,379
/*
 
Q-Arnoldi method for quadratic eigenproblems.
 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SLEPc - Scalable Library for Eigenvalue Problem Computations
Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
 
This file is part of SLEPc.
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/>.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
 
#include "private/qepimpl.h" /*I "slepcqep.h" I*/
#include "private/epsimpl.h"
#include "petscblaslapack.h"
 
typedef struct {
KSP ksp;
} QEP_QARNOLDI;
 
#undef __FUNCT__
#define __FUNCT__ "QEPSetUp_QARNOLDI"
PetscErrorCode QEPSetUp_QARNOLDI(QEP qep)
{
PetscErrorCode ierr;
QEP_QARNOLDI *ctx = (QEP_QARNOLDI *)qep->data;
PetscFunctionBegin;
 
if (qep->ncv) { /* ncv set */
if (qep->ncv<qep->nev) SETERRQ(1,"The value of ncv must be at least nev");
}
else if (qep->mpd) { /* mpd set */
qep->ncv = PetscMin(qep->n,qep->nev+qep->mpd);
}
else { /* neither set: defaults depend on nev being small or large */
if (qep->nev<500) qep->ncv = PetscMin(qep->n,PetscMax(2*qep->nev,qep->nev+15));
else { qep->mpd = 500; qep->ncv = PetscMin(qep->n,qep->nev+qep->mpd); }
}
if (!qep->mpd) qep->mpd = qep->ncv;
if (qep->ncv>qep->nev+qep->mpd) SETERRQ(1,"The value of ncv must not be larger than nev+mpd");
if (!qep->max_it) qep->max_it = PetscMax(100,2*qep->n/qep->ncv);
if (!qep->which) qep->which = QEP_LARGEST_MAGNITUDE;
if (qep->problem_type != QEP_GENERAL)
SETERRQ(1,"Wrong value of qep->problem_type");
 
ierr = PetscFree(qep->T);CHKERRQ(ierr);
ierr = PetscMalloc(qep->ncv*qep->ncv*sizeof(PetscScalar),&qep->T);CHKERRQ(ierr);
ierr = QEPDefaultGetWork(qep,4);CHKERRQ(ierr);
 
ierr = KSPSetOperators(ctx->ksp,qep->M,qep->M,DIFFERENT_NONZERO_PATTERN);CHKERRQ(ierr);
ierr = KSPSetUp(ctx->ksp);CHKERRQ(ierr);
 
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPQArnoldiCGS"
/*
Compute a step of Classical Gram-Schmidt orthogonalization
*/
PetscErrorCode QEPQArnoldiCGS(QEP qep,PetscScalar *H,PetscBLASInt ldh,PetscScalar *h,PetscBLASInt j,Vec *V,Vec t,Vec v,Vec w,PetscReal *onorm,PetscReal *norm,PetscScalar *work)
{
PetscErrorCode ierr;
PetscBLASInt ione = 1, j_1 = j+1;
PetscReal x, y;
PetscScalar dot, one = 1.0, zero = 0.0;
 
PetscFunctionBegin;
/* compute norm of v and w */
if (onorm) {
ierr = VecNorm(v,NORM_2,&x);CHKERRQ(ierr);
ierr = VecNorm(w,NORM_2,&y);CHKERRQ(ierr);
*onorm = sqrt(x*x+y*y);
}
 
/* orthogonalize: compute h */
ierr = VecMDot(v,j_1,V,h);CHKERRQ(ierr);
ierr = VecMDot(w,j_1,V,work);CHKERRQ(ierr);
if (j>0)
BLASgemv_("C",&j_1,&j,&one,H,&ldh,work,&ione,&one,h,&ione);
ierr = VecDot(t,w,&dot);CHKERRQ(ierr);
h[j] += dot;
 
/* orthogonalize: update v and w */
ierr = SlepcVecMAXPBY(v,1.0,-1.0,j_1,h,V);CHKERRQ(ierr);
if (j>0) {
BLASgemv_("N",&j_1,&j,&one,H,&ldh,h,&ione,&zero,work,&ione);
ierr = SlepcVecMAXPBY(w,1.0,-1.0,j_1,work,V);CHKERRQ(ierr);
}
ierr = VecAXPY(w,-h[j],t);CHKERRQ(ierr);
/* compute norm of v and w */
if (norm) {
ierr = VecNorm(v,NORM_2,&x);CHKERRQ(ierr);
ierr = VecNorm(w,NORM_2,&y);CHKERRQ(ierr);
*norm = sqrt(x*x+y*y);CHKERRQ(ierr);
}
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPQArnoldi"
/*
Compute a run of Q-Arnoldi iterations
*/
PetscErrorCode QEPQArnoldi(QEP qep,PetscScalar *H,PetscInt ldh,Vec *V,PetscInt k,PetscInt *M,Vec v,Vec w,PetscReal *beta,PetscTruth *breakdown,PetscScalar *work)
{
PetscErrorCode ierr;
PetscInt i,j,l,m = *M;
QEP_QARNOLDI *ctx = (QEP_QARNOLDI *)qep->data;
Vec t = qep->work[2], u = qep->work[3];
IPOrthogonalizationRefinementType refinement;
PetscReal norm,onorm,eta;
PetscScalar *c = work + m;
 
PetscFunctionBegin;
ierr = IPGetOrthogonalization(qep->ip,PETSC_NULL,&refinement,&eta);CHKERRQ(ierr);
ierr = VecCopy(v,qep->V[k]);CHKERRQ(ierr);
for (j=k;j<m;j++) {
/* apply operator */
ierr = VecCopy(w,t);CHKERRQ(ierr);
ierr = MatMult(qep->K,v,u);CHKERRQ(ierr);
ierr = MatMult(qep->C,t,w);CHKERRQ(ierr);
ierr = VecAXPY(u,qep->sfactor,w);CHKERRQ(ierr);
ierr = KSPSolve(ctx->ksp,u,w);CHKERRQ(ierr);
ierr = VecScale(w,-1.0/(qep->sfactor*qep->sfactor));CHKERRQ(ierr);
ierr = VecCopy(t,v);CHKERRQ(ierr);
 
/* orthogonalize */
switch (refinement) {
case IP_ORTH_REFINE_NEVER:
ierr = QEPQArnoldiCGS(qep,H,ldh,H+ldh*j,j,V,t,v,w,PETSC_NULL,&norm,work);CHKERRQ(ierr);
*breakdown = PETSC_FALSE;
break;
case IP_ORTH_REFINE_ALWAYS:
ierr = QEPQArnoldiCGS(qep,H,ldh,H+ldh*j,j,V,t,v,w,PETSC_NULL,PETSC_NULL,work);CHKERRQ(ierr);
ierr = QEPQArnoldiCGS(qep,H,ldh,c,j,V,t,v,w,&onorm,&norm,work);CHKERRQ(ierr);
for (i=0;i<j;i++) H[ldh*j+i] += c[i];
if (norm < eta * onorm) *breakdown = PETSC_TRUE;
else *breakdown = PETSC_FALSE;
break;
case IP_ORTH_REFINE_IFNEEDED:
ierr = QEPQArnoldiCGS(qep,H,ldh,H+ldh*j,j,V,t,v,w,&onorm,&norm,work);CHKERRQ(ierr);
/* ||q|| < eta ||h|| */
l = 1;
while (l<3 && norm < eta * onorm) {
l++;
onorm = norm;
ierr = QEPQArnoldiCGS(qep,H,ldh,c,j,V,t,v,w,PETSC_NULL,&norm,work);CHKERRQ(ierr);
for (i=0;i<j;i++) H[ldh*j+i] += c[i];
}
if (norm < eta * onorm) *breakdown = PETSC_TRUE;
else *breakdown = PETSC_FALSE;
break;
default: SETERRQ(1,"Wrong value of ip->orth_ref");
}
ierr = VecScale(v,1.0/norm);CHKERRQ(ierr);
ierr = VecScale(w,1.0/norm);CHKERRQ(ierr);
if (j<m-1) {
H[j+1+ldh*j] = norm;
ierr = VecCopy(v,V[j+1]);CHKERRQ(ierr);
}
}
*beta = norm;
PetscFunctionReturn(0);
}
 
 
#undef __FUNCT__
#define __FUNCT__ "QEPProjectedKSNonsym"
/*
QEPProjectedKSNonsym - Solves the projected eigenproblem in the Krylov-Schur
method (non-symmetric case).
 
On input:
l is the number of vectors kept in previous restart (0 means first restart)
S is the projected matrix (leading dimension is lds)
 
On output:
S has (real) Schur form with diagonal blocks sorted appropriately
Q contains the corresponding Schur vectors (order n, leading dimension n)
*/
PetscErrorCode QEPProjectedKSNonsym(QEP qep,PetscInt l,PetscScalar *S,PetscInt lds,PetscScalar *Q,PetscInt n)
{
PetscErrorCode ierr;
PetscInt i;
 
PetscFunctionBegin;
if (l==0) {
ierr = PetscMemzero(Q,n*n*sizeof(PetscScalar));CHKERRQ(ierr);
for (i=0;i<n;i++)
Q[i*(n+1)] = 1.0;
} else {
/* Reduce S to Hessenberg form, S <- Q S Q' */
ierr = EPSDenseHessenberg(n,qep->nconv,S,lds,Q);CHKERRQ(ierr);
}
/* Reduce S to (quasi-)triangular form, S <- Q S Q' */
ierr = EPSDenseSchur(n,qep->nconv,S,lds,Q,qep->eigr,qep->eigi);CHKERRQ(ierr);
/* Sort the remaining columns of the Schur form */
ierr = QEPSortDenseSchur(qep,n,qep->nconv,S,lds,Q,qep->eigr,qep->eigi);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPSolve_QARNOLDI"
PetscErrorCode QEPSolve_QARNOLDI(QEP qep)
{
PetscErrorCode ierr;
PetscInt i,j,k,l,lwork,nv;
Vec v=qep->work[0],w=qep->work[1];
PetscScalar *S=qep->T,*Q,*work;
PetscReal beta,norm,x,y;
PetscTruth breakdown;
 
PetscFunctionBegin;
 
ierr = PetscMemzero(S,qep->ncv*qep->ncv*sizeof(PetscScalar));CHKERRQ(ierr);
ierr = PetscMalloc(qep->ncv*qep->ncv*sizeof(PetscScalar),&Q);CHKERRQ(ierr);
lwork = 7*qep->ncv;
ierr = PetscMalloc(lwork*sizeof(PetscScalar),&work);CHKERRQ(ierr);
 
/* Get the starting Arnoldi vector */
if (qep->nini>0) {
ierr = VecCopy(qep->V[0],v);CHKERRQ(ierr);
} else {
ierr = SlepcVecSetRandom(v,qep->rand);CHKERRQ(ierr);
}
/* w is always a random vector */
ierr = SlepcVecSetRandom(w,qep->rand);CHKERRQ(ierr);
ierr = VecNorm(v,NORM_2,&x);CHKERRQ(ierr);
ierr = VecNorm(w,NORM_2,&y);CHKERRQ(ierr);
norm = sqrt(x*x+y*y);CHKERRQ(ierr);
ierr = VecScale(v,1.0/norm);CHKERRQ(ierr);
ierr = VecScale(w,1.0/norm);CHKERRQ(ierr);
/* Restart loop */
l = 0;
while (qep->reason == QEP_CONVERGED_ITERATING) {
qep->its++;
 
/* Compute an nv-step Arnoldi factorization */
nv = PetscMin(qep->nconv+qep->mpd,qep->ncv);
ierr = QEPQArnoldi(qep,S,qep->ncv,qep->V,qep->nconv+l,&nv,v,w,&beta,&breakdown,work);CHKERRQ(ierr);
 
/* Solve projected problem */
ierr = QEPProjectedKSNonsym(qep,l,S,qep->ncv,Q,nv);CHKERRQ(ierr);
 
/* Check convergence */
ierr = QEPKrylovConvergence(qep,qep->nconv,nv-qep->nconv,S,qep->ncv,Q,nv,beta,&k,work);CHKERRQ(ierr);
if (qep->its >= qep->max_it) qep->reason = QEP_DIVERGED_ITS;
if (k >= qep->nev) qep->reason = QEP_CONVERGED_TOL;
/* Update l */
if (qep->reason != QEP_CONVERGED_ITERATING || breakdown) l = 0;
else {
l = (nv-k)/2;
#if !defined(PETSC_USE_COMPLEX)
if (S[(k+l-1)*(qep->ncv+1)+1] != 0.0) {
if (k+l<nv-1) l = l+1;
else l = l-1;
}
#endif
}
 
if (qep->reason == QEP_CONVERGED_ITERATING) {
if (breakdown) {
/* Stop if breakdown */
PetscInfo2(qep,"Breakdown Quadratic Arnoldi method (it=%i norm=%g)\n",qep->its,beta);
qep->reason = QEP_DIVERGED_BREAKDOWN;
} else {
/* Prepare the Rayleigh quotient for restart */
for (i=k;i<k+l;i++) {
S[i*qep->ncv+k+l] = Q[(i+1)*nv-1]*beta;
}
}
}
/* Update the corresponding vectors V(:,idx) = V*Q(:,idx) */
ierr = SlepcUpdateVectors(nv,qep->V,qep->nconv,k+l,Q,nv,PETSC_FALSE);CHKERRQ(ierr);
 
qep->nconv = k;
 
QEPMonitor(qep,qep->its,qep->nconv,qep->eigr,qep->eigi,qep->errest,nv);
}
 
for (j=0;j<qep->nconv;j++) {
qep->eigr[j] *= qep->sfactor;
qep->eigi[j] *= qep->sfactor;
}
 
/* Compute eigenvectors */
if (qep->nconv > 0) {
ierr = QEPComputeVectors_Schur(qep);
}
 
ierr = PetscFree(Q);CHKERRQ(ierr);
ierr = PetscFree(work);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPSetFromOptions_QARNOLDI"
PetscErrorCode QEPSetFromOptions_QARNOLDI(QEP qep)
{
PetscErrorCode ierr;
QEP_QARNOLDI *ctx = (QEP_QARNOLDI *)qep->data;
PetscFunctionBegin;
ierr = KSPSetFromOptions(ctx->ksp);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPView_QARNOLDI"
PetscErrorCode QEPView_QARNOLDI(QEP qep,PetscViewer viewer)
{
PetscErrorCode ierr;
QEP_QARNOLDI *ctx = (QEP_QARNOLDI *)qep->data;
 
PetscFunctionBegin;
ierr = KSPView(ctx->ksp,viewer);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPDestroy_QARNOLDI"
PetscErrorCode QEPDestroy_QARNOLDI(QEP qep)
{
PetscErrorCode ierr;
QEP_QARNOLDI *ctx = (QEP_QARNOLDI *)qep->data;
 
PetscFunctionBegin;
ierr = KSPDestroy(ctx->ksp);CHKERRQ(ierr);
ierr = QEPDestroy_Default(qep);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
EXTERN_C_BEGIN
#undef __FUNCT__
#define __FUNCT__ "QEPCreate_QARNOLDI"
PetscErrorCode QEPCreate_QARNOLDI(QEP qep)
{
PetscErrorCode ierr;
QEP_QARNOLDI *ctx;
 
PetscFunctionBegin;
ierr = PetscNew(QEP_QARNOLDI,&ctx);CHKERRQ(ierr);
PetscLogObjectMemory(qep,sizeof(QEP_QARNOLDI));
qep->data = ctx;
qep->ops->solve = QEPSolve_QARNOLDI;
qep->ops->setup = QEPSetUp_QARNOLDI;
qep->ops->setfromoptions = QEPSetFromOptions_QARNOLDI;
qep->ops->destroy = QEPDestroy_QARNOLDI;
qep->ops->view = QEPView_QARNOLDI;
 
ierr = KSPCreate(((PetscObject)qep)->comm,&ctx->ksp);CHKERRQ(ierr);
ierr = KSPSetOptionsPrefix(ctx->ksp,((PetscObject)qep)->prefix);CHKERRQ(ierr);
ierr = KSPAppendOptionsPrefix(ctx->ksp,"qep_");CHKERRQ(ierr);
ierr = PetscObjectIncrementTabLevel((PetscObject)ctx->ksp,(PetscObject)qep,1);CHKERRQ(ierr);
PetscLogObjectParent(qep,ctx->ksp);
PetscFunctionReturn(0);
}
EXTERN_C_END
 
/tags/slepc-3_1-2/src/qep/impls/qarnoldi/makefile New file
0,0 → 1,37
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# SLEPc - Scalable Library for Eigenvalue Problem Computations
# Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
#
# This file is part of SLEPc.
#
# 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/>.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
 
ALL: lib
 
CFLAGS =
FFLAGS =
SOURCEC = qarnoldi.c
SOURCEF =
SOURCEH =
OBJSC = qarnoldi.o
LIBBASE = libslepc
DIRS =
MANSEC = QEP
LOCDIR = src/qep/impls/qarnoldi/
 
include ${SLEPC_DIR}/conf/slepc_common
 
 
/tags/slepc-3_1-2/src/qep/impls/linear/linearp.h New file
0,0 → 1,83
/*
 
Private header for QEPLINEAR.
 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SLEPc - Scalable Library for Eigenvalue Problem Computations
Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
 
This file is part of SLEPc.
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/>.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
 
typedef struct {
PetscTruth explicitmatrix;
PetscInt cform; /* companion form */
PetscReal sfactor; /* scaling factor */
Mat A,B; /* matrices of generalized eigenproblem */
EPS eps; /* linear eigensolver for Az=lBz */
Mat M,C,K; /* copy of QEP coefficient matrices */
Vec x1,x2,y1,y2; /* work vectors */
PetscTruth setfromoptionscalled;
} QEP_LINEAR;
 
/* N1 */
EXTERN PetscErrorCode MatMult_QEPLINEAR_N1A(Mat,Vec,Vec);
EXTERN PetscErrorCode MatMult_QEPLINEAR_N1B(Mat,Vec,Vec);
EXTERN PetscErrorCode MatGetDiagonal_QEPLINEAR_N1A(Mat,Vec);
EXTERN PetscErrorCode MatGetDiagonal_QEPLINEAR_N1B(Mat,Vec);
EXTERN PetscErrorCode MatCreateExplicit_QEPLINEAR_N1A(MPI_Comm,QEP_LINEAR*,Mat*);
EXTERN PetscErrorCode MatCreateExplicit_QEPLINEAR_N1B(MPI_Comm,QEP_LINEAR*,Mat*);
 
/* N2 */
EXTERN PetscErrorCode MatMult_QEPLINEAR_N2A(Mat,Vec,Vec);
EXTERN PetscErrorCode MatMult_QEPLINEAR_N2B(Mat,Vec,Vec);
EXTERN PetscErrorCode MatGetDiagonal_QEPLINEAR_N2A(Mat,Vec);
EXTERN PetscErrorCode MatGetDiagonal_QEPLINEAR_N2B(Mat,Vec);
EXTERN PetscErrorCode MatCreateExplicit_QEPLINEAR_N2A(MPI_Comm,QEP_LINEAR*,Mat*);
EXTERN PetscErrorCode MatCreateExplicit_QEPLINEAR_N2B(MPI_Comm,QEP_LINEAR*,Mat*);
 
/* S1 */
EXTERN PetscErrorCode MatMult_QEPLINEAR_S1A(Mat,Vec,Vec);
EXTERN PetscErrorCode MatMult_QEPLINEAR_S1B(Mat,Vec,Vec);
EXTERN PetscErrorCode MatGetDiagonal_QEPLINEAR_S1A(Mat,Vec);
EXTERN PetscErrorCode MatGetDiagonal_QEPLINEAR_S1B(Mat,Vec);
EXTERN PetscErrorCode MatCreateExplicit_QEPLINEAR_S1A(MPI_Comm,QEP_LINEAR*,Mat*);
EXTERN PetscErrorCode MatCreateExplicit_QEPLINEAR_S1B(MPI_Comm,QEP_LINEAR*,Mat*);
 
/* S2 */
EXTERN PetscErrorCode MatMult_QEPLINEAR_S2A(Mat,Vec,Vec);
EXTERN PetscErrorCode MatMult_QEPLINEAR_S2B(Mat,Vec,Vec);
EXTERN PetscErrorCode MatGetDiagonal_QEPLINEAR_S2A(Mat,Vec);
EXTERN PetscErrorCode MatGetDiagonal_QEPLINEAR_S2B(Mat,Vec);
EXTERN PetscErrorCode MatCreateExplicit_QEPLINEAR_S2A(MPI_Comm,QEP_LINEAR*,Mat*);
EXTERN PetscErrorCode MatCreateExplicit_QEPLINEAR_S2B(MPI_Comm,QEP_LINEAR*,Mat*);
 
/* H1 */
EXTERN PetscErrorCode MatMult_QEPLINEAR_H1A(Mat,Vec,Vec);
EXTERN PetscErrorCode MatMult_QEPLINEAR_H1B(Mat,Vec,Vec);
EXTERN PetscErrorCode MatGetDiagonal_QEPLINEAR_H1A(Mat,Vec);
EXTERN PetscErrorCode MatGetDiagonal_QEPLINEAR_H1B(Mat,Vec);
EXTERN PetscErrorCode MatCreateExplicit_QEPLINEAR_H1A(MPI_Comm,QEP_LINEAR*,Mat*);
EXTERN PetscErrorCode MatCreateExplicit_QEPLINEAR_H1B(MPI_Comm,QEP_LINEAR*,Mat*);
 
/* H2 */
EXTERN PetscErrorCode MatMult_QEPLINEAR_H2A(Mat,Vec,Vec);
EXTERN PetscErrorCode MatMult_QEPLINEAR_H2B(Mat,Vec,Vec);
EXTERN PetscErrorCode MatGetDiagonal_QEPLINEAR_H2A(Mat,Vec);
EXTERN PetscErrorCode MatGetDiagonal_QEPLINEAR_H2B(Mat,Vec);
EXTERN PetscErrorCode MatCreateExplicit_QEPLINEAR_H2A(MPI_Comm,QEP_LINEAR*,Mat*);
EXTERN PetscErrorCode MatCreateExplicit_QEPLINEAR_H2B(MPI_Comm,QEP_LINEAR*,Mat*);
 
/tags/slepc-3_1-2/src/qep/impls/linear/qeplin_h1.c New file
0,0 → 1,219
/*
 
Linearization for gyroscopic QEP, companion form 1.
 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SLEPc - Scalable Library for Eigenvalue Problem Computations
Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
 
This file is part of SLEPc.
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/>.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
 
#include "private/qepimpl.h" /*I "slepcqep.h" I*/
#include "slepceps.h"
#include "linearp.h"
 
/*
Given the quadratic problem (l^2*M + l*C + K)*x = 0 the following
linearization is employed:
 
A*z = l*B*z where A = [ K 0 ] B = [ 0 K ] z = [ x ]
[ C K ] [-M 0 ] [ l*x ]
*/
 
#undef __FUNCT__
#define __FUNCT__ "MatMult_QEPLINEAR_H1A"
PetscErrorCode MatMult_QEPLINEAR_H1A(Mat A,Vec x,Vec y)
{
PetscErrorCode ierr;
QEP_LINEAR *ctx;
PetscScalar *px,*py;
PetscInt m;
PetscFunctionBegin;
ierr = MatShellGetContext(A,(void**)&ctx);CHKERRQ(ierr);
ierr = MatGetLocalSize(ctx->M,&m,PETSC_NULL);CHKERRQ(ierr);
ierr = VecGetArray(x,&px);CHKERRQ(ierr);
ierr = VecGetArray(y,&py);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x1,px);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x2,px+m);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->y1,py);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->y2,py+m);CHKERRQ(ierr);
/* y2 = C*x1 + K*x2 */
ierr = MatMult(ctx->C,ctx->x1,ctx->y1);CHKERRQ(ierr);
ierr = MatMult(ctx->K,ctx->x2,ctx->y2);CHKERRQ(ierr);
ierr = VecAXPY(ctx->y2,ctx->sfactor,ctx->y1);CHKERRQ(ierr);
/* y1 = K*x1 */
ierr = MatMult(ctx->K,ctx->x1,ctx->y1);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x1);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x2);CHKERRQ(ierr);
ierr = VecResetArray(ctx->y1);CHKERRQ(ierr);
ierr = VecResetArray(ctx->y2);CHKERRQ(ierr);
ierr = VecRestoreArray(x,&px);CHKERRQ(ierr);
ierr = VecRestoreArray(y,&py);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "MatMult_QEPLINEAR_H1B"
PetscErrorCode MatMult_QEPLINEAR_H1B(Mat B,Vec x,Vec y)
{
PetscErrorCode ierr;
QEP_LINEAR *ctx;
PetscScalar *px,*py;
PetscInt m;
PetscFunctionBegin;
ierr = MatShellGetContext(B,(void**)&ctx);CHKERRQ(ierr);
ierr = MatGetLocalSize(ctx->M,&m,PETSC_NULL);CHKERRQ(ierr);
ierr = VecGetArray(x,&px);CHKERRQ(ierr);
ierr = VecGetArray(y,&py);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x1,px);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x2,px+m);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->y1,py);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->y2,py+m);CHKERRQ(ierr);
/* y1 = K*x2 */
ierr = MatMult(ctx->K,ctx->x2,ctx->y1);CHKERRQ(ierr);
/* y2 = -M*x1 */
ierr = MatMult(ctx->M,ctx->x1,ctx->y2);CHKERRQ(ierr);
ierr = VecScale(ctx->y2,-ctx->sfactor*ctx->sfactor);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x1);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x2);CHKERRQ(ierr);
ierr = VecResetArray(ctx->y1);CHKERRQ(ierr);
ierr = VecResetArray(ctx->y2);CHKERRQ(ierr);
ierr = VecRestoreArray(x,&px);CHKERRQ(ierr);
ierr = VecRestoreArray(y,&py);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "MatGetDiagonal_QEPLINEAR_H1A"
PetscErrorCode MatGetDiagonal_QEPLINEAR_H1A(Mat A,Vec diag)
{
PetscErrorCode ierr;
QEP_LINEAR *ctx;
PetscScalar *pd;
PetscInt m;
PetscFunctionBegin;
ierr = MatShellGetContext(A,(void**)&ctx);CHKERRQ(ierr);
ierr = MatGetLocalSize(ctx->M,&m,PETSC_NULL);CHKERRQ(ierr);
ierr = VecGetArray(diag,&pd);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x1,pd);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x2,pd+m);CHKERRQ(ierr);
ierr = MatGetDiagonal(ctx->K,ctx->x1);CHKERRQ(ierr);
ierr = VecCopy(ctx->x1,ctx->x2);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x1);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x2);CHKERRQ(ierr);
ierr = VecRestoreArray(diag,&pd);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "MatGetDiagonal_QEPLINEAR_H1B"
PetscErrorCode MatGetDiagonal_QEPLINEAR_H1B(Mat B,Vec diag)
{
PetscErrorCode ierr;
PetscFunctionBegin;
ierr = VecSet(diag,0.0);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "MatCreateExplicit_QEPLINEAR_H1A"
PetscErrorCode MatCreateExplicit_QEPLINEAR_H1A(MPI_Comm comm,QEP_LINEAR *ctx,Mat *A)
{
PetscErrorCode ierr;
PetscInt M,N,m,n,i,j,row,start,end,ncols,*pos;
PetscScalar *svals;
const PetscInt *cols;
const PetscScalar *vals;
PetscFunctionBegin;
ierr = MatGetSize(ctx->M,&M,&N);CHKERRQ(ierr);
ierr = MatGetLocalSize(ctx->M,&m,&n);CHKERRQ(ierr);
ierr = MatCreate(comm,A);CHKERRQ(ierr);
ierr = MatSetSizes(*A,m+n,m+n,M+N,M+N);CHKERRQ(ierr);
ierr = MatSetFromOptions(*A);CHKERRQ(ierr);
ierr = PetscMalloc(sizeof(PetscInt)*n,&pos);CHKERRQ(ierr);
ierr = PetscMalloc(sizeof(PetscScalar)*n,&svals);CHKERRQ(ierr);
ierr = MatGetOwnershipRange(ctx->M,&start,&end);CHKERRQ(ierr);
for (i=start;i<end;i++) {
row = i + M;
ierr = MatGetRow(ctx->K,i,&ncols,&cols,&vals);CHKERRQ(ierr);
ierr = MatSetValues(*A,1,&i,ncols,cols,vals,INSERT_VALUES);CHKERRQ(ierr);
for (j=0;j<ncols;j++)
pos[j] = cols[j] + M;
ierr = MatSetValues(*A,1,&row,ncols,pos,vals,INSERT_VALUES);CHKERRQ(ierr);
ierr = MatRestoreRow(ctx->K,i,&ncols,&cols,&vals);CHKERRQ(ierr);
ierr = MatGetRow(ctx->C,i,&ncols,&cols,&vals);CHKERRQ(ierr);
for (j=0;j<ncols;j++)
svals[j] = vals[j]*ctx->sfactor;
ierr = MatSetValues(*A,1,&row,ncols,cols,svals,INSERT_VALUES);CHKERRQ(ierr);
ierr = MatRestoreRow(ctx->C,i,&ncols,&cols,&vals);CHKERRQ(ierr);
}
ierr = PetscFree(pos);CHKERRQ(ierr);
ierr = PetscFree(svals);CHKERRQ(ierr);
ierr = MatAssemblyBegin(*A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
ierr = MatAssemblyEnd(*A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "MatCreateExplicit_QEPLINEAR_H1B"
PetscErrorCode MatCreateExplicit_QEPLINEAR_H1B(MPI_Comm comm,QEP_LINEAR *ctx,Mat *B)
{
PetscErrorCode ierr;
PetscInt M,N,m,n,i,j,row,start,end,ncols,*pos;
PetscScalar *svals;
const PetscInt *cols;
const PetscScalar *vals;
PetscFunctionBegin;
ierr = MatGetSize(ctx->M,&M,&N);CHKERRQ(ierr);
ierr = MatGetLocalSize(ctx->M,&m,&n);CHKERRQ(ierr);
ierr = MatCreate(comm,B);CHKERRQ(ierr);
ierr = MatSetSizes(*B,m+n,m+n,M+N,M+N);CHKERRQ(ierr);
ierr = MatSetFromOptions(*B);CHKERRQ(ierr);
ierr = PetscMalloc(sizeof(PetscInt)*n,&pos);CHKERRQ(ierr);
ierr = PetscMalloc(sizeof(PetscScalar)*n,&svals);CHKERRQ(ierr);
ierr = MatGetOwnershipRange(ctx->M,&start,&end);CHKERRQ(ierr);
for (i=start;i<end;i++) {
row = i + M;
ierr = MatGetRow(ctx->M,i,&ncols,&cols,&vals);CHKERRQ(ierr);
for (j=0;j<ncols;j++)
svals[j] = vals[j]*ctx->sfactor*ctx->sfactor;
ierr = MatSetValues(*B,1,&row,ncols,cols,svals,INSERT_VALUES);CHKERRQ(ierr);
ierr = MatRestoreRow(ctx->M,i,&ncols,&cols,&vals);CHKERRQ(ierr);
}
ierr = MatAssemblyBegin(*B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
ierr = MatAssemblyEnd(*B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
ierr = MatScale(*B,-1.0);CHKERRQ(ierr);
for (i=start;i<end;i++) {
ierr = MatGetRow(ctx->K,i,&ncols,&cols,&vals);CHKERRQ(ierr);
for (j=0;j<ncols;j++)
pos[j] = cols[j] + M;
ierr = MatSetValues(*B,1,&i,ncols,pos,vals,INSERT_VALUES);CHKERRQ(ierr);
ierr = MatRestoreRow(ctx->K,i,&ncols,&cols,&vals);CHKERRQ(ierr);
}
ierr = MatAssemblyBegin(*B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
ierr = MatAssemblyEnd(*B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
ierr = PetscFree(pos);CHKERRQ(ierr);
ierr = PetscFree(svals);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
/tags/slepc-3_1-2/src/qep/impls/linear/qeplin_h2.c New file
0,0 → 1,227
/*
 
Linearization for gyroscopic QEP, companion form 2.
 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SLEPc - Scalable Library for Eigenvalue Problem Computations
Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
 
This file is part of SLEPc.
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/>.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
 
#include "private/qepimpl.h" /*I "slepcqep.h" I*/
#include "slepceps.h"
#include "linearp.h"
 
/*
Given the quadratic problem (l^2*M + l*C + K)*x = 0 the following
linearization is employed:
 
A*z = l*B*z where A = [ 0 -K ] B = [ M C ] z = [ x ]
[ M 0 ] [ 0 M ] [ l*x ]
*/
 
#undef __FUNCT__
#define __FUNCT__ "MatMult_QEPLINEAR_H2A"
PetscErrorCode MatMult_QEPLINEAR_H2A(Mat A,Vec x,Vec y)
{
PetscErrorCode ierr;
QEP_LINEAR *ctx;
PetscScalar *px,*py;
PetscInt m;
PetscFunctionBegin;
ierr = MatShellGetContext(A,(void**)&ctx);CHKERRQ(ierr);
ierr = MatGetLocalSize(ctx->M,&m,PETSC_NULL);CHKERRQ(ierr);
ierr = VecGetArray(x,&px);CHKERRQ(ierr);
ierr = VecGetArray(y,&py);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x1,px);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x2,px+m);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->y1,py);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->y2,py+m);CHKERRQ(ierr);
/* y1 = -K*x2 */
ierr = MatMult(ctx->K,ctx->x2,ctx->y1);CHKERRQ(ierr);
ierr = VecScale(ctx->y1,-1.0);CHKERRQ(ierr);
/* y2 = M*x1 */
ierr = MatMult(ctx->M,ctx->x1,ctx->y2);CHKERRQ(ierr);
ierr = VecScale(ctx->y2,ctx->sfactor*ctx->sfactor);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x1);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x2);CHKERRQ(ierr);
ierr = VecResetArray(ctx->y1);CHKERRQ(ierr);
ierr = VecResetArray(ctx->y2);CHKERRQ(ierr);
ierr = VecRestoreArray(x,&px);CHKERRQ(ierr);
ierr = VecRestoreArray(y,&py);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "MatMult_QEPLINEAR_H2B"
PetscErrorCode MatMult_QEPLINEAR_H2B(Mat B,Vec x,Vec y)
{
PetscErrorCode ierr;
QEP_LINEAR *ctx;
PetscScalar *px,*py;
PetscInt m;
PetscFunctionBegin;
ierr = MatShellGetContext(B,(void**)&ctx);CHKERRQ(ierr);
ierr = MatGetLocalSize(ctx->M,&m,PETSC_NULL);CHKERRQ(ierr);
ierr = VecGetArray(x,&px);CHKERRQ(ierr);
ierr = VecGetArray(y,&py);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x1,px);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x2,px+m);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->y1,py);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->y2,py+m);CHKERRQ(ierr);
/* y1 = M*x1 + C*x2 */
ierr = MatMult(ctx->M,ctx->x1,ctx->y1);CHKERRQ(ierr);
ierr = VecScale(ctx->y1,ctx->sfactor*ctx->sfactor);CHKERRQ(ierr);
ierr = MatMult(ctx->C,ctx->x2,ctx->y2);CHKERRQ(ierr);
ierr = VecAXPY(ctx->y1,ctx->sfactor,ctx->y2);CHKERRQ(ierr);
/* y2 = M*x2 */
ierr = MatMult(ctx->M,ctx->x2,ctx->y2);CHKERRQ(ierr);
ierr = VecScale(ctx->y2,ctx->sfactor*ctx->sfactor);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x1);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x2);CHKERRQ(ierr);
ierr = VecResetArray(ctx->y1);CHKERRQ(ierr);
ierr = VecResetArray(ctx->y2);CHKERRQ(ierr);
ierr = VecRestoreArray(x,&px);CHKERRQ(ierr);
ierr = VecRestoreArray(y,&py);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "MatGetDiagonal_QEPLINEAR_H2A"
PetscErrorCode MatGetDiagonal_QEPLINEAR_H2A(Mat A,Vec diag)
{
PetscErrorCode ierr;
PetscFunctionBegin;
ierr = VecSet(diag,0.0);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "MatGetDiagonal_QEPLINEAR_H2B"
PetscErrorCode MatGetDiagonal_QEPLINEAR_H2B(Mat B,Vec diag)
{
PetscErrorCode ierr;
QEP_LINEAR *ctx;
PetscScalar *pd;
PetscInt m;
PetscFunctionBegin;
ierr = MatShellGetContext(B,(void**)&ctx);CHKERRQ(ierr);
ierr = MatGetLocalSize(ctx->M,&m,PETSC_NULL);CHKERRQ(ierr);
ierr = VecGetArray(diag,&pd);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x1,pd);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x2,pd+m);CHKERRQ(ierr);
ierr = MatGetDiagonal(ctx->M,ctx->x1);CHKERRQ(ierr);
ierr = VecScale(ctx->x1,ctx->sfactor*ctx->sfactor);CHKERRQ(ierr);
ierr = VecCopy(ctx->x1,ctx->x2);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x1);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x2);CHKERRQ(ierr);
ierr = VecRestoreArray(diag,&pd);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "MatCreateExplicit_QEPLINEAR_H2A"
PetscErrorCode MatCreateExplicit_QEPLINEAR_H2A(MPI_Comm comm,QEP_LINEAR *ctx,Mat *A)
{
PetscErrorCode ierr;
PetscInt M,N,m,n,i,j,row,start,end,ncols,*pos;
PetscScalar *svals;
const PetscInt *cols;
const PetscScalar *vals;
PetscFunctionBegin;
ierr = MatGetSize(ctx->M,&M,&N);CHKERRQ(ierr);
ierr = MatGetLocalSize(ctx->M,&m,&n);CHKERRQ(ierr);
ierr = MatCreate(comm,A);CHKERRQ(ierr);
ierr = MatSetSizes(*A,m+n,m+n,M+N,M+N);CHKERRQ(ierr);
ierr = MatSetFromOptions(*A);CHKERRQ(ierr);
ierr = PetscMalloc(sizeof(PetscInt)*n,&pos);CHKERRQ(ierr);
ierr = PetscMalloc(sizeof(PetscScalar)*n,&svals);CHKERRQ(ierr);
ierr = MatGetOwnershipRange(ctx->M,&start,&end);CHKERRQ(ierr);
for (i=start;i<end;i++) {
ierr = MatGetRow(ctx->K,i,&ncols,&cols,&vals);CHKERRQ(ierr);
for (j=0;j<ncols;j++)
pos[j] = cols[j] + M;
ierr = MatSetValues(*A,1,&i,ncols,pos,vals,INSERT_VALUES);CHKERRQ(ierr);
ierr = MatRestoreRow(ctx->K,i,&ncols,&cols,&vals);CHKERRQ(ierr);
}
ierr = MatAssemblyBegin(*A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
ierr = MatAssemblyEnd(*A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
ierr = MatScale(*A,-1.0);CHKERRQ(ierr);
for (i=start;i<end;i++) {
row = i + M;
ierr = MatGetRow(ctx->M,i,&ncols,&cols,&vals);CHKERRQ(ierr);
for (j=0;j<ncols;j++)
svals[j] = vals[j]*ctx->sfactor*ctx->sfactor;
ierr = MatSetValues(*A,1,&row,ncols,cols,svals,INSERT_VALUES);CHKERRQ(ierr);
ierr = MatRestoreRow(ctx->M,i,&ncols,&cols,&vals);CHKERRQ(ierr);
}
ierr = MatAssemblyBegin(*A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
ierr = MatAssemblyEnd(*A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
ierr = PetscFree(pos);CHKERRQ(ierr);
ierr = PetscFree(svals);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "MatCreateExplicit_QEPLINEAR_H2B"
PetscErrorCode MatCreateExplicit_QEPLINEAR_H2B(MPI_Comm comm,QEP_LINEAR *ctx,Mat *B)
{
PetscErrorCode ierr;
PetscInt M,N,m,n,i,j,row,start,end,ncols,*pos;
PetscScalar *svals;
const PetscInt *cols;
const PetscScalar *vals;
PetscFunctionBegin;
ierr = MatGetSize(ctx->M,&M,&N);CHKERRQ(ierr);
ierr = MatGetLocalSize(ctx->M,&m,&n);CHKERRQ(ierr);
ierr = MatCreate(comm,B);CHKERRQ(ierr);
ierr = MatSetSizes(*B,m+n,m+n,M+N,M+N);CHKERRQ(ierr);
ierr = MatSetFromOptions(*B);CHKERRQ(ierr);
ierr = PetscMalloc(sizeof(PetscInt)*n,&pos);CHKERRQ(ierr);
ierr = PetscMalloc(sizeof(PetscScalar)*n,&svals);CHKERRQ(ierr);
ierr = MatGetOwnershipRange(ctx->M,&start,&end);CHKERRQ(ierr);
for (i=start;i<end;i++) {
row = i + M;
ierr = MatGetRow(ctx->C,i,&ncols,&cols,&vals);CHKERRQ(ierr);
for (j=0;j<ncols;j++) {
pos[j] = cols[j] + M;
svals[j] = vals[j]*ctx->sfactor;
}
ierr = MatSetValues(*B,1,&i,ncols,pos,svals,INSERT_VALUES);CHKERRQ(ierr);
ierr = MatRestoreRow(ctx->C,i,&ncols,&cols,&vals);CHKERRQ(ierr);
ierr = MatGetRow(ctx->M,i,&ncols,&cols,&vals);CHKERRQ(ierr);
for (j=0;j<ncols;j++) {
pos[j] = cols[j] + M;
svals[j] = vals[j]*ctx->sfactor*ctx->sfactor;
}
ierr = MatSetValues(*B,1,&i,ncols,cols,svals,INSERT_VALUES);CHKERRQ(ierr);
ierr = MatSetValues(*B,1,&row,ncols,pos,svals,INSERT_VALUES);CHKERRQ(ierr);
ierr = MatRestoreRow(ctx->M,i,&ncols,&cols,&vals);CHKERRQ(ierr);
}
ierr = PetscFree(pos);CHKERRQ(ierr);
ierr = PetscFree(svals);CHKERRQ(ierr);
ierr = MatAssemblyBegin(*B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
ierr = MatAssemblyEnd(*B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
/tags/slepc-3_1-2/src/qep/impls/linear/qeplin_n1.c New file
0,0 → 1,228
/*
 
Linearization for general QEP, companion form 1.
 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SLEPc - Scalable Library for Eigenvalue Problem Computations
Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
 
This file is part of SLEPc.
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/>.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
 
#include "private/qepimpl.h" /*I "slepcqep.h" I*/
#include "slepceps.h"
#include "linearp.h"
 
/*
Given the quadratic problem (l^2*M + l*C + K)*x = 0 the following
linearization is employed:
 
A*z = l*B*z where A = [ 0 I ] B = [ I 0 ] z = [ x ]
[ -K -C ] [ 0 M ] [ l*x ]
*/
 
#undef __FUNCT__
#define __FUNCT__ "MatMult_QEPLINEAR_N1A"
PetscErrorCode MatMult_QEPLINEAR_N1A(Mat A,Vec x,Vec y)
{
PetscErrorCode ierr;
QEP_LINEAR *ctx;
PetscScalar *px,*py;
PetscInt m;
PetscFunctionBegin;
ierr = MatShellGetContext(A,(void**)&ctx);CHKERRQ(ierr);
ierr = MatGetLocalSize(ctx->M,&m,PETSC_NULL);CHKERRQ(ierr);
ierr = VecGetArray(x,&px);CHKERRQ(ierr);
ierr = VecGetArray(y,&py);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x1,px);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x2,px+m);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->y1,py);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->y2,py+m);CHKERRQ(ierr);
/* y2 = -(K*x1 + C*x2) */
ierr = MatMult(ctx->K,ctx->x1,ctx->y2);CHKERRQ(ierr);
ierr = MatMult(ctx->C,ctx->x2,ctx->y1);CHKERRQ(ierr);
ierr = VecAXPY(ctx->y2,ctx->sfactor,ctx->y1);CHKERRQ(ierr);
ierr = VecScale(ctx->y2,-1.0);CHKERRQ(ierr);
/* y1 = x2 */
ierr = VecCopy(ctx->x2,ctx->y1);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x1);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x2);CHKERRQ(ierr);
ierr = VecResetArray(ctx->y1);CHKERRQ(ierr);
ierr = VecResetArray(ctx->y2);CHKERRQ(ierr);
ierr = VecRestoreArray(x,&px);CHKERRQ(ierr);
ierr = VecRestoreArray(y,&py);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "MatMult_QEPLINEAR_N1B"
PetscErrorCode MatMult_QEPLINEAR_N1B(Mat B,Vec x,Vec y)
{
PetscErrorCode ierr;
QEP_LINEAR *ctx;
PetscScalar *px,*py;
PetscInt m;
PetscFunctionBegin;
ierr = MatShellGetContext(B,(void**)&ctx);CHKERRQ(ierr);
ierr = MatGetLocalSize(ctx->M,&m,PETSC_NULL);CHKERRQ(ierr);
ierr = VecGetArray(x,&px);CHKERRQ(ierr);
ierr = VecGetArray(y,&py);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x1,px);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x2,px+m);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->y1,py);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->y2,py+m);CHKERRQ(ierr);
/* y1 = x1 */
ierr = VecCopy(ctx->x1,ctx->y1);CHKERRQ(ierr);
/* y2 = M*x2 */
ierr = MatMult(ctx->M,ctx->x2,ctx->y2);CHKERRQ(ierr);
ierr = VecScale(ctx->y2,ctx->sfactor*ctx->sfactor);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x1);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x2);CHKERRQ(ierr);
ierr = VecResetArray(ctx->y1);CHKERRQ(ierr);
ierr = VecResetArray(ctx->y2);CHKERRQ(ierr);
ierr = VecRestoreArray(x,&px);CHKERRQ(ierr);
ierr = VecRestoreArray(y,&py);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "MatGetDiagonal_QEPLINEAR_N1A"
PetscErrorCode MatGetDiagonal_QEPLINEAR_N1A(Mat A,Vec diag)
{
PetscErrorCode ierr;
QEP_LINEAR *ctx;
PetscScalar *pd;
PetscInt m;
PetscFunctionBegin;
ierr = MatShellGetContext(A,(void**)&ctx);CHKERRQ(ierr);
ierr = MatGetLocalSize(ctx->M,&m,PETSC_NULL);CHKERRQ(ierr);
ierr = VecGetArray(diag,&pd);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x1,pd);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x2,pd+m);CHKERRQ(ierr);
ierr = VecSet(ctx->x1,0.0);CHKERRQ(ierr);
ierr = MatGetDiagonal(ctx->C,ctx->x2);CHKERRQ(ierr);
ierr = VecScale(ctx->x2,-ctx->sfactor);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x1);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x2);CHKERRQ(ierr);
ierr = VecRestoreArray(diag,&pd);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "MatGetDiagonal_QEPLINEAR_N1B"
PetscErrorCode MatGetDiagonal_QEPLINEAR_N1B(Mat B,Vec diag)
{
PetscErrorCode ierr;
QEP_LINEAR *ctx;
PetscScalar *pd;
PetscInt m;
PetscFunctionBegin;
ierr = MatShellGetContext(B,(void**)&ctx);CHKERRQ(ierr);
ierr = MatGetLocalSize(ctx->M,&m,PETSC_NULL);CHKERRQ(ierr);
ierr = VecGetArray(diag,&pd);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x1,pd);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x2,pd+m);CHKERRQ(ierr);
ierr = VecSet(ctx->x1,1.0);CHKERRQ(ierr);
ierr = MatGetDiagonal(ctx->M,ctx->x2);CHKERRQ(ierr);
ierr = VecScale(ctx->x2,ctx->sfactor*ctx->sfactor);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x1);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x2);CHKERRQ(ierr);
ierr = VecRestoreArray(diag,&pd);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "MatCreateExplicit_QEPLINEAR_N1A"
PetscErrorCode MatCreateExplicit_QEPLINEAR_N1A(MPI_Comm comm,QEP_LINEAR *ctx,Mat *A)
{
PetscErrorCode ierr;
PetscInt M,N,m,n,i,j,row,start,end,ncols,*pos;
PetscScalar *svals;
const PetscInt *cols;
const PetscScalar *vals;
PetscFunctionBegin;
ierr = MatGetSize(ctx->M,&M,&N);CHKERRQ(ierr);
ierr = MatGetLocalSize(ctx->M,&m,&n);CHKERRQ(ierr);
ierr = MatCreate(comm,A);CHKERRQ(ierr);
ierr = MatSetSizes(*A,m+n,m+n,M+N,M+N);CHKERRQ(ierr);
ierr = MatSetFromOptions(*A);CHKERRQ(ierr);
ierr = PetscMalloc(sizeof(PetscInt)*n,&pos);CHKERRQ(ierr);
ierr = PetscMalloc(sizeof(PetscScalar)*n,&svals);CHKERRQ(ierr);
ierr = MatGetOwnershipRange(ctx->M,&start,&end);CHKERRQ(ierr);
for (i=start;i<end;i++) {
row = i + M;
ierr = MatSetValue(*A,i,i+M,-1.0,INSERT_VALUES);CHKERRQ(ierr);
ierr = MatGetRow(ctx->K,i,&ncols,&cols,&vals);CHKERRQ(ierr);
ierr = MatSetValues(*A,1,&row,ncols,cols,vals,INSERT_VALUES);CHKERRQ(ierr);
ierr = MatRestoreRow(ctx->K,i,&ncols,&cols,&vals);CHKERRQ(ierr);
ierr = MatGetRow(ctx->C,i,&ncols,&cols,&vals);CHKERRQ(ierr);
for (j=0;j<ncols;j++) {
pos[j] = cols[j] + M;
svals[j] = vals[j]*ctx->sfactor;
}
ierr = MatSetValues(*A,1,&row,ncols,pos,svals,INSERT_VALUES);CHKERRQ(ierr);
ierr = MatRestoreRow(ctx->C,i,&ncols,&cols,&vals);CHKERRQ(ierr);
}
ierr = PetscFree(pos);CHKERRQ(ierr);
ierr = PetscFree(svals);CHKERRQ(ierr);
ierr = MatAssemblyBegin(*A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
ierr = MatAssemblyEnd(*A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
ierr = MatScale(*A,-1.0);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "MatCreateExplicit_QEPLINEAR_N1B"
PetscErrorCode MatCreateExplicit_QEPLINEAR_N1B(MPI_Comm comm,QEP_LINEAR *ctx,Mat *B)
{
PetscErrorCode ierr;
PetscInt M,N,m,n,i,j,row,start,end,ncols,*pos;
PetscScalar *svals;
const PetscInt *cols;
const PetscScalar *vals;
PetscFunctionBegin;
ierr = MatGetSize(ctx->M,&M,&N);CHKERRQ(ierr);
ierr = MatGetLocalSize(ctx->M,&m,&n);CHKERRQ(ierr);
ierr = MatCreate(comm,B);CHKERRQ(ierr);
ierr = MatSetSizes(*B,m+n,m+n,M+N,M+N);CHKERRQ(ierr);
ierr = MatSetFromOptions(*B);CHKERRQ(ierr);
ierr = PetscMalloc(sizeof(PetscInt)*n,&pos);CHKERRQ(ierr);
ierr = PetscMalloc(sizeof(PetscScalar)*n,&svals);CHKERRQ(ierr);
ierr = MatGetOwnershipRange(ctx->M,&start,&end);CHKERRQ(ierr);
for (i=start;i<end;i++) {
row = i + M;
ierr = MatSetValue(*B,i,i,1.0,INSERT_VALUES);CHKERRQ(ierr);
ierr = MatGetRow(ctx->M,i,&ncols,&cols,&vals);CHKERRQ(ierr);
for (j=0;j<ncols;j++) {
pos[j] = cols[j] + M;
svals[j] = vals[j]*ctx->sfactor*ctx->sfactor;
}
ierr = MatSetValues(*B,1,&row,ncols,pos,svals,INSERT_VALUES);CHKERRQ(ierr);
ierr = MatRestoreRow(ctx->M,i,&ncols,&cols,&vals);CHKERRQ(ierr);
}
ierr = PetscFree(pos);CHKERRQ(ierr);
ierr = PetscFree(svals);CHKERRQ(ierr);
ierr = MatAssemblyBegin(*B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
ierr = MatAssemblyEnd(*B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
/tags/slepc-3_1-2/src/qep/impls/linear/qeplin_n2.c New file
0,0 → 1,220
/*
 
Linearization for general QEP, companion form 2.
 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SLEPc - Scalable Library for Eigenvalue Problem Computations
Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
 
This file is part of SLEPc.
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/>.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
 
#include "private/qepimpl.h" /*I "slepcqep.h" I*/
#include "slepceps.h"
#include "linearp.h"
 
/*
Given the quadratic problem (l^2*M + l*C + K)*x = 0 the following
linearization is employed:
 
A*z = l*B*z where A = [ -K 0 ] B = [ C M ] z = [ x ]
[ 0 I ] [ I 0 ] [ l*x ]
*/
 
#undef __FUNCT__
#define __FUNCT__ "MatMult_QEPLINEAR_N2A"
PetscErrorCode MatMult_QEPLINEAR_N2A(Mat A,Vec x,Vec y)
{
PetscErrorCode ierr;
QEP_LINEAR *ctx;
PetscScalar *px,*py;
PetscInt m;
PetscFunctionBegin;
ierr = MatShellGetContext(A,(void**)&ctx);CHKERRQ(ierr);
ierr = MatGetLocalSize(ctx->M,&m,PETSC_NULL);CHKERRQ(ierr);
ierr = VecGetArray(x,&px);CHKERRQ(ierr);
ierr = VecGetArray(y,&py);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x1,px);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x2,px+m);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->y1,py);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->y2,py+m);CHKERRQ(ierr);
/* y1 = -K*x1 */
ierr = MatMult(ctx->K,ctx->x1,ctx->y1);CHKERRQ(ierr);
ierr = VecScale(ctx->y1,-1.0);CHKERRQ(ierr);
/* y2 = x2 */
ierr = VecCopy(ctx->x2,ctx->y2);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x1);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x2);CHKERRQ(ierr);
ierr = VecResetArray(ctx->y1);CHKERRQ(ierr);
ierr = VecResetArray(ctx->y2);CHKERRQ(ierr);
ierr = VecRestoreArray(x,&px);CHKERRQ(ierr);
ierr = VecRestoreArray(y,&py);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "MatMult_QEPLINEAR_N2B"
PetscErrorCode MatMult_QEPLINEAR_N2B(Mat B,Vec x,Vec y)
{
PetscErrorCode ierr;
QEP_LINEAR *ctx;
PetscScalar *px,*py;
PetscInt m;
PetscFunctionBegin;
ierr = MatShellGetContext(B,(void**)&ctx);CHKERRQ(ierr);
ierr = MatGetLocalSize(ctx->M,&m,PETSC_NULL);CHKERRQ(ierr);
ierr = VecGetArray(x,&px);CHKERRQ(ierr);
ierr = VecGetArray(y,&py);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x1,px);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x2,px+m);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->y1,py);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->y2,py+m);CHKERRQ(ierr);
/* y1 = C*x1 + M*x2 */
ierr = MatMult(ctx->C,ctx->x1,ctx->y1);CHKERRQ(ierr);
ierr = VecScale(ctx->y1,ctx->sfactor);CHKERRQ(ierr);
ierr = MatMult(ctx->M,ctx->x2,ctx->y2);CHKERRQ(ierr);
ierr = VecAXPY(ctx->y1,ctx->sfactor*ctx->sfactor,ctx->y2);CHKERRQ(ierr);
/* y2 = x1 */
ierr = VecCopy(ctx->x1,ctx->y2);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x1);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x2);CHKERRQ(ierr);
ierr = VecResetArray(ctx->y1);CHKERRQ(ierr);
ierr = VecResetArray(ctx->y2);CHKERRQ(ierr);
ierr = VecRestoreArray(x,&px);CHKERRQ(ierr);
ierr = VecRestoreArray(y,&py);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "MatGetDiagonal_QEPLINEAR_N2A"
PetscErrorCode MatGetDiagonal_QEPLINEAR_N2A(Mat A,Vec diag)
{
PetscErrorCode ierr;
QEP_LINEAR *ctx;
PetscScalar *pd;
PetscInt m;
PetscFunctionBegin;
ierr = MatShellGetContext(A,(void**)&ctx);CHKERRQ(ierr);
ierr = MatGetLocalSize(ctx->M,&m,PETSC_NULL);CHKERRQ(ierr);
ierr = VecGetArray(diag,&pd);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x1,pd);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x2,pd+m);CHKERRQ(ierr);
ierr = MatGetDiagonal(ctx->K,ctx->x1);CHKERRQ(ierr);
ierr = VecScale(ctx->x1,-1.0);CHKERRQ(ierr);
ierr = VecSet(ctx->x2,1.0);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x1);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x2);CHKERRQ(ierr);
ierr = VecRestoreArray(diag,&pd);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "MatGetDiagonal_QEPLINEAR_N2B"
PetscErrorCode MatGetDiagonal_QEPLINEAR_N2B(Mat B,Vec diag)
{
PetscErrorCode ierr;
QEP_LINEAR *ctx;
PetscScalar *pd;
PetscInt m;
PetscFunctionBegin;
ierr = MatShellGetContext(B,(void**)&ctx);CHKERRQ(ierr);
ierr = MatGetLocalSize(ctx->M,&m,PETSC_NULL);CHKERRQ(ierr);
ierr = VecGetArray(diag,&pd);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x1,pd);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x2,pd+m);CHKERRQ(ierr);
ierr = MatGetDiagonal(ctx->C,ctx->x1);CHKERRQ(ierr);
ierr = VecScale(ctx->x1,ctx->sfactor);CHKERRQ(ierr);
ierr = VecSet(ctx->x2,0.0);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x1);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x2);CHKERRQ(ierr);
ierr = VecRestoreArray(diag,&pd);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "MatCreateExplicit_QEPLINEAR_N2A"
PetscErrorCode MatCreateExplicit_QEPLINEAR_N2A(MPI_Comm comm,QEP_LINEAR *ctx,Mat *A)
{
PetscErrorCode ierr;
PetscInt M,N,m,n,i,start,end,ncols;
const PetscInt *cols;
const PetscScalar *vals;
PetscFunctionBegin;
ierr = MatGetSize(ctx->M,&M,&N);CHKERRQ(ierr);
ierr = MatGetLocalSize(ctx->M,&m,&n);CHKERRQ(ierr);
ierr = MatCreate(comm,A);CHKERRQ(ierr);
ierr = MatSetSizes(*A,m+n,m+n,M+N,M+N);CHKERRQ(ierr);
ierr = MatSetFromOptions(*A);CHKERRQ(ierr);
ierr = MatGetOwnershipRange(ctx->M,&start,&end);CHKERRQ(ierr);
for (i=start;i<end;i++) {
ierr = MatGetRow(ctx->K,i,&ncols,&cols,&vals);CHKERRQ(ierr);
ierr = MatSetValues(*A,1,&i,ncols,cols,vals,INSERT_VALUES);CHKERRQ(ierr);
ierr = MatRestoreRow(ctx->K,i,&ncols,&cols,&vals);CHKERRQ(ierr);
ierr = MatSetValue(*A,i+M,i+M,-1.0,INSERT_VALUES);CHKERRQ(ierr);
}
ierr = MatAssemblyBegin(*A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
ierr = MatAssemblyEnd(*A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
ierr = MatScale(*A,-1.0);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "MatCreateExplicit_QEPLINEAR_N2B"
PetscErrorCode MatCreateExplicit_QEPLINEAR_N2B(MPI_Comm comm,QEP_LINEAR *ctx,Mat *B)
{
PetscErrorCode ierr;
PetscInt M,N,m,n,i,j,start,end,ncols,*pos;
PetscScalar *svals;
const PetscInt *cols;
const PetscScalar *vals;
PetscFunctionBegin;
ierr = MatGetSize(ctx->M,&M,&N);CHKERRQ(ierr);
ierr = MatGetLocalSize(ctx->M,&m,&n);CHKERRQ(ierr);
ierr = MatCreate(comm,B);CHKERRQ(ierr);
ierr = MatSetSizes(*B,m+n,m+n,M+N,M+N);CHKERRQ(ierr);
ierr = MatSetFromOptions(*B);CHKERRQ(ierr);
ierr = PetscMalloc(sizeof(PetscInt)*n,&pos);CHKERRQ(ierr);
ierr = PetscMalloc(sizeof(PetscScalar)*n,&svals);CHKERRQ(ierr);
ierr = MatGetOwnershipRange(ctx->M,&start,&end);CHKERRQ(ierr);
for (i=start;i<end;i++) {
ierr = MatGetRow(ctx->C,i,&ncols,&cols,&vals);CHKERRQ(ierr);
for (j=0;j<ncols;j++) {
svals[j] = vals[j]*ctx->sfactor;
}
ierr = MatSetValues(*B,1,&i,ncols,cols,svals,INSERT_VALUES);CHKERRQ(ierr);
ierr = MatRestoreRow(ctx->C,i,&ncols,&cols,&vals);CHKERRQ(ierr);
ierr = MatGetRow(ctx->M,i,&ncols,&cols,&vals);CHKERRQ(ierr);
for (j=0;j<ncols;j++) {
pos[j] = cols[j] + M;
svals[j] = vals[j]*ctx->sfactor*ctx->sfactor;
}
ierr = MatSetValues(*B,1,&i,ncols,pos,svals,INSERT_VALUES);CHKERRQ(ierr);
ierr = MatRestoreRow(ctx->M,i,&ncols,&cols,&vals);CHKERRQ(ierr);
ierr = MatSetValue(*B,i+M,i,1.0,INSERT_VALUES);CHKERRQ(ierr);
}
ierr = PetscFree(pos);CHKERRQ(ierr);
ierr = PetscFree(svals);CHKERRQ(ierr);
ierr = MatAssemblyBegin(*B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
ierr = MatAssemblyEnd(*B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
/tags/slepc-3_1-2/src/qep/impls/linear/linear.c New file
0,0 → 1,843
/*
 
Straightforward linearization for quadratic eigenproblems.
 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SLEPc - Scalable Library for Eigenvalue Problem Computations
Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
 
This file is part of SLEPc.
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/>.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
 
#include "private/qepimpl.h" /*I "slepcqep.h" I*/
#include "private/epsimpl.h" /*I "slepceps.h" I*/
#include "slepceps.h"
#include "linearp.h"
 
#undef __FUNCT__
#define __FUNCT__ "QEPSetUp_LINEAR"
PetscErrorCode QEPSetUp_LINEAR(QEP qep)
{
PetscErrorCode ierr;
QEP_LINEAR *ctx = (QEP_LINEAR *)qep->data;
PetscInt i=0;
EPSWhich which;
PetscTruth trackall;
 
/* function tables */
PetscErrorCode (*fcreate[][2])(MPI_Comm,QEP_LINEAR*,Mat*) = {
{ MatCreateExplicit_QEPLINEAR_N1A, MatCreateExplicit_QEPLINEAR_N1B }, /* N1 */
{ MatCreateExplicit_QEPLINEAR_N2A, MatCreateExplicit_QEPLINEAR_N2B }, /* N2 */
{ MatCreateExplicit_QEPLINEAR_S1A, MatCreateExplicit_QEPLINEAR_S1B }, /* S1 */
{ MatCreateExplicit_QEPLINEAR_S2A, MatCreateExplicit_QEPLINEAR_S2B }, /* S2 */
{ MatCreateExplicit_QEPLINEAR_H1A, MatCreateExplicit_QEPLINEAR_H1B }, /* H1 */
{ MatCreateExplicit_QEPLINEAR_H2A, MatCreateExplicit_QEPLINEAR_H2B } /* H2 */
};
PetscErrorCode (*fmult[][2])(Mat,Vec,Vec) = {
{ MatMult_QEPLINEAR_N1A, MatMult_QEPLINEAR_N1B },
{ MatMult_QEPLINEAR_N2A, MatMult_QEPLINEAR_N2B },
{ MatMult_QEPLINEAR_S1A, MatMult_QEPLINEAR_S1B },
{ MatMult_QEPLINEAR_S2A, MatMult_QEPLINEAR_S2B },
{ MatMult_QEPLINEAR_H1A, MatMult_QEPLINEAR_H1B },
{ MatMult_QEPLINEAR_H2A, MatMult_QEPLINEAR_H2B }
};
PetscErrorCode (*fgetdiagonal[][2])(Mat,Vec) = {
{ MatGetDiagonal_QEPLINEAR_N1A, MatGetDiagonal_QEPLINEAR_N1B },
{ MatGetDiagonal_QEPLINEAR_N2A, MatGetDiagonal_QEPLINEAR_N2B },
{ MatGetDiagonal_QEPLINEAR_S1A, MatGetDiagonal_QEPLINEAR_S1B },
{ MatGetDiagonal_QEPLINEAR_S2A, MatGetDiagonal_QEPLINEAR_S2B },
{ MatGetDiagonal_QEPLINEAR_H1A, MatGetDiagonal_QEPLINEAR_H1B },
{ MatGetDiagonal_QEPLINEAR_H2A, MatGetDiagonal_QEPLINEAR_H2B }
};
 
PetscFunctionBegin;
if (!qep->which) qep->which = QEP_LARGEST_MAGNITUDE;
ctx->M = qep->M;
ctx->C = qep->C;
ctx->K = qep->K;
ctx->sfactor = qep->sfactor;
 
if (ctx->A) {
ierr = MatDestroy(ctx->A);CHKERRQ(ierr);
ierr = MatDestroy(ctx->B);CHKERRQ(ierr);
}
if (ctx->x1) {
ierr = VecDestroy(ctx->x1);CHKERRQ(ierr);
ierr = VecDestroy(ctx->x2);CHKERRQ(ierr);
ierr = VecDestroy(ctx->y1);CHKERRQ(ierr);
ierr = VecDestroy(ctx->y2);CHKERRQ(ierr);
}
 
switch (qep->problem_type) {
case QEP_GENERAL: i = 0; break;
case QEP_HERMITIAN: i = 2; break;
case QEP_GYROSCOPIC: i = 4; break;
default: SETERRQ(1,"Wrong value of qep->problem_type");
}
i += ctx->cform-1;
 
if (ctx->explicitmatrix) {
ctx->x1 = ctx->x2 = ctx->y1 = ctx->y2 = PETSC_NULL;
ierr = (*fcreate[i][0])(((PetscObject)qep)->comm,ctx,&ctx->A);CHKERRQ(ierr);
ierr = (*fcreate[i][1])(((PetscObject)qep)->comm,ctx,&ctx->B);CHKERRQ(ierr);
} else {
ierr = VecCreateMPIWithArray(((PetscObject)qep)->comm,qep->nloc,qep->n,PETSC_NULL,&ctx->x1);CHKERRQ(ierr);
ierr = VecCreateMPIWithArray(((PetscObject)qep)->comm,qep->nloc,qep->n,PETSC_NULL,&ctx->x2);CHKERRQ(ierr);
ierr = VecCreateMPIWithArray(((PetscObject)qep)->comm,qep->nloc,qep->n,PETSC_NULL,&ctx->y1);CHKERRQ(ierr);
ierr = VecCreateMPIWithArray(((PetscObject)qep)->comm,qep->nloc,qep->n,PETSC_NULL,&ctx->y2);CHKERRQ(ierr);
ierr = MatCreateShell(((PetscObject)qep)->comm,2*qep->nloc,2*qep->nloc,2*qep->n,2*qep->n,ctx,&ctx->A);CHKERRQ(ierr);
ierr = MatShellSetOperation(ctx->A,MATOP_MULT,(void(*)(void))fmult[i][0]);CHKERRQ(ierr);
ierr = MatShellSetOperation(ctx->A,MATOP_GET_DIAGONAL,(void(*)(void))fgetdiagonal[i][0]);CHKERRQ(ierr);
ierr = MatCreateShell(((PetscObject)qep)->comm,2*qep->nloc,2*qep->nloc,2*qep->n,2*qep->n,ctx,&ctx->B);CHKERRQ(ierr);
ierr = MatShellSetOperation(ctx->B,MATOP_MULT,(void(*)(void))fmult[i][1]);CHKERRQ(ierr);
ierr = MatShellSetOperation(ctx->B,MATOP_GET_DIAGONAL,(void(*)(void))fgetdiagonal[i][1]);CHKERRQ(ierr);
}
 
ierr = EPSSetOperators(ctx->eps,ctx->A,ctx->B);CHKERRQ(ierr);
ierr = EPSSetProblemType(ctx->eps,EPS_GNHEP);CHKERRQ(ierr);
switch (qep->which) {
case QEP_LARGEST_MAGNITUDE: which = EPS_LARGEST_MAGNITUDE; break;
case QEP_SMALLEST_MAGNITUDE: which = EPS_SMALLEST_MAGNITUDE; break;
case QEP_LARGEST_REAL: which = EPS_LARGEST_REAL; break;
case QEP_SMALLEST_REAL: which = EPS_SMALLEST_REAL; break;
case QEP_LARGEST_IMAGINARY: which = EPS_LARGEST_IMAGINARY; break;
case QEP_SMALLEST_IMAGINARY: which = EPS_SMALLEST_IMAGINARY; break;
default: SETERRQ(1,"Wrong value of which");
}
ierr = EPSSetWhichEigenpairs(ctx->eps,which);CHKERRQ(ierr);
ierr = EPSSetLeftVectorsWanted(ctx->eps,qep->leftvecs);CHKERRQ(ierr);
ierr = EPSSetDimensions(ctx->eps,qep->nev,qep->ncv,qep->mpd);CHKERRQ(ierr);
ierr = EPSSetTolerances(ctx->eps,qep->tol,qep->max_it);CHKERRQ(ierr);
/* Transfer the trackall option from qep to eps */
ierr = QEPGetTrackAll(qep,&trackall);CHKERRQ(ierr);
ierr = EPSSetTrackAll(ctx->eps,trackall);CHKERRQ(ierr);
if (ctx->setfromoptionscalled == PETSC_TRUE) {
ierr = EPSSetFromOptions(ctx->eps);CHKERRQ(ierr);
ctx->setfromoptionscalled = PETSC_FALSE;
}
ierr = EPSSetUp(ctx->eps);CHKERRQ(ierr);
ierr = EPSGetDimensions(ctx->eps,PETSC_NULL,&qep->ncv,&qep->mpd);CHKERRQ(ierr);
ierr = EPSGetTolerances(ctx->eps,&qep->tol,&qep->max_it);CHKERRQ(ierr);
if (qep->nini>0 || qep->ninil>0) PetscInfo(qep,"Ignoring initial vectors\n");
 
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPLinearSelect_Norm"
/*
QEPLinearSelect_Norm - Auxiliary routine that copies the solution of the
linear eigenproblem to the QEP object. The eigenvector of the generalized
problem is supposed to be
z = [ x ]
[ l*x ]
The eigenvector is taken from z(1:n) or z(n+1:2*n) depending on the explicitly
computed residual norm.
Finally, x is normalized so that ||x||_2 = 1.
 
If explicitmatrix==PETSC_TRUE then z is partitioned across processors, otherwise x is.
*/
PetscErrorCode QEPLinearSelect_Norm(QEP qep,EPS eps,PetscTruth explicitmatrix)
{
PetscErrorCode ierr;
PetscInt i,start,end,idx;
PetscScalar *px;
PetscReal rn1,rn2;
Vec v0,xr,xi,wr,wi;
Mat A;
IS isV1,isV2;
VecScatter vsV1,vsV2;
#if !defined(PETSC_USE_COMPLEX)
PetscScalar *py;
#endif
PetscFunctionBegin;
ierr = EPSGetOperators(eps,&A,PETSC_NULL);CHKERRQ(ierr);
ierr = MatGetVecs(A,&v0,PETSC_NULL);CHKERRQ(ierr);
ierr = VecDuplicate(v0,&xr);CHKERRQ(ierr);
ierr = VecDuplicate(v0,&xi);CHKERRQ(ierr);
 
if (explicitmatrix) { /* case 1: x needs to be scattered from the owning processes to the rest */
ierr = VecDuplicate(qep->V[0],&wr);CHKERRQ(ierr);
ierr = VecDuplicate(qep->V[0],&wi);CHKERRQ(ierr);
ierr = VecGetOwnershipRange(qep->V[0],&start,&end);CHKERRQ(ierr);
idx = start;
ierr = ISCreateBlock(((PetscObject)qep)->comm,end-start,1,&idx,&isV1);CHKERRQ(ierr);
ierr = VecScatterCreate(xr,isV1,qep->V[0],PETSC_NULL,&vsV1);CHKERRQ(ierr);
idx = start+qep->n;
ierr = ISCreateBlock(((PetscObject)qep)->comm,end-start,1,&idx,&isV2);CHKERRQ(ierr);
ierr = VecScatterCreate(xr,isV2,qep->V[0],PETSC_NULL,&vsV2);CHKERRQ(ierr);
for (i=0;i<qep->nconv;i++) {
ierr = EPSGetEigenpair(eps,i,&qep->eigr[i],&qep->eigi[i],xr,xi);CHKERRQ(ierr);
qep->eigr[i] *= qep->sfactor;
qep->eigi[i] *= qep->sfactor;
#if !defined(PETSC_USE_COMPLEX)
if (qep->eigi[i]>0.0) { /* first eigenvalue of a complex conjugate pair */
ierr = VecScatterBegin(vsV1,xr,wr,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr);
ierr = VecScatterEnd(vsV1,xr,wr,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr);
ierr = VecScatterBegin(vsV1,xi,wi,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr);
ierr = VecScatterEnd(vsV1,xi,wi,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr);
ierr = SlepcVecNormalize(wr,wi,PETSC_TRUE,PETSC_NULL);CHKERRQ(ierr);
ierr = QEPComputeResidualNorm_Private(qep,qep->eigr[i],qep->eigi[i],wr,wi,&rn1);CHKERRQ(ierr);
ierr = VecCopy(wr,qep->V[i]);CHKERRQ(ierr);
ierr = VecCopy(wi,qep->V[i+1]);CHKERRQ(ierr);
ierr = VecScatterBegin(vsV2,xr,wr,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr);
ierr = VecScatterEnd(vsV2,xr,wr,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr);
ierr = VecScatterBegin(vsV2,xi,wi,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr);
ierr = VecScatterEnd(vsV2,xi,wi,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr);
ierr = SlepcVecNormalize(wr,wi,PETSC_TRUE,PETSC_NULL);CHKERRQ(ierr);
ierr = QEPComputeResidualNorm_Private(qep,qep->eigr[i],qep->eigi[i],wr,wi,&rn2);CHKERRQ(ierr);
if (rn1>rn2) {
ierr = VecCopy(wr,qep->V[i]);CHKERRQ(ierr);
ierr = VecCopy(wi,qep->V[i+1]);CHKERRQ(ierr);
}
}
else if (qep->eigi[i]==0.0) /* real eigenvalue */
#endif
{
ierr = VecScatterBegin(vsV1,xr,wr,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr);
ierr = VecScatterEnd(vsV1,xr,wr,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr);
ierr = SlepcVecNormalize(wr,PETSC_NULL,PETSC_FALSE,PETSC_NULL);CHKERRQ(ierr);
ierr = QEPComputeResidualNorm_Private(qep,qep->eigr[i],qep->eigi[i],wr,PETSC_NULL,&rn1);CHKERRQ(ierr);
ierr = VecCopy(wr,qep->V[i]);CHKERRQ(ierr);
ierr = VecScatterBegin(vsV2,xr,wr,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr);
ierr = VecScatterEnd(vsV2,xr,wr,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr);
ierr = SlepcVecNormalize(wr,PETSC_NULL,PETSC_FALSE,PETSC_NULL);CHKERRQ(ierr);
ierr = QEPComputeResidualNorm_Private(qep,qep->eigr[i],qep->eigi[i],wr,PETSC_NULL,&rn2);CHKERRQ(ierr);
if (rn1>rn2) {
ierr = VecCopy(wr,qep->V[i]);CHKERRQ(ierr);
}
}
}
ierr = ISDestroy(isV1);CHKERRQ(ierr);
ierr = ISDestroy(isV2);CHKERRQ(ierr);
ierr = VecScatterDestroy(vsV1);CHKERRQ(ierr);
ierr = VecScatterDestroy(vsV2);CHKERRQ(ierr);
}
else { /* case 2: elements of x are already in the right process */
ierr = VecCreateMPIWithArray(((PetscObject)qep)->comm,qep->nloc,qep->n,PETSC_NULL,&wr);CHKERRQ(ierr);
ierr = VecCreateMPIWithArray(((PetscObject)qep)->comm,qep->nloc,qep->n,PETSC_NULL,&wi);CHKERRQ(ierr);
for (i=0;i<qep->nconv;i++) {
ierr = EPSGetEigenpair(eps,i,&qep->eigr[i],&qep->eigi[i],xr,xi);CHKERRQ(ierr);
qep->eigr[i] *= qep->sfactor;
qep->eigi[i] *= qep->sfactor;
#if !defined(PETSC_USE_COMPLEX)
if (qep->eigi[i]>0.0) { /* first eigenvalue of a complex conjugate pair */
ierr = VecGetArray(xr,&px);CHKERRQ(ierr);
ierr = VecGetArray(xi,&py);CHKERRQ(ierr);
ierr = VecPlaceArray(wr,px);CHKERRQ(ierr);
ierr = VecPlaceArray(wi,py);CHKERRQ(ierr);
ierr = SlepcVecNormalize(wr,wi,PETSC_TRUE,PETSC_NULL);CHKERRQ(ierr);
ierr = QEPComputeResidualNorm_Private(qep,qep->eigr[i],qep->eigi[i],wr,wi,&rn1);CHKERRQ(ierr);
ierr = VecCopy(wr,qep->V[i]);CHKERRQ(ierr);
ierr = VecCopy(wi,qep->V[i+1]);CHKERRQ(ierr);
ierr = VecResetArray(wr);CHKERRQ(ierr);
ierr = VecResetArray(wi);CHKERRQ(ierr);
ierr = VecPlaceArray(wr,px+qep->nloc);CHKERRQ(ierr);
ierr = VecPlaceArray(wi,py+qep->nloc);CHKERRQ(ierr);
ierr = SlepcVecNormalize(wr,wi,PETSC_TRUE,PETSC_NULL);CHKERRQ(ierr);
ierr = QEPComputeResidualNorm_Private(qep,qep->eigr[i],qep->eigi[i],wr,wi,&rn2);CHKERRQ(ierr);
if (rn1>rn2) {
ierr = VecCopy(wr,qep->V[i]);CHKERRQ(ierr);
ierr = VecCopy(wi,qep->V[i+1]);CHKERRQ(ierr);
}
ierr = VecResetArray(wr);CHKERRQ(ierr);
ierr = VecResetArray(wi);CHKERRQ(ierr);
ierr = VecRestoreArray(xr,&px);CHKERRQ(ierr);
ierr = VecRestoreArray(xi,&py);CHKERRQ(ierr);
}
else if (qep->eigi[i]==0.0) /* real eigenvalue */
#endif
{
ierr = VecGetArray(xr,&px);CHKERRQ(ierr);
ierr = VecPlaceArray(wr,px);CHKERRQ(ierr);
ierr = SlepcVecNormalize(wr,PETSC_NULL,PETSC_FALSE,PETSC_NULL);CHKERRQ(ierr);
ierr = QEPComputeResidualNorm_Private(qep,qep->eigr[i],qep->eigi[i],wr,PETSC_NULL,&rn1);CHKERRQ(ierr);
ierr = VecCopy(wr,qep->V[i]);CHKERRQ(ierr);
ierr = VecResetArray(wr);CHKERRQ(ierr);
ierr = VecPlaceArray(wr,px+qep->nloc);CHKERRQ(ierr);
ierr = SlepcVecNormalize(wr,PETSC_NULL,PETSC_FALSE,PETSC_NULL);CHKERRQ(ierr);
ierr = QEPComputeResidualNorm_Private(qep,qep->eigr[i],qep->eigi[i],wr,PETSC_NULL,&rn2);CHKERRQ(ierr);
if (rn1>rn2) {
ierr = VecCopy(wr,qep->V[i]);CHKERRQ(ierr);
}
ierr = VecResetArray(wr);CHKERRQ(ierr);
ierr = VecRestoreArray(xr,&px);CHKERRQ(ierr);
}
}
}
ierr = VecDestroy(wr);CHKERRQ(ierr);
ierr = VecDestroy(wi);CHKERRQ(ierr);
ierr = VecDestroy(xr);CHKERRQ(ierr);
ierr = VecDestroy(xi);CHKERRQ(ierr);
 
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPLinearSelect_Simple"
/*
QEPLinearSelect_Simple - Auxiliary routine that copies the solution of the
linear eigenproblem to the QEP object. The eigenvector of the generalized
problem is supposed to be
z = [ x ]
[ l*x ]
If |l|<1.0, the eigenvector is taken from z(1:n), otherwise from z(n+1:2*n).
Finally, x is normalized so that ||x||_2 = 1.
 
If explicitmatrix==PETSC_TRUE then z is partitioned across processors, otherwise x is.
*/
PetscErrorCode QEPLinearSelect_Simple(QEP qep,EPS eps,PetscTruth explicitmatrix)
{
PetscErrorCode ierr;
PetscInt i,start,end,offset,idx;
PetscScalar *px;
Vec v0,xr,xi,w;
Mat A;
IS isV1,isV2;
VecScatter vsV,vsV1,vsV2;
PetscFunctionBegin;
ierr = EPSGetOperators(eps,&A,PETSC_NULL);CHKERRQ(ierr);
ierr = MatGetVecs(A,&v0,PETSC_NULL);CHKERRQ(ierr);
ierr = VecDuplicate(v0,&xr);CHKERRQ(ierr);
ierr = VecDuplicate(v0,&xi);CHKERRQ(ierr);
 
if (explicitmatrix) { /* case 1: x needs to be scattered from the owning processes to the rest */
ierr = VecGetOwnershipRange(qep->V[0],&start,&end);CHKERRQ(ierr);
idx = start;
ierr = ISCreateBlock(((PetscObject)qep)->comm,end-start,1,&idx,&isV1);CHKERRQ(ierr);
ierr = VecScatterCreate(xr,isV1,qep->V[0],PETSC_NULL,&vsV1);CHKERRQ(ierr);
idx = start+qep->n;
ierr = ISCreateBlock(((PetscObject)qep)->comm,end-start,1,&idx,&isV2);CHKERRQ(ierr);
ierr = VecScatterCreate(xr,isV2,qep->V[0],PETSC_NULL,&vsV2);CHKERRQ(ierr);
for (i=0;i<qep->nconv;i++) {
ierr = EPSGetEigenpair(eps,i,&qep->eigr[i],&qep->eigi[i],xr,xi);CHKERRQ(ierr);
qep->eigr[i] *= qep->sfactor;
qep->eigi[i] *= qep->sfactor;
if (SlepcAbsEigenvalue(qep->eigr[i],qep->eigi[i])>1.0) vsV = vsV2;
else vsV = vsV1;
#if !defined(PETSC_USE_COMPLEX)
if (qep->eigi[i]>0.0) { /* first eigenvalue of a complex conjugate pair */
ierr = VecScatterBegin(vsV,xr,qep->V[i],INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr);
ierr = VecScatterEnd(vsV,xr,qep->V[i],INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr);
ierr = VecScatterBegin(vsV,xi,qep->V[i+1],INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr);
ierr = VecScatterEnd(vsV,xi,qep->V[i+1],INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr);
ierr = SlepcVecNormalize(qep->V[i],qep->V[i+1],PETSC_TRUE,PETSC_NULL);CHKERRQ(ierr);
}
else if (qep->eigi[i]==0.0) /* real eigenvalue */
#endif
{
ierr = VecScatterBegin(vsV,xr,qep->V[i],INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr);
ierr = VecScatterEnd(vsV,xr,qep->V[i],INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr);
ierr = SlepcVecNormalize(qep->V[i],PETSC_NULL,PETSC_FALSE,PETSC_NULL);CHKERRQ(ierr);
}
}
ierr = ISDestroy(isV1);CHKERRQ(ierr);
ierr = ISDestroy(isV2);CHKERRQ(ierr);
ierr = VecScatterDestroy(vsV1);CHKERRQ(ierr);
ierr = VecScatterDestroy(vsV2);CHKERRQ(ierr);
}
else { /* case 2: elements of x are already in the right process */
ierr = VecCreateMPIWithArray(((PetscObject)qep)->comm,qep->nloc,qep->n,PETSC_NULL,&w);CHKERRQ(ierr);
for (i=0;i<qep->nconv;i++) {
ierr = EPSGetEigenpair(eps,i,&qep->eigr[i],&qep->eigi[i],xr,xi);CHKERRQ(ierr);
qep->eigr[i] *= qep->sfactor;
qep->eigi[i] *= qep->sfactor;
if (SlepcAbsEigenvalue(qep->eigr[i],qep->eigi[i])>1.0) offset = qep->nloc;
else offset = 0;
#if !defined(PETSC_USE_COMPLEX)
if (qep->eigi[i]>0.0) { /* first eigenvalue of a complex conjugate pair */
ierr = VecGetArray(xr,&px);CHKERRQ(ierr);
ierr = VecPlaceArray(w,px+offset);CHKERRQ(ierr);
ierr = VecCopy(w,qep->V[i]);CHKERRQ(ierr);
ierr = VecResetArray(w);CHKERRQ(ierr);
ierr = VecRestoreArray(xr,&px);CHKERRQ(ierr);
ierr = VecGetArray(xi,&px);CHKERRQ(ierr);
ierr = VecPlaceArray(w,px+offset);CHKERRQ(ierr);
ierr = VecCopy(w,qep->V[i+1]);CHKERRQ(ierr);
ierr = VecResetArray(w);CHKERRQ(ierr);
ierr = VecRestoreArray(xi,&px);CHKERRQ(ierr);
ierr = SlepcVecNormalize(qep->V[i],qep->V[i+1],PETSC_TRUE,PETSC_NULL);CHKERRQ(ierr);
}
else if (qep->eigi[i]==0.0) /* real eigenvalue */
#endif
{
ierr = VecGetArray(xr,&px);CHKERRQ(ierr);
ierr = VecPlaceArray(w,px+offset);CHKERRQ(ierr);
ierr = VecCopy(w,qep->V[i]);CHKERRQ(ierr);
ierr = VecResetArray(w);CHKERRQ(ierr);
ierr = VecRestoreArray(xr,&px);CHKERRQ(ierr);
ierr = SlepcVecNormalize(qep->V[i],PETSC_NULL,PETSC_FALSE,PETSC_NULL);CHKERRQ(ierr);
}
}
ierr = VecDestroy(w);CHKERRQ(ierr);
}
ierr = VecDestroy(xr);CHKERRQ(ierr);
ierr = VecDestroy(xi);CHKERRQ(ierr);
 
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPSolve_LINEAR"
PetscErrorCode QEPSolve_LINEAR(QEP qep)
{
PetscErrorCode ierr;
QEP_LINEAR *ctx = (QEP_LINEAR *)qep->data;
PetscTruth flg=PETSC_FALSE;
 
PetscFunctionBegin;
ierr = EPSSolve(ctx->eps);CHKERRQ(ierr);
ierr = EPSGetConverged(ctx->eps,&qep->nconv);CHKERRQ(ierr);
ierr = EPSGetIterationNumber(ctx->eps,&qep->its);CHKERRQ(ierr);
ierr = EPSGetConvergedReason(ctx->eps,(EPSConvergedReason*)&qep->reason);CHKERRQ(ierr);
ierr = EPSGetOperationCounters(ctx->eps,&qep->matvecs,PETSC_NULL,&qep->linits);CHKERRQ(ierr);
qep->matvecs *= 2; /* convention: count one matvec for each non-trivial block in A */
ierr = PetscOptionsGetTruth(((PetscObject)qep)->prefix,"-qep_linear_select_simple",&flg,PETSC_NULL);CHKERRQ(ierr);
if (flg) {
ierr = QEPLinearSelect_Simple(qep,ctx->eps,ctx->explicitmatrix);CHKERRQ(ierr);
} else {
ierr = QEPLinearSelect_Norm(qep,ctx->eps,ctx->explicitmatrix);CHKERRQ(ierr);
}
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "EPSMonitor_QEP_LINEAR"
PetscErrorCode EPSMonitor_QEP_LINEAR(EPS eps,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *ctx)
{
PetscInt i;
QEP qep = (QEP)ctx;
PetscErrorCode ierr;
 
PetscFunctionBegin;
nconv = 0;
for (i=0;i<nest;i++) {
qep->eigr[i] = eigr[i];
qep->eigi[i] = eigi[i];
qep->errest[i] = errest[i];
if (0.0 < errest[i] && errest[i] < qep->tol) nconv++;
}
ierr = STBackTransform(eps->OP,nest,qep->eigr,qep->eigi);CHKERRQ(ierr);
QEPMonitor(qep,its,nconv,qep->eigr,qep->eigi,qep->errest,nest);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPSetFromOptions_LINEAR"
PetscErrorCode QEPSetFromOptions_LINEAR(QEP qep)
{
PetscErrorCode ierr;
PetscTruth set,val;
PetscInt i;
QEP_LINEAR *ctx = (QEP_LINEAR *)qep->data;
ST st;
 
PetscFunctionBegin;
ierr = PetscOptionsBegin(((PetscObject)qep)->comm,((PetscObject)qep)->prefix,"LINEAR Quadratic Eigenvalue Problem solver Options","QEP");CHKERRQ(ierr);
 
ierr = PetscOptionsInt("-qep_linear_cform","Number of the companion form","QEPLinearSetCompanionForm",ctx->cform,&i,&set);CHKERRQ(ierr);
if (set) {
ierr = QEPLinearSetCompanionForm(qep,i);CHKERRQ(ierr);
}
 
ierr = PetscOptionsTruth("-qep_linear_explicitmatrix","Use explicit matrix in linearization","QEPLinearSetExplicitMatrix",ctx->explicitmatrix,&val,&set);CHKERRQ(ierr);
if (set) {
ierr = QEPLinearSetExplicitMatrix(qep,val);CHKERRQ(ierr);
}
if (!ctx->explicitmatrix) {
/* use as default an ST with shell matrix and Jacobi */
ierr = EPSGetST(ctx->eps,&st);CHKERRQ(ierr);
ierr = STSetMatMode(st,ST_MATMODE_SHELL);CHKERRQ(ierr);
}
 
ierr = PetscOptionsEnd();CHKERRQ(ierr);
ctx->setfromoptionscalled = PETSC_TRUE;
PetscFunctionReturn(0);
}
 
EXTERN_C_BEGIN
#undef __FUNCT__
#define __FUNCT__ "QEPLinearSetCompanionForm_LINEAR"
PetscErrorCode QEPLinearSetCompanionForm_LINEAR(QEP qep,PetscInt cform)
{
QEP_LINEAR *ctx = (QEP_LINEAR *)qep->data;
 
PetscFunctionBegin;
if (cform==PETSC_IGNORE) PetscFunctionReturn(0);
if (cform==PETSC_DECIDE || cform==PETSC_DEFAULT) ctx->cform = 1;
else {
if (cform!=1 && cform!=2) SETERRQ(PETSC_ERR_ARG_OUTOFRANGE,"Invalid value of argument 'cform'");
ctx->cform = cform;
}
PetscFunctionReturn(0);
}
EXTERN_C_END
 
#undef __FUNCT__
#define __FUNCT__ "QEPLinearSetCompanionForm"
/*@
QEPLinearSetCompanionForm - Choose between the two companion forms available
for the linearization of the quadratic problem.
 
Collective on QEP
 
Input Parameters:
+ qep - quadratic eigenvalue solver
- cform - 1 or 2 (first or second companion form)
 
Options Database Key:
. -qep_linear_cform <int> - Choose the companion form
 
Level: advanced
 
.seealso: QEPLinearGetCompanionForm()
@*/
PetscErrorCode QEPLinearSetCompanionForm(QEP qep,PetscInt cform)
{
PetscErrorCode ierr, (*f)(QEP,PetscInt);
 
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
ierr = PetscObjectQueryFunction((PetscObject)qep,"QEPLinearSetCompanionForm_C",(void (**)())&f);CHKERRQ(ierr);
if (f) {
ierr = (*f)(qep,cform);CHKERRQ(ierr);
}
PetscFunctionReturn(0);
}
 
EXTERN_C_BEGIN
#undef __FUNCT__
#define __FUNCT__ "QEPLinearGetCompanionForm_LINEAR"
PetscErrorCode QEPLinearGetCompanionForm_LINEAR(QEP qep,PetscInt *cform)
{
QEP_LINEAR *ctx = (QEP_LINEAR *)qep->data;
 
PetscFunctionBegin;
PetscValidPointer(cform,2);
*cform = ctx->cform;
PetscFunctionReturn(0);
}
EXTERN_C_END
 
#undef __FUNCT__
#define __FUNCT__ "QEPLinearGetCompanionForm"
/*@
QEPLinearGetCompanionForm - Returns the number of the companion form that
will be used for the linearization of the quadratic problem.
 
Not collective
 
Input Parameter:
. qep - quadratic eigenvalue solver
 
Output Parameter:
. cform - the companion form number (1 or 2)
 
Level: advanced
 
.seealso: QEPLinearSetCompanionForm()
@*/
PetscErrorCode QEPLinearGetCompanionForm(QEP qep,PetscInt *cform)
{
PetscErrorCode ierr, (*f)(QEP,PetscInt*);
 
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
ierr = PetscObjectQueryFunction((PetscObject)qep,"QEPLinearGetCompanionForm_C",(void (**)())&f);CHKERRQ(ierr);
if (f) {
ierr = (*f)(qep,cform);CHKERRQ(ierr);
}
PetscFunctionReturn(0);
}
 
EXTERN_C_BEGIN
#undef __FUNCT__
#define __FUNCT__ "QEPLinearSetExplicitMatrix_LINEAR"
PetscErrorCode QEPLinearSetExplicitMatrix_LINEAR(QEP qep,PetscTruth explicitmatrix)
{
QEP_LINEAR *ctx = (QEP_LINEAR *)qep->data;
 
PetscFunctionBegin;
ctx->explicitmatrix = explicitmatrix;
PetscFunctionReturn(0);
}
EXTERN_C_END
 
#undef __FUNCT__
#define __FUNCT__ "QEPLinearSetExplicitMatrix"
/*@
QEPLinearSetExplicitMatrix - Indicate if the matrices A and B for the linearization
of the quadratic problem must be built explicitly.
 
Collective on QEP
 
Input Parameters:
+ qep - quadratic eigenvalue solver
- explicit - boolean flag indicating if the matrices are built explicitly
 
Options Database Key:
. -qep_linear_explicitmatrix <boolean> - Indicates the boolean flag
 
Level: advanced
 
.seealso: QEPLinearGetExplicitMatrix()
@*/
PetscErrorCode QEPLinearSetExplicitMatrix(QEP qep,PetscTruth explicitmatrix)
{
PetscErrorCode ierr, (*f)(QEP,PetscTruth);
 
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
ierr = PetscObjectQueryFunction((PetscObject)qep,"QEPLinearSetExplicitMatrix_C",(void (**)())&f);CHKERRQ(ierr);
if (f) {
ierr = (*f)(qep,explicitmatrix);CHKERRQ(ierr);
}
PetscFunctionReturn(0);
}
 
EXTERN_C_BEGIN
#undef __FUNCT__
#define __FUNCT__ "QEPLinearGetExplicitMatrix_LINEAR"
PetscErrorCode QEPLinearGetExplicitMatrix_LINEAR(QEP qep,PetscTruth *explicitmatrix)
{
QEP_LINEAR *ctx = (QEP_LINEAR *)qep->data;
 
PetscFunctionBegin;
PetscValidPointer(explicitmatrix,2);
*explicitmatrix = ctx->explicitmatrix;
PetscFunctionReturn(0);
}
EXTERN_C_END
 
#undef __FUNCT__
#define __FUNCT__ "QEPLinearGetExplicitMatrix"
/*@
QEPLinearGetExplicitMatrix - Returns the flag indicating if the matrices A and B
for the linearization of the quadratic problem are built explicitly.
 
Not collective
 
Input Parameter:
. qep - quadratic eigenvalue solver
 
Output Parameter:
. explicitmatrix - the mode flag
 
Level: advanced
 
.seealso: QEPLinearSetExplicitMatrix()
@*/
PetscErrorCode QEPLinearGetExplicitMatrix(QEP qep,PetscTruth *explicitmatrix)
{
PetscErrorCode ierr, (*f)(QEP,PetscTruth*);
 
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
ierr = PetscObjectQueryFunction((PetscObject)qep,"QEPLinearGetExplicitMatrix_C",(void (**)())&f);CHKERRQ(ierr);
if (f) {
ierr = (*f)(qep,explicitmatrix);CHKERRQ(ierr);
}
PetscFunctionReturn(0);
}
 
EXTERN_C_BEGIN
#undef __FUNCT__
#define __FUNCT__ "QEPLinearSetEPS_LINEAR"
PetscErrorCode QEPLinearSetEPS_LINEAR(QEP qep,EPS eps)
{
PetscErrorCode ierr;
QEP_LINEAR *ctx = (QEP_LINEAR *)qep->data;
 
PetscFunctionBegin;
PetscValidHeaderSpecific(eps,EPS_COOKIE,2);
PetscCheckSameComm(qep,1,eps,2);
ierr = PetscObjectReference((PetscObject)eps);CHKERRQ(ierr);
ierr = EPSDestroy(ctx->eps);CHKERRQ(ierr);
ctx->eps = eps;
qep->setupcalled = 0;
PetscFunctionReturn(0);
}
EXTERN_C_END
 
#undef __FUNCT__
#define __FUNCT__ "QEPLinearSetEPS"
/*@
QEPLinearSetEPS - Associate an eigensolver object (EPS) to the
quadratic eigenvalue solver.
 
Collective on QEP
 
Input Parameters:
+ qep - quadratic eigenvalue solver
- eps - the eigensolver object
 
Level: advanced
 
.seealso: QEPLinearGetEPS()
@*/
PetscErrorCode QEPLinearSetEPS(QEP qep,EPS eps)
{
PetscErrorCode ierr, (*f)(QEP,EPS);
 
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
ierr = PetscObjectQueryFunction((PetscObject)qep,"QEPLinearSetEPS_C",(void (**)())&f);CHKERRQ(ierr);
if (f) {
ierr = (*f)(qep,eps);CHKERRQ(ierr);
}
PetscFunctionReturn(0);
}
 
EXTERN_C_BEGIN
#undef __FUNCT__
#define __FUNCT__ "QEPLinearGetEPS_LINEAR"
PetscErrorCode QEPLinearGetEPS_LINEAR(QEP qep,EPS *eps)
{
QEP_LINEAR *ctx = (QEP_LINEAR *)qep->data;
 
PetscFunctionBegin;
PetscValidPointer(eps,2);
*eps = ctx->eps;
PetscFunctionReturn(0);
}
EXTERN_C_END
 
#undef __FUNCT__
#define __FUNCT__ "QEPLinearGetEPS"
/*@
QEPLinearGetEPS - Retrieve the eigensolver object (EPS) associated
to the quadratic eigenvalue solver.
 
Not Collective
 
Input Parameter:
. qep - quadratic eigenvalue solver
 
Output Parameter:
. eps - the eigensolver object
 
Level: advanced
 
.seealso: QEPLinearSetEPS()
@*/
PetscErrorCode QEPLinearGetEPS(QEP qep,EPS *eps)
{
PetscErrorCode ierr, (*f)(QEP,EPS*);
 
PetscFunctionBegin;
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
ierr = PetscObjectQueryFunction((PetscObject)qep,"QEPLinearGetEPS_C",(void (**)())&f);CHKERRQ(ierr);
if (f) {
ierr = (*f)(qep,eps);CHKERRQ(ierr);
}
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPView_LINEAR"
PetscErrorCode QEPView_LINEAR(QEP qep,PetscViewer viewer)
{
PetscErrorCode ierr;
QEP_LINEAR *ctx = (QEP_LINEAR *)qep->data;
 
PetscFunctionBegin;
if (ctx->explicitmatrix) {
ierr = PetscViewerASCIIPrintf(viewer,"linearized matrices: explicit\n");CHKERRQ(ierr);
} else {
ierr = PetscViewerASCIIPrintf(viewer,"linearized matrices: implicit\n");CHKERRQ(ierr);
}
ierr = PetscViewerASCIIPrintf(viewer,"companion form: %d\n",ctx->cform);CHKERRQ(ierr);
ierr = EPSView(ctx->eps,viewer);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "QEPDestroy_LINEAR"
PetscErrorCode QEPDestroy_LINEAR(QEP qep)
{
PetscErrorCode ierr;
QEP_LINEAR *ctx = (QEP_LINEAR *)qep->data;
 
PetscFunctionBegin;
ierr = EPSDestroy(ctx->eps);CHKERRQ(ierr);
if (ctx->A) {
ierr = MatDestroy(ctx->A);CHKERRQ(ierr);
ierr = MatDestroy(ctx->B);CHKERRQ(ierr);
}
if (ctx->x1) {
ierr = VecDestroy(ctx->x1);CHKERRQ(ierr);
ierr = VecDestroy(ctx->x2);CHKERRQ(ierr);
ierr = VecDestroy(ctx->y1);CHKERRQ(ierr);
ierr = VecDestroy(ctx->y2);CHKERRQ(ierr);
}
 
ierr = PetscObjectComposeFunctionDynamic((PetscObject)qep,"QEPLinearSetCompanionForm_C","",PETSC_NULL);CHKERRQ(ierr);
ierr = PetscObjectComposeFunctionDynamic((PetscObject)qep,"QEPLinearGetCompanionForm_C","",PETSC_NULL);CHKERRQ(ierr);
ierr = PetscObjectComposeFunctionDynamic((PetscObject)qep,"QEPLinearSetEPS_C","",PETSC_NULL);CHKERRQ(ierr);
ierr = PetscObjectComposeFunctionDynamic((PetscObject)qep,"QEPLinearGetEPS_C","",PETSC_NULL);CHKERRQ(ierr);
ierr = PetscObjectComposeFunctionDynamic((PetscObject)qep,"QEPLinearSetExplicitMatrix_C","",PETSC_NULL);CHKERRQ(ierr);
ierr = PetscObjectComposeFunctionDynamic((PetscObject)qep,"QEPLinearGetExplicitMatrix_C","",PETSC_NULL);CHKERRQ(ierr);
 
ierr = QEPDestroy_Default(qep);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
EXTERN_C_BEGIN
#undef __FUNCT__
#define __FUNCT__ "QEPCreate_LINEAR"
PetscErrorCode QEPCreate_LINEAR(QEP qep)
{
PetscErrorCode ierr;
QEP_LINEAR *ctx;
 
PetscFunctionBegin;
ierr = PetscNew(QEP_LINEAR,&ctx);CHKERRQ(ierr);
PetscLogObjectMemory(qep,sizeof(QEP_LINEAR));
qep->data = (void *)ctx;
qep->ops->solve = QEPSolve_LINEAR;
qep->ops->setup = QEPSetUp_LINEAR;
qep->ops->setfromoptions = QEPSetFromOptions_LINEAR;
qep->ops->destroy = QEPDestroy_LINEAR;
qep->ops->view = QEPView_LINEAR;
ierr = PetscObjectComposeFunctionDynamic((PetscObject)qep,"QEPLinearSetCompanionForm_C","QEPLinearSetCompanionForm_LINEAR",QEPLinearSetCompanionForm_LINEAR);CHKERRQ(ierr);
ierr = PetscObjectComposeFunctionDynamic((PetscObject)qep,"QEPLinearGetCompanionForm_C","QEPLinearGetCompanionForm_LINEAR",QEPLinearGetCompanionForm_LINEAR);CHKERRQ(ierr);
ierr = PetscObjectComposeFunctionDynamic((PetscObject)qep,"QEPLinearSetEPS_C","QEPLinearSetEPS_LINEAR",QEPLinearSetEPS_LINEAR);CHKERRQ(ierr);
ierr = PetscObjectComposeFunctionDynamic((PetscObject)qep,"QEPLinearGetEPS_C","QEPLinearGetEPS_LINEAR",QEPLinearGetEPS_LINEAR);CHKERRQ(ierr);
ierr = PetscObjectComposeFunctionDynamic((PetscObject)qep,"QEPLinearSetExplicitMatrix_C","QEPLinearSetExplicitMatrix_LINEAR",QEPLinearSetExplicitMatrix_LINEAR);CHKERRQ(ierr);
ierr = PetscObjectComposeFunctionDynamic((PetscObject)qep,"QEPLinearGetExplicitMatrix_C","QEPLinearGetExplicitMatrix_LINEAR",QEPLinearGetExplicitMatrix_LINEAR);CHKERRQ(ierr);
 
ierr = EPSCreate(((PetscObject)qep)->comm,&ctx->eps);CHKERRQ(ierr);
ierr = EPSSetOptionsPrefix(ctx->eps,((PetscObject)qep)->prefix);CHKERRQ(ierr);
ierr = EPSAppendOptionsPrefix(ctx->eps,"qep_");CHKERRQ(ierr);
ierr = PetscObjectIncrementTabLevel((PetscObject)ctx->eps,(PetscObject)qep,1);CHKERRQ(ierr);
PetscLogObjectParent(qep,ctx->eps);
ierr = EPSSetIP(ctx->eps,qep->ip);CHKERRQ(ierr);
ierr = EPSMonitorSet(ctx->eps,EPSMonitor_QEP_LINEAR,qep,PETSC_NULL);CHKERRQ(ierr);
ctx->explicitmatrix = PETSC_FALSE;
ctx->cform = 1;
ctx->A = PETSC_NULL;
ctx->B = PETSC_NULL;
ctx->x1 = PETSC_NULL;
ctx->x2 = PETSC_NULL;
ctx->y1 = PETSC_NULL;
ctx->y2 = PETSC_NULL;
ctx->setfromoptionscalled = PETSC_FALSE;
PetscFunctionReturn(0);
}
EXTERN_C_END
 
/tags/slepc-3_1-2/src/qep/impls/linear/qeplin_s1.c New file
0,0 → 1,240
/*
 
Linearization for Hermitian QEP, companion form 1.
 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SLEPc - Scalable Library for Eigenvalue Problem Computations
Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
 
This file is part of SLEPc.
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/>.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
 
#include "private/qepimpl.h" /*I "slepcqep.h" I*/
#include "slepceps.h"
#include "linearp.h"
 
/*
Given the quadratic problem (l^2*M + l*C + K)*x = 0 the following
linearization is employed:
 
A*z = l*B*z where A = [ 0 -K ] B = [-K 0 ] z = [ x ]
[ -K -C ] [ 0 M ] [ l*x ]
*/
 
#undef __FUNCT__
#define __FUNCT__ "MatMult_QEPLINEAR_S1A"
PetscErrorCode MatMult_QEPLINEAR_S1A(Mat A,Vec x,Vec y)
{
PetscErrorCode ierr;
QEP_LINEAR *ctx;
PetscScalar *px,*py;
PetscInt m;
PetscFunctionBegin;
ierr = MatShellGetContext(A,(void**)&ctx);CHKERRQ(ierr);
ierr = MatGetLocalSize(ctx->M,&m,PETSC_NULL);CHKERRQ(ierr);
ierr = VecGetArray(x,&px);CHKERRQ(ierr);
ierr = VecGetArray(y,&py);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x1,px);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x2,px+m);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->y1,py);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->y2,py+m);CHKERRQ(ierr);
/* y2 = -(K*x1 + C*x2) */
ierr = MatMult(ctx->K,ctx->x1,ctx->y2);CHKERRQ(ierr);
ierr = VecScale(ctx->y2,-1.0);CHKERRQ(ierr);
ierr = MatMult(ctx->C,ctx->x2,ctx->y1);CHKERRQ(ierr);
ierr = VecAXPY(ctx->y2,-ctx->sfactor,ctx->y1);CHKERRQ(ierr);
/* y1 = -K*x2 */
ierr = MatMult(ctx->K,ctx->x2,ctx->y1);CHKERRQ(ierr);
ierr = VecScale(ctx->y1,-1.0);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x1);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x2);CHKERRQ(ierr);
ierr = VecResetArray(ctx->y1);CHKERRQ(ierr);
ierr = VecResetArray(ctx->y2);CHKERRQ(ierr);
ierr = VecRestoreArray(x,&px);CHKERRQ(ierr);
ierr = VecRestoreArray(y,&py);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "MatMult_QEPLINEAR_S1B"
PetscErrorCode MatMult_QEPLINEAR_S1B(Mat B,Vec x,Vec y)
{
PetscErrorCode ierr;
QEP_LINEAR *ctx;
PetscScalar *px,*py;
PetscInt m;
PetscFunctionBegin;
ierr = MatShellGetContext(B,(void**)&ctx);CHKERRQ(ierr);
ierr = MatGetLocalSize(ctx->M,&m,PETSC_NULL);CHKERRQ(ierr);
ierr = VecGetArray(x,&px);CHKERRQ(ierr);
ierr = VecGetArray(y,&py);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x1,px);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x2,px+m);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->y1,py);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->y2,py+m);CHKERRQ(ierr);
/* y1 = -K*x1 */
ierr = MatMult(ctx->K,ctx->x1,ctx->y1);CHKERRQ(ierr);
ierr = VecScale(ctx->y1,-1.0);CHKERRQ(ierr);
/* y2 = M*x2 */
ierr = MatMult(ctx->M,ctx->x2,ctx->y2);CHKERRQ(ierr);
ierr = VecScale(ctx->y2,ctx->sfactor*ctx->sfactor);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x1);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x2);CHKERRQ(ierr);
ierr = VecResetArray(ctx->y1);CHKERRQ(ierr);
ierr = VecResetArray(ctx->y2);CHKERRQ(ierr);
ierr = VecRestoreArray(x,&px);CHKERRQ(ierr);
ierr = VecRestoreArray(y,&py);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "MatGetDiagonal_QEPLINEAR_S1A"
PetscErrorCode MatGetDiagonal_QEPLINEAR_S1A(Mat A,Vec diag)
{
PetscErrorCode ierr;
QEP_LINEAR *ctx;
PetscScalar *pd;
PetscInt m;
PetscFunctionBegin;
ierr = MatShellGetContext(A,(void**)&ctx);CHKERRQ(ierr);
ierr = MatGetLocalSize(ctx->M,&m,PETSC_NULL);CHKERRQ(ierr);
ierr = VecGetArray(diag,&pd);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x1,pd);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x2,pd+m);CHKERRQ(ierr);
ierr = VecSet(ctx->x1,0.0);CHKERRQ(ierr);
ierr = MatGetDiagonal(ctx->C,ctx->x2);CHKERRQ(ierr);
ierr = VecScale(ctx->x2,-ctx->sfactor);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x1);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x2);CHKERRQ(ierr);
ierr = VecRestoreArray(diag,&pd);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "MatGetDiagonal_QEPLINEAR_S1B"
PetscErrorCode MatGetDiagonal_QEPLINEAR_S1B(Mat B,Vec diag)
{
PetscErrorCode ierr;
QEP_LINEAR *ctx;
PetscScalar *pd;
PetscInt m;
PetscFunctionBegin;
ierr = MatShellGetContext(B,(void**)&ctx);CHKERRQ(ierr);
ierr = MatGetLocalSize(ctx->M,&m,PETSC_NULL);CHKERRQ(ierr);
ierr = VecGetArray(diag,&pd);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x1,pd);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x2,pd+m);CHKERRQ(ierr);
ierr = MatGetDiagonal(ctx->K,ctx->x1);CHKERRQ(ierr);
ierr = VecScale(ctx->x1,-1.0);CHKERRQ(ierr);
ierr = MatGetDiagonal(ctx->M,ctx->x2);CHKERRQ(ierr);
ierr = VecScale(ctx->x2,ctx->sfactor*ctx->sfactor);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x1);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x2);CHKERRQ(ierr);
ierr = VecRestoreArray(diag,&pd);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "MatCreateExplicit_QEPLINEAR_S1A"
PetscErrorCode MatCreateExplicit_QEPLINEAR_S1A(MPI_Comm comm,QEP_LINEAR *ctx,Mat *A)
{
PetscErrorCode ierr;
PetscInt M,N,m,n,i,j,row,start,end,ncols,*pos;
PetscScalar *svals;
const PetscInt *cols;
const PetscScalar *vals;
PetscFunctionBegin;
ierr = MatGetSize(ctx->M,&M,&N);CHKERRQ(ierr);
ierr = MatGetLocalSize(ctx->M,&m,&n);CHKERRQ(ierr);
ierr = MatCreate(comm,A);CHKERRQ(ierr);
ierr = MatSetSizes(*A,m+n,m+n,M+N,M+N);CHKERRQ(ierr);
ierr = MatSetFromOptions(*A);CHKERRQ(ierr);
ierr = PetscMalloc(sizeof(PetscInt)*n,&pos);CHKERRQ(ierr);
ierr = PetscMalloc(sizeof(PetscScalar)*n,&svals);CHKERRQ(ierr);
ierr = MatGetOwnershipRange(ctx->M,&start,&end);CHKERRQ(ierr);
for (i=start;i<end;i++) {
row = i + M;
ierr = MatGetRow(ctx->K,i,&ncols,&cols,&vals);CHKERRQ(ierr);
ierr = MatSetValues(*A,1,&row,ncols,cols,vals,INSERT_VALUES);CHKERRQ(ierr);
for (j=0;j<ncols;j++)
pos[j] = cols[j] + M;
ierr = MatSetValues(*A,1,&i,ncols,pos,vals,INSERT_VALUES);CHKERRQ(ierr);
ierr = MatRestoreRow(ctx->K,i,&ncols,&cols,&vals);CHKERRQ(ierr);
ierr = MatGetRow(ctx->C,i,&ncols,&cols,&vals);CHKERRQ(ierr);
for (j=0;j<ncols;j++) {
pos[j] = cols[j] + M;
svals[j] = vals[j]*ctx->sfactor;
}
ierr = MatSetValues(*A,1,&row,ncols,pos,svals,INSERT_VALUES);CHKERRQ(ierr);
ierr = MatRestoreRow(ctx->C,i,&ncols,&cols,&vals);CHKERRQ(ierr);
}
ierr = PetscFree(pos);CHKERRQ(ierr);
ierr = PetscFree(svals);CHKERRQ(ierr);
ierr = MatAssemblyBegin(*A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
ierr = MatAssemblyEnd(*A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
ierr = MatScale(*A,-1.0);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "MatCreateExplicit_QEPLINEAR_S1B"
PetscErrorCode MatCreateExplicit_QEPLINEAR_S1B(MPI_Comm comm,QEP_LINEAR *ctx,Mat *B)
{
PetscErrorCode ierr;
PetscInt M,N,m,n,i,j,row,start,end,ncols,*pos;
PetscScalar *svals;
const PetscInt *cols;
const PetscScalar *vals;
PetscFunctionBegin;
ierr = MatGetSize(ctx->M,&M,&N);CHKERRQ(ierr);
ierr = MatGetLocalSize(ctx->M,&m,&n);CHKERRQ(ierr);
ierr = MatCreate(comm,B);CHKERRQ(ierr);
ierr = MatSetSizes(*B,m+n,m+n,M+N,M+N);CHKERRQ(ierr);
ierr = MatSetFromOptions(*B);CHKERRQ(ierr);
ierr = PetscMalloc(sizeof(PetscInt)*n,&pos);CHKERRQ(ierr);
ierr = PetscMalloc(sizeof(PetscScalar)*n,&svals);CHKERRQ(ierr);
ierr = MatGetOwnershipRange(ctx->M,&start,&end);CHKERRQ(ierr);
for (i=start;i<end;i++) {
ierr = MatGetRow(ctx->K,i,&ncols,&cols,&vals);CHKERRQ(ierr);
ierr = MatSetValues(*B,1,&i,ncols,cols,vals,INSERT_VALUES);CHKERRQ(ierr);
ierr = MatRestoreRow(ctx->K,i,&ncols,&cols,&vals);CHKERRQ(ierr);
}
ierr = MatAssemblyBegin(*B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
ierr = MatAssemblyEnd(*B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
ierr = MatScale(*B,-1.0);CHKERRQ(ierr);
for (i=start;i<end;i++) {
row = i + M;
ierr = MatGetRow(ctx->M,i,&ncols,&cols,&vals);CHKERRQ(ierr);
for (j=0;j<ncols;j++) {
pos[j] = cols[j] + M;
svals[j] = vals[j]*ctx->sfactor*ctx->sfactor;
}
ierr = MatSetValues(*B,1,&row,ncols,pos,svals,INSERT_VALUES);CHKERRQ(ierr);
ierr = MatRestoreRow(ctx->M,i,&ncols,&cols,&vals);CHKERRQ(ierr);
}
ierr = MatAssemblyBegin(*B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
ierr = MatAssemblyEnd(*B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
ierr = PetscFree(pos);CHKERRQ(ierr);
ierr = PetscFree(svals);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
/tags/slepc-3_1-2/src/qep/impls/linear/makefile New file
0,0 → 1,37
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# SLEPc - Scalable Library for Eigenvalue Problem Computations
# Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
#
# This file is part of SLEPc.
#
# 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/>.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
 
ALL: lib
 
CFLAGS =
FFLAGS =
SOURCEC = linear.c qeplin_n1.c qeplin_n2.c qeplin_s1.c qeplin_s2.c qeplin_h1.c qeplin_h2.c
SOURCEF =
SOURCEH = linearp.h
OBJSC = linear.o qeplin_n1.o qeplin_n2.o qeplin_s1.o qeplin_s2.o qeplin_h1.o qeplin_h2.o
LIBBASE = libslepc
DIRS =
MANSEC = QEP
LOCDIR = src/qep/impls/linear/
 
include ${SLEPC_DIR}/conf/slepc_common
 
 
/tags/slepc-3_1-2/src/qep/impls/linear/qeplin_s2.c New file
0,0 → 1,240
/*
 
Linearization for Hermitian QEP, companion form 2.
 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SLEPc - Scalable Library for Eigenvalue Problem Computations
Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
 
This file is part of SLEPc.
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/>.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
 
#include "private/qepimpl.h" /*I "slepcqep.h" I*/
#include "slepceps.h"
#include "linearp.h"
 
/*
Given the quadratic problem (l^2*M + l*C + K)*x = 0 the following
linearization is employed:
 
A*z = l*B*z where A = [ -K 0 ] B = [ C M ] z = [ x ]
[ 0 M ] [ M 0 ] [ l*x ]
*/
 
#undef __FUNCT__
#define __FUNCT__ "MatMult_QEPLINEAR_S2A"
PetscErrorCode MatMult_QEPLINEAR_S2A(Mat A,Vec x,Vec y)
{
PetscErrorCode ierr;
QEP_LINEAR *ctx;
PetscScalar *px,*py;
PetscInt m;
PetscFunctionBegin;
ierr = MatShellGetContext(A,(void**)&ctx);CHKERRQ(ierr);
ierr = MatGetLocalSize(ctx->M,&m,PETSC_NULL);CHKERRQ(ierr);
ierr = VecGetArray(x,&px);CHKERRQ(ierr);
ierr = VecGetArray(y,&py);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x1,px);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x2,px+m);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->y1,py);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->y2,py+m);CHKERRQ(ierr);
/* y1 = -K*x1 */
ierr = MatMult(ctx->K,ctx->x1,ctx->y1);CHKERRQ(ierr);
ierr = VecScale(ctx->y1,-1.0);CHKERRQ(ierr);
/* y2 = M*x2 */
ierr = MatMult(ctx->M,ctx->x2,ctx->y2);CHKERRQ(ierr);
ierr = VecScale(ctx->y2,ctx->sfactor*ctx->sfactor);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x1);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x2);CHKERRQ(ierr);
ierr = VecResetArray(ctx->y1);CHKERRQ(ierr);
ierr = VecResetArray(ctx->y2);CHKERRQ(ierr);
ierr = VecRestoreArray(x,&px);CHKERRQ(ierr);
ierr = VecRestoreArray(y,&py);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "MatMult_QEPLINEAR_S2B"
PetscErrorCode MatMult_QEPLINEAR_S2B(Mat B,Vec x,Vec y)
{
PetscErrorCode ierr;
QEP_LINEAR *ctx;
PetscScalar *px,*py;
PetscInt m;
PetscFunctionBegin;
ierr = MatShellGetContext(B,(void**)&ctx);CHKERRQ(ierr);
ierr = MatGetLocalSize(ctx->M,&m,PETSC_NULL);CHKERRQ(ierr);
ierr = VecGetArray(x,&px);CHKERRQ(ierr);
ierr = VecGetArray(y,&py);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x1,px);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x2,px+m);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->y1,py);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->y2,py+m);CHKERRQ(ierr);
/* y1 = C*x1 + M*x2 */
ierr = MatMult(ctx->C,ctx->x1,ctx->y1);CHKERRQ(ierr);
ierr = VecScale(ctx->y1,ctx->sfactor);CHKERRQ(ierr);
ierr = MatMult(ctx->M,ctx->x2,ctx->y2);CHKERRQ(ierr);
ierr = VecAXPY(ctx->y1,ctx->sfactor*ctx->sfactor,ctx->y2);CHKERRQ(ierr);
/* y2 = M*x1 */
ierr = MatMult(ctx->M,ctx->x1,ctx->y2);CHKERRQ(ierr);
ierr = VecScale(ctx->y2,ctx->sfactor*ctx->sfactor);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x1);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x2);CHKERRQ(ierr);
ierr = VecResetArray(ctx->y1);CHKERRQ(ierr);
ierr = VecResetArray(ctx->y2);CHKERRQ(ierr);
ierr = VecRestoreArray(x,&px);CHKERRQ(ierr);
ierr = VecRestoreArray(y,&py);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "MatGetDiagonal_QEPLINEAR_S2A"
PetscErrorCode MatGetDiagonal_QEPLINEAR_S2A(Mat A,Vec diag)
{
PetscErrorCode ierr;
QEP_LINEAR *ctx;
PetscScalar *pd;
PetscInt m;
PetscFunctionBegin;
ierr = MatShellGetContext(A,(void**)&ctx);CHKERRQ(ierr);
ierr = MatGetLocalSize(ctx->M,&m,PETSC_NULL);CHKERRQ(ierr);
ierr = VecGetArray(diag,&pd);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x1,pd);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x2,pd+m);CHKERRQ(ierr);
ierr = MatGetDiagonal(ctx->K,ctx->x1);CHKERRQ(ierr);
ierr = VecScale(ctx->x1,-1.0);CHKERRQ(ierr);
ierr = MatGetDiagonal(ctx->M,ctx->x2);CHKERRQ(ierr);
ierr = VecScale(ctx->x2,ctx->sfactor*ctx->sfactor);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x1);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x2);CHKERRQ(ierr);
ierr = VecRestoreArray(diag,&pd);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "MatGetDiagonal_QEPLINEAR_S2B"
PetscErrorCode MatGetDiagonal_QEPLINEAR_S2B(Mat B,Vec diag)
{
PetscErrorCode ierr;
QEP_LINEAR *ctx;
PetscScalar *pd;
PetscInt m;
PetscFunctionBegin;
ierr = MatShellGetContext(B,(void**)&ctx);CHKERRQ(ierr);
ierr = MatGetLocalSize(ctx->M,&m,PETSC_NULL);CHKERRQ(ierr);
ierr = VecGetArray(diag,&pd);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x1,pd);CHKERRQ(ierr);
ierr = VecPlaceArray(ctx->x2,pd+m);CHKERRQ(ierr);
ierr = MatGetDiagonal(ctx->C,ctx->x1);CHKERRQ(ierr);
ierr = VecScale(ctx->x1,ctx->sfactor);CHKERRQ(ierr);
ierr = VecSet(ctx->x2,0.0);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x1);CHKERRQ(ierr);
ierr = VecResetArray(ctx->x2);CHKERRQ(ierr);
ierr = VecRestoreArray(diag,&pd);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "MatCreateExplicit_QEPLINEAR_S2A"
PetscErrorCode MatCreateExplicit_QEPLINEAR_S2A(MPI_Comm comm,QEP_LINEAR *ctx,Mat *A)
{
PetscErrorCode ierr;
PetscInt M,N,m,n,i,j,row,start,end,ncols,*pos;
PetscScalar *svals;
const PetscInt *cols;
const PetscScalar *vals;
PetscFunctionBegin;
ierr = MatGetSize(ctx->M,&M,&N);CHKERRQ(ierr);
ierr = MatGetLocalSize(ctx->M,&m,&n);CHKERRQ(ierr);
ierr = MatCreate(comm,A);CHKERRQ(ierr);
ierr = MatSetSizes(*A,m+n,m+n,M+N,M+N);CHKERRQ(ierr);
ierr = MatSetFromOptions(*A);CHKERRQ(ierr);
ierr = PetscMalloc(sizeof(PetscInt)*n,&pos);CHKERRQ(ierr);
ierr = PetscMalloc(sizeof(PetscScalar)*n,&svals);CHKERRQ(ierr);
ierr = MatGetOwnershipRange(ctx->M,&start,&end);CHKERRQ(ierr);
for (i=start;i<end;i++) {
ierr = MatGetRow(ctx->K,i,&ncols,&cols,&vals);CHKERRQ(ierr);
ierr = MatSetValues(*A,1,&i,ncols,cols,vals,INSERT_VALUES);CHKERRQ(ierr);
ierr = MatRestoreRow(ctx->K,i,&ncols,&cols,&vals);CHKERRQ(ierr);
}
ierr = MatAssemblyBegin(*A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
ierr = MatAssemblyEnd(*A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
ierr = MatScale(*A,-1.0);CHKERRQ(ierr);
for (i=start;i<end;i++) {
row = i + M;
ierr = MatGetRow(ctx->M,i,&ncols,&cols,&vals);CHKERRQ(ierr);
for (j=0;j<ncols;j++) {
pos[j] = cols[j] + M;
svals[j] = vals[j]*ctx->sfactor*ctx->sfactor;
}
ierr = MatSetValues(*A,1,&row,ncols,pos,svals,INSERT_VALUES);CHKERRQ(ierr);
ierr = MatRestoreRow(ctx->M,i,&ncols,&cols,&vals);CHKERRQ(ierr);
}
ierr = MatAssemblyBegin(*A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
ierr = MatAssemblyEnd(*A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
ierr = PetscFree(pos);CHKERRQ(ierr);
ierr = PetscFree(svals);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
 
#undef __FUNCT__
#define __FUNCT__ "MatCreateExplicit_QEPLINEAR_S2B"
PetscErrorCode MatCreateExplicit_QEPLINEAR_S2B(MPI_Comm comm,QEP_LINEAR *ctx,Mat *B)
{
PetscErrorCode ierr;
PetscInt M,N,m,n,i,j,row,start,end,ncols,*pos;
PetscScalar *svals;
const PetscInt *cols;
const PetscScalar *vals;
PetscFunctionBegin;
ierr = MatGetSize(ctx->M,&M,&N);CHKERRQ(ierr);
ierr = MatGetLocalSize(ctx->M,&m,&n);CHKERRQ(ierr);
ierr = MatCreate(comm,B);CHKERRQ(ierr);
ierr = MatSetSizes(*B,m+n,m+n,M+N,M+N);CHKERRQ(ierr);
ierr = MatSetFromOptions(*B);CHKERRQ(ierr);
ierr = PetscMalloc(sizeof(PetscInt)*n,&pos);CHKERRQ(ierr);
ierr = PetscMalloc(sizeof(PetscScalar)*n,&svals);CHKERRQ(ierr);
ierr = MatGetOwnershipRange(ctx->M,&start,&end);CHKERRQ(ierr);
for (i=start;i<end;i++) {
row = i + M;
ierr = MatGetRow(ctx->C,i,&ncols,&cols,&vals);CHKERRQ(ierr);
for (j=0;j<ncols;j++) {
svals[j] = vals[j]*ctx->sfactor;
}
ierr = MatSetValues(*B,1,&i,ncols,cols,svals,INSERT_VALUES);CHKERRQ(ierr);
ierr = MatRestoreRow(ctx->C,i,&ncols,&cols,&vals);CHKERRQ(ierr);
ierr = MatGetRow(ctx->M,i,&ncols,&cols,&vals);CHKERRQ(ierr);
for (j=0;j<ncols;j++) {
pos[j] = cols[j] + M;
svals[j] = vals[j]*ctx->sfactor*ctx->sfactor;
}
ierr = MatSetValues(*B,1,&i,ncols,pos,svals,INSERT_VALUES);CHKERRQ(ierr);
ierr = MatSetValues(*B,1,&row,ncols,cols,svals,INSERT_VALUES);CHKERRQ(ierr);
ierr = MatRestoreRow(ctx->M,i,&ncols,&cols,&vals);CHKERRQ(ierr);
}
ierr = PetscFree(pos);CHKERRQ(ierr);
ierr = PetscFree(svals);CHKERRQ(ierr);
ierr = MatAssemblyBegin(*B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
ierr = MatAssemblyEnd(*B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
PetscFunctionReturn(0);
}