/usr/lib/slepcdir/3.7.4/x86_64-linux-gnu-complex/include/slepc/private/svdimpl.h is in libslepc-complex-3.7.4-dev 3.7.4+dfsg1-2build8.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | /*
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SLEPc - Scalable Library for Eigenvalue Problem Computations
Copyright (c) 2002-2016, Universitat 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(_SVDIMPL)
#define _SVDIMPL
#include <slepcsvd.h>
#include <slepc/private/slepcimpl.h>
PETSC_EXTERN PetscBool SVDRegisterAllCalled;
PETSC_EXTERN PetscErrorCode SVDRegisterAll(void);
PETSC_EXTERN PetscLogEvent SVD_SetUp,SVD_Solve;
typedef struct _SVDOps *SVDOps;
struct _SVDOps {
PetscErrorCode (*solve)(SVD);
PetscErrorCode (*setup)(SVD);
PetscErrorCode (*setfromoptions)(PetscOptionItems*,SVD);
PetscErrorCode (*publishoptions)(SVD);
PetscErrorCode (*destroy)(SVD);
PetscErrorCode (*reset)(SVD);
PetscErrorCode (*view)(SVD,PetscViewer);
};
/*
Maximum number of monitors you can run with a single SVD
*/
#define MAXSVDMONITORS 5
typedef enum { SVD_STATE_INITIAL,
SVD_STATE_SETUP,
SVD_STATE_SOLVED,
SVD_STATE_VECTORS } SVDStateType;
/*
Defines the SVD data structure.
*/
struct _p_SVD {
PETSCHEADER(struct _SVDOps);
/*------------------------- User parameters ---------------------------*/
Mat OP; /* problem matrix */
PetscInt max_it; /* max iterations */
PetscInt nsv; /* number of requested values */
PetscInt ncv; /* basis size */
PetscInt mpd; /* maximum dimension of projected problem */
PetscInt nini,ninil; /* number of initial vecs (negative means not copied yet) */
PetscReal tol; /* tolerance */
SVDConv conv; /* convergence test */
SVDStop stop; /* stopping test */
SVDWhich which; /* which singular values are computed */
PetscBool impltrans; /* implicit transpose mode */
PetscBool trackall; /* whether all the residuals must be computed */
/*-------------- User-provided functions and contexts -----------------*/
PetscErrorCode (*converged)(SVD,PetscReal,PetscReal,PetscReal*,void*);
PetscErrorCode (*convergeddestroy)(void*);
PetscErrorCode (*stopping)(SVD,PetscInt,PetscInt,PetscInt,PetscInt,SVDConvergedReason*,void*);
PetscErrorCode (*stoppingdestroy)(void*);
void *convergedctx;
void *stoppingctx;
PetscErrorCode (*monitor[MAXSVDMONITORS])(SVD,PetscInt,PetscInt,PetscReal*,PetscReal*,PetscInt,void*);
PetscErrorCode (*monitordestroy[MAXSVDMONITORS])(void**);
void *monitorcontext[MAXSVDMONITORS];
PetscInt numbermonitors;
/*----------------- Child objects and working data -------------------*/
DS ds; /* direct solver object */
BV U,V; /* left and right singular vectors */
SlepcSC sc; /* sorting criterion data */
Mat A; /* problem matrix (m>n) */
Mat AT; /* transposed matrix */
Vec *IS,*ISL; /* placeholder for references to user initial space */
PetscReal *sigma; /* singular values */
PetscInt *perm; /* permutation for singular value ordering */
PetscReal *errest; /* error estimates */
void *data; /* placeholder for solver-specific stuff */
/* ----------------------- Status variables -------------------------- */
SVDStateType state; /* initial -> setup -> solved -> vectors */
PetscInt nconv; /* number of converged values */
PetscInt its; /* iteration counter */
PetscBool leftbasis; /* if U is filled by the solver */
SVDConvergedReason reason;
};
/*
Macros to test valid SVD arguments
*/
#if !defined(PETSC_USE_DEBUG)
#define SVDCheckSolved(h,arg) do {} while (0)
#else
#define SVDCheckSolved(h,arg) \
do { \
if (h->state<SVD_STATE_SOLVED) SETERRQ1(PetscObjectComm((PetscObject)h),PETSC_ERR_ARG_WRONGSTATE,"Must call SVDSolve() first: Parameter #%d",arg); \
} while (0)
#endif
#undef __FUNCT__
#define __FUNCT__ "SVDMatMult"
PETSC_STATIC_INLINE PetscErrorCode SVDMatMult(SVD svd,PetscBool trans,Vec x,Vec y)
{
PetscErrorCode ierr;
PetscFunctionBegin;
if (trans) {
if (svd->AT) {
ierr = MatMult(svd->AT,x,y);CHKERRQ(ierr);
} else {
#if defined(PETSC_USE_COMPLEX)
ierr = MatMultHermitianTranspose(svd->A,x,y);CHKERRQ(ierr);
#else
ierr = MatMultTranspose(svd->A,x,y);CHKERRQ(ierr);
#endif
}
} else {
if (svd->A) {
ierr = MatMult(svd->A,x,y);CHKERRQ(ierr);
} else {
#if defined(PETSC_USE_COMPLEX)
ierr = MatMultHermitianTranspose(svd->AT,x,y);CHKERRQ(ierr);
#else
ierr = MatMultTranspose(svd->AT,x,y);CHKERRQ(ierr);
#endif
}
}
PetscFunctionReturn(0);
}
#undef __FUNCT__
#define __FUNCT__ "SVDMatCreateVecs"
PETSC_STATIC_INLINE PetscErrorCode SVDMatCreateVecs(SVD svd,Vec *x,Vec *y)
{
PetscErrorCode ierr;
PetscFunctionBegin;
if (svd->A) {
ierr = MatCreateVecs(svd->A,x,y);CHKERRQ(ierr);
} else {
ierr = MatCreateVecs(svd->AT,y,x);CHKERRQ(ierr);
}
PetscFunctionReturn(0);
}
#undef __FUNCT__
#define __FUNCT__ "SVDMatGetSize"
PETSC_STATIC_INLINE PetscErrorCode SVDMatGetSize(SVD svd,PetscInt *m,PetscInt *n)
{
PetscErrorCode ierr;
PetscFunctionBegin;
if (svd->A) {
ierr = MatGetSize(svd->A,m,n);CHKERRQ(ierr);
} else {
ierr = MatGetSize(svd->AT,n,m);CHKERRQ(ierr);
}
PetscFunctionReturn(0);
}
#undef __FUNCT__
#define __FUNCT__ "SVDMatGetLocalSize"
PETSC_STATIC_INLINE PetscErrorCode SVDMatGetLocalSize(SVD svd,PetscInt *m,PetscInt *n)
{
PetscErrorCode ierr;
PetscFunctionBegin;
if (svd->A) {
ierr = MatGetLocalSize(svd->A,m,n);CHKERRQ(ierr);
} else {
ierr = MatGetLocalSize(svd->AT,n,m);CHKERRQ(ierr);
}
PetscFunctionReturn(0);
}
PETSC_INTERN PetscErrorCode SVDTwoSideLanczos(SVD,PetscReal*,PetscReal*,BV,BV,PetscInt,PetscInt);
PETSC_INTERN PetscErrorCode SVDSetDimensions_Default(SVD);
PETSC_INTERN PetscErrorCode SVDComputeVectors(SVD);
#endif
|