Actual source code: dsimpl.h
1: /*
2: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3: SLEPc - Scalable Library for Eigenvalue Problem Computations
4: Copyright (c) 2002-2012, Universitat Politecnica de Valencia, Spain
6: This file is part of SLEPc.
7:
8: SLEPc is free software: you can redistribute it and/or modify it under the
9: terms of version 3 of the GNU Lesser General Public License as published by
10: the Free Software Foundation.
12: SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY
13: WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14: FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
15: more details.
17: You should have received a copy of the GNU Lesser General Public License
18: along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
19: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
20: */
22: #ifndef _DSIMPL
23: #define _DSIMPL
25: #include <slepcds.h>
27: PETSC_EXTERN PetscLogEvent DS_Solve,DS_Vectors,DS_Other;
28: PETSC_EXTERN const char *DSMatName[];
30: typedef struct _DSOps *DSOps;
32: struct _DSOps {
33: PetscErrorCode (*allocate)(DS,PetscInt);
34: PetscErrorCode (*view)(DS,PetscViewer);
35: PetscErrorCode (*vectors)(DS,DSMatType,PetscInt*,PetscReal*);
36: PetscErrorCode (*solve[DS_MAX_SOLVE])(DS,PetscScalar*,PetscScalar*);
37: PetscErrorCode (*sort)(DS,PetscScalar*,PetscScalar*,PetscScalar*,PetscScalar*,PetscInt*);
38: PetscErrorCode (*truncate)(DS,PetscInt);
39: PetscErrorCode (*update)(DS);
40: PetscErrorCode (*cond)(DS,PetscReal*);
41: PetscErrorCode (*transharm)(DS,PetscScalar,PetscReal,PetscBool,PetscScalar*,PetscReal*);
42: PetscErrorCode (*transrks)(DS,PetscScalar);
43: PetscErrorCode (*normalize)(DS,DSMatType,PetscInt);
44: };
46: struct _p_DS {
47: PETSCHEADER(struct _DSOps);
48: PetscInt method; /* identifies the variant to be used */
49: PetscBool compact; /* whether the matrices are stored in compact form */
50: PetscBool refined; /* get refined vectors instead of regular vectors */
51: PetscBool extrarow; /* assume the matrix dimension is (n+1) x n */
52: PetscInt ld; /* leading dimension */
53: PetscInt l; /* number of locked (inactive) leading columns */
54: PetscInt n; /* current dimension */
55: PetscInt m; /* current column dimension (for SVD only) */
56: PetscInt k; /* intermediate dimension (e.g. position of arrow) */
57: PetscInt t; /* length of decomposition when it was truncated */
58: DSStateType state; /* the current state */
59: PetscScalar *mat[DS_NUM_MAT]; /* the matrices */
60: PetscReal *rmat[DS_NUM_MAT]; /* the matrices (real) */
61: PetscInt *perm; /* permutation */
62: PetscScalar *work;
63: PetscReal *rwork;
64: PetscBLASInt *iwork;
65: PetscInt lwork,lrwork,liwork;
66: PetscErrorCode (*comp_fun)(PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*);
67: void *comp_ctx;
68: };
70: PETSC_EXTERN PetscErrorCode DSAllocateMat_Private(DS,DSMatType);
71: PETSC_EXTERN PetscErrorCode DSAllocateMatReal_Private(DS,DSMatType);
72: PETSC_EXTERN PetscErrorCode DSAllocateWork_Private(DS,PetscInt,PetscInt,PetscInt);
73: PETSC_EXTERN PetscErrorCode DSViewMat_Private(DS,PetscViewer,DSMatType);
74: PETSC_EXTERN PetscErrorCode DSSortEigenvalues_Private(DS,PetscScalar*,PetscScalar*,PetscInt*,PetscBool);
75: PETSC_EXTERN PetscErrorCode DSSortEigenvaluesReal_Private(DS,PetscReal*,PetscInt*);
76: PETSC_EXTERN PetscErrorCode DSPermuteColumns_Private(DS,PetscInt,PetscInt,DSMatType,PetscInt*);
77: PETSC_EXTERN PetscErrorCode DSPermuteRows_Private(DS,PetscInt,PetscInt,DSMatType,PetscInt*);
78: PETSC_EXTERN PetscErrorCode DSPermuteBoth_Private(DS,PetscInt,PetscInt,DSMatType,DSMatType,PetscInt*);
79: PETSC_EXTERN PetscErrorCode DSCopyMatrix_Private(DS,DSMatType,DSMatType);
80: PETSC_EXTERN PetscErrorCode DSSetIdentity(DS,DSMatType);
81: PETSC_EXTERN PetscErrorCode DSOrthogonalize(DS,DSMatType,PetscInt,PetscInt*);
82: PETSC_EXTERN PetscErrorCode DSPseudoOrthogonalize(DS,DSMatType,PetscInt,PetscReal*,PetscInt*,PetscReal*);
84: #endif