Actual source code: stimpl.h
1: /*
2: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3: SLEPc - Scalable Library for Eigenvalue Problem Computations
4: Copyright (c) , Universitat Politecnica de Valencia, Spain
6: This file is part of SLEPc.
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: #if !defined(_STIMPL)
23: #define _STIMPL
25: #include <slepcst.h>
26: #include <slepc-private/slepcimpl.h>
28: PETSC_EXTERN PetscLogEvent ST_SetUp,ST_Apply,ST_ApplyTranspose;
30: typedef struct _STOps *STOps;
32: struct _STOps {
33: PetscErrorCode (*setup)(ST);
34: PetscErrorCode (*apply)(ST,Vec,Vec);
35: PetscErrorCode (*getbilinearform)(ST,Mat*);
36: PetscErrorCode (*applytrans)(ST,Vec,Vec);
37: PetscErrorCode (*setshift)(ST,PetscScalar);
38: PetscErrorCode (*setfromoptions)(ST);
39: PetscErrorCode (*postsolve)(ST);
40: PetscErrorCode (*backtransform)(ST,PetscInt,PetscScalar*,PetscScalar*);
41: PetscErrorCode (*destroy)(ST);
42: PetscErrorCode (*reset)(ST);
43: PetscErrorCode (*view)(ST,PetscViewer);
44: PetscErrorCode (*checknullspace)(ST,PetscInt,const Vec[]);
45: };
47: struct _p_ST {
48: PETSCHEADER(struct _STOps);
49: /*------------------------- User parameters --------------------------*/
50: Mat *A; /* Matrices which define the eigensystem */
51: PetscInt *Astate; /* State (to identify the original matrices) */
52: Mat *T; /* Matrices resulting from transformation */
53: PetscInt nmat; /* Number of matrices */
54: PetscScalar sigma; /* Value of the shift */
55: PetscBool sigma_set; /* whether the user provided the shift or not */
56: PetscScalar defsigma; /* Default value of the shift */
57: STMatMode shift_matrix;
58: MatStructure str; /* whether matrices have the same pattern or not */
60: /*------------------------- Misc data --------------------------*/
61: KSP ksp;
62: PetscInt kspidx; /* which T matrix is associated to ksp */
63: Vec w;
64: Vec D; /* diagonal matrix for balancing */
65: Vec wb; /* balancing requires an extra work vector */
66: void *data;
67: PetscInt setupcalled;
68: PetscInt lineariterations;
69: PetscInt applys;
70: };
72: PETSC_INTERN PetscErrorCode STGetBilinearForm_Default(ST,Mat*);
73: PETSC_INTERN PetscErrorCode STCheckNullSpace_Default(ST,PetscInt,const Vec[]);
74: PETSC_INTERN PetscErrorCode STMatShellCreate(ST,PetscScalar,PetscInt,PetscInt*,Mat*);
75: PETSC_INTERN PetscErrorCode STMatShellShift(Mat,PetscScalar);
76: PETSC_INTERN PetscErrorCode STMatSetHermitian(ST,Mat);
77: PETSC_INTERN PetscErrorCode STMatGAXPY_Private(ST,PetscScalar,PetscScalar,PetscInt,PetscInt,PetscBool);
79: #endif