1 /* 2 Include file for the matrix component of PETSc 3 */ 4 #ifndef __PETSCMAT_H 5 #define __PETSCMAT_H 6 #include "petscvec.h" 7 PETSC_EXTERN_CXX_BEGIN 8 9 /*S 10 Mat - Abstract PETSc matrix object 11 12 Level: beginner 13 14 Concepts: matrix; linear operator 15 16 .seealso: MatCreate(), MatType, MatSetType() 17 S*/ 18 typedef struct _p_Mat* Mat; 19 20 /*E 21 MatType - String with the name of a PETSc matrix or the creation function 22 with an optional dynamic library name, for example 23 http://www.mcs.anl.gov/petsc/lib.a:mymatcreate() 24 25 Level: beginner 26 27 .seealso: MatSetType(), Mat 28 E*/ 29 #define MATSAME "same" 30 #define MATSEQMAIJ "seqmaij" 31 #define MATMPIMAIJ "mpimaij" 32 #define MATMAIJ "maij" 33 #define MATIS "is" 34 #define MATMPIROWBS "mpirowbs" 35 #define MATSEQAIJ "seqaij" 36 #define MATMPIAIJ "mpiaij" 37 #define MATAIJ "aij" 38 #define MATSHELL "shell" 39 #define MATSEQBDIAG "seqbdiag" 40 #define MATMPIBDIAG "mpibdiag" 41 #define MATBDIAG "bdiag" 42 #define MATSEQDENSE "seqdense" 43 #define MATMPIDENSE "mpidense" 44 #define MATDENSE "dense" 45 #define MATSEQBAIJ "seqbaij" 46 #define MATMPIBAIJ "mpibaij" 47 #define MATBAIJ "baij" 48 #define MATMPIADJ "mpiadj" 49 #define MATSEQSBAIJ "seqsbaij" 50 #define MATMPISBAIJ "mpisbaij" 51 #define MATSBAIJ "sbaij" 52 #define MATDAAD "daad" 53 #define MATMFFD "mffd" 54 #define MATNORMAL "normal" 55 #define MATLRC "lrc" 56 #define MATSEQAIJSPOOLES "seqaijspooles" 57 #define MATMPIAIJSPOOLES "mpiaijspooles" 58 #define MATSEQSBAIJSPOOLES "seqsbaijspooles" 59 #define MATMPISBAIJSPOOLES "mpisbaijspooles" 60 #define MATAIJSPOOLES "aijspooles" 61 #define MATSBAIJSPOOLES "sbaijspooles" 62 #define MATSUPERLU "superlu" 63 #define MATSUPERLU_DIST "superlu_dist" 64 #define MATUMFPACK "umfpack" 65 #define MATESSL "essl" 66 #define MATLUSOL "lusol" 67 #define MATAIJMUMPS "aijmumps" 68 #define MATSBAIJMUMPS "sbaijmumps" 69 #define MATDSCPACK "dscpack" 70 #define MATMATLAB "matlab" 71 #define MATSEQCSRPERM "seqcsrperm" 72 #define MATMPICSRPERM "mpicsrperm" 73 #define MATCSRPERM "csrperm" 74 #define MatType const char* 75 76 /* Logging support */ 77 #define MAT_FILE_COOKIE 1211216 /* used to indicate matrices in binary files */ 78 extern PetscCookie PETSCMAT_DLLEXPORT MAT_COOKIE; 79 extern PetscCookie PETSCMAT_DLLEXPORT MAT_FDCOLORING_COOKIE; 80 extern PetscCookie PETSCMAT_DLLEXPORT MAT_PARTITIONING_COOKIE; 81 extern PetscCookie PETSCMAT_DLLEXPORT MAT_NULLSPACE_COOKIE; 82 extern PetscEvent MAT_Mult, MAT_MultMatrixFree, MAT_Mults, MAT_MultConstrained, MAT_MultAdd, MAT_MultTranspose; 83 extern PetscEvent MAT_MultTransposeConstrained, MAT_MultTransposeAdd, MAT_Solve, MAT_Solves, MAT_SolveAdd, MAT_SolveTranspose; 84 extern PetscEvent MAT_SolveTransposeAdd, MAT_Relax, MAT_ForwardSolve, MAT_BackwardSolve, MAT_LUFactor, MAT_LUFactorSymbolic; 85 extern PetscEvent MAT_LUFactorNumeric, MAT_CholeskyFactor, MAT_CholeskyFactorSymbolic, MAT_CholeskyFactorNumeric, MAT_ILUFactor; 86 extern PetscEvent MAT_ILUFactorSymbolic, MAT_ICCFactorSymbolic, MAT_Copy, MAT_Convert, MAT_Scale, MAT_AssemblyBegin; 87 extern PetscEvent MAT_AssemblyEnd, MAT_SetValues, MAT_GetValues, MAT_GetRow, MAT_GetSubMatrices, MAT_GetColoring, MAT_GetOrdering; 88 extern PetscEvent MAT_IncreaseOverlap, MAT_Partitioning, MAT_ZeroEntries, MAT_Load, MAT_View, MAT_AXPY, MAT_FDColoringCreate; 89 extern PetscEvent MAT_FDColoringApply, MAT_Transpose, MAT_FDColoringFunction; 90 extern PetscEvent MAT_MatMult, MAT_MatMultSymbolic, MAT_MatMultNumeric; 91 extern PetscEvent MAT_PtAP, MAT_PtAPSymbolic, MAT_PtAPNumeric; 92 extern PetscEvent MAT_MatMultTranspose, MAT_MatMultTransposeSymbolic, MAT_MatMultTransposeNumeric; 93 94 /*E 95 MatReuse - Indicates if matrices obtained from a previous call to MatGetSubMatrices() 96 or MatGetSubMatrix() are to be reused to store the new matrix values. 97 98 Level: beginner 99 100 Any additions/changes here MUST also be made in include/finclude/petscmat.h 101 102 .seealso: MatGetSubMatrices(), MatGetSubMatrix(), MatDestroyMatrices(), MatConvert() 103 E*/ 104 typedef enum {MAT_INITIAL_MATRIX,MAT_REUSE_MATRIX} MatReuse; 105 106 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatInitializePackage(char *); 107 108 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreate(MPI_Comm,Mat*); 109 PetscPolymorphicFunction(MatCreate,(MPI_Comm comm,void *ctx),(comm,&A),Mat,A) 110 PetscPolymorphicFunction(MatCreate,(void *ctx),(PETSC_COMM_WORLD,&A),Mat,A) 111 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetSizes(Mat,PetscInt,PetscInt,PetscInt,PetscInt); 112 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetType(Mat,MatType); 113 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetFromOptions(Mat); 114 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetUpPreallocation(Mat); 115 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatRegisterAll(const char[]); 116 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatRegister(const char[],const char[],const char[],PetscErrorCode(*)(Mat)); 117 118 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetOptionsPrefix(Mat,const char[]); 119 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatAppendOptionsPrefix(Mat,const char[]); 120 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetOptionsPrefix(Mat,const char*[]); 121 122 /*MC 123 MatRegisterDynamic - Adds a new matrix type 124 125 Synopsis: 126 PetscErrorCode MatRegisterDynamic(char *name,char *path,char *name_create,PetscErrorCode (*routine_create)(Mat)) 127 128 Not Collective 129 130 Input Parameters: 131 + name - name of a new user-defined matrix type 132 . path - path (either absolute or relative) the library containing this solver 133 . name_create - name of routine to create method context 134 - routine_create - routine to create method context 135 136 Notes: 137 MatRegisterDynamic() may be called multiple times to add several user-defined solvers. 138 139 If dynamic libraries are used, then the fourth input argument (routine_create) 140 is ignored. 141 142 Sample usage: 143 .vb 144 MatRegisterDynamic("my_mat",/home/username/my_lib/lib/libO/solaris/mylib.a, 145 "MyMatCreate",MyMatCreate); 146 .ve 147 148 Then, your solver can be chosen with the procedural interface via 149 $ MatSetType(Mat,"my_mat") 150 or at runtime via the option 151 $ -mat_type my_mat 152 153 Level: advanced 154 155 Notes: ${PETSC_ARCH} occuring in pathname will be replaced with appropriate values. 156 If your function is not being put into a shared library then use VecRegister() instead 157 158 .keywords: Mat, register 159 160 .seealso: MatRegisterAll(), MatRegisterDestroy() 161 162 M*/ 163 #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 164 #define MatRegisterDynamic(a,b,c,d) MatRegister(a,b,c,0) 165 #else 166 #define MatRegisterDynamic(a,b,c,d) MatRegister(a,b,c,d) 167 #endif 168 169 extern PetscTruth MatRegisterAllCalled; 170 extern PetscFList MatList; 171 172 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateSeqDense(MPI_Comm,PetscInt,PetscInt,PetscScalar[],Mat*); 173 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateMPIDense(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,PetscScalar[],Mat*); 174 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateSeqAIJ(MPI_Comm,PetscInt,PetscInt,PetscInt,const PetscInt[],Mat*); 175 PetscPolymorphicFunction(MatCreateSeqAIJ,(PetscInt m,PetscInt n,PetscInt nz,const PetscInt nnz[]),(PETSC_COMM_SELF,m,n,nz,nnz,&A),Mat,A) 176 PetscPolymorphicFunction(MatCreateSeqAIJ,(PetscInt m,PetscInt n,PetscInt nz),(PETSC_COMM_SELF,m,n,nz,PETSC_NULL,&A),Mat,A) 177 PetscPolymorphicFunction(MatCreateSeqAIJ,(PetscInt m,PetscInt n,const PetscInt nnz[]),(PETSC_COMM_SELF,m,n,0,nnz,&A),Mat,A) 178 PetscPolymorphicFunction(MatCreateSeqAIJ,(PetscInt m,PetscInt n),(PETSC_COMM_SELF,m,n,0,PETSC_NULL,&A),Mat,A) 179 PetscPolymorphicSubroutine(MatCreateSeqAIJ,(PetscInt m,PetscInt n,PetscInt nz,Mat *A),(PETSC_COMM_SELF,m,n,nz,PETSC_NULL,A)) 180 PetscPolymorphicSubroutine(MatCreateSeqAIJ,(PetscInt m,PetscInt n,const PetscInt nnz[],Mat *A),(PETSC_COMM_SELF,m,n,0,nnz,A)) 181 PetscPolymorphicSubroutine(MatCreateSeqAIJ,(PetscInt m,PetscInt n,Mat *A),(PETSC_COMM_SELF,m,n,0,PETSC_NULL,A)) 182 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateMPIAIJ(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],PetscInt,const PetscInt[],Mat*); 183 PetscPolymorphicFunction(MatCreateMPIAIJ,(MPI_Comm comm,PetscInt m,PetscInt n,PetscInt M,PetscInt N,PetscInt nz,const PetscInt nnz[],PetscInt onz,const PetscInt onnz[]),(comm,m,n,M,N,nz,nnz,onz,onnz,&A),Mat,A) 184 PetscPolymorphicFunction(MatCreateMPIAIJ,(MPI_Comm comm,PetscInt m,PetscInt n,PetscInt M,PetscInt N,PetscInt nz,PetscInt nnz),(comm,m,n,M,N,nz,PETSC_NULL,nnz,PETSC_NULL,&A),Mat,A) 185 PetscPolymorphicFunction(MatCreateMPIAIJ,(MPI_Comm comm,PetscInt m,PetscInt n,PetscInt M,PetscInt N,const PetscInt nnz[],const PetscInt onz[]),(comm,m,n,M,N,0,nnz,0,onz,&A),Mat,A) 186 PetscPolymorphicFunction(MatCreateMPIAIJ,(MPI_Comm comm,PetscInt m,PetscInt n,PetscInt M,PetscInt N),(comm,m,n,M,N,0,PETSC_NULL,0,PETSC_NULL,&A),Mat,A) 187 PetscPolymorphicSubroutine(MatCreateMPIAIJ,(MPI_Comm comm,PetscInt m,PetscInt n,PetscInt M,PetscInt N,PetscInt nz,PetscInt nnz,Mat *A),(comm,m,n,M,N,nz,PETSC_NULL,nnz,PETSC_NULL,A)) 188 PetscPolymorphicSubroutine(MatCreateMPIAIJ,(MPI_Comm comm,PetscInt m,PetscInt n,PetscInt M,PetscInt N,const PetscInt nnz[],const PetscInt onz[],Mat *A),(comm,m,n,M,N,0,nnz,0,onz,A)) 189 PetscPolymorphicSubroutine(MatCreateMPIAIJ,(MPI_Comm comm,PetscInt m,PetscInt n,PetscInt M,PetscInt N,Mat *A),(comm,m,n,M,N,0,PETSC_NULL,0,PETSC_NULL,A)) 190 PetscPolymorphicFunction(MatCreateMPIAIJ,(PetscInt m,PetscInt n,PetscInt M,PetscInt N,PetscInt nz,const PetscInt nnz[],PetscInt onz,const PetscInt onnz[]),(PETSC_COMM_WORLD,m,n,M,N,nz,nnz,onz,onnz,&A),Mat,A) 191 PetscPolymorphicFunction(MatCreateMPIAIJ,(PetscInt m,PetscInt n,PetscInt M,PetscInt N,PetscInt nz,PetscInt nnz),(PETSC_COMM_WORLD,m,n,M,N,nz,PETSC_NULL,nnz,PETSC_NULL,&A),Mat,A) 192 PetscPolymorphicFunction(MatCreateMPIAIJ,(PetscInt m,PetscInt n,PetscInt M,PetscInt N,const PetscInt nnz[],const PetscInt onz[]),(PETSC_COMM_WORLD,m,n,M,N,0,nnz,0,onz,&A),Mat,A) 193 PetscPolymorphicFunction(MatCreateMPIAIJ,(PetscInt m,PetscInt n,PetscInt M,PetscInt N),(PETSC_COMM_WORLD,m,n,M,N,0,PETSC_NULL,0,PETSC_NULL,&A),Mat,A) 194 PetscPolymorphicSubroutine(MatCreateMPIAIJ,(PetscInt m,PetscInt n,PetscInt M,PetscInt N,PetscInt nz,PetscInt nnz,Mat *A),(PETSC_COMM_WORLD,m,n,M,N,nz,PETSC_NULL,nnz,PETSC_NULL,A)) 195 PetscPolymorphicSubroutine(MatCreateMPIAIJ,(PetscInt m,PetscInt n,PetscInt M,PetscInt N,const PetscInt nnz[],const PetscInt onz[],Mat *A),(PETSC_COMM_WORLD,m,n,M,N,0,nnz,0,onz,A)) 196 PetscPolymorphicSubroutine(MatCreateMPIAIJ,(PetscInt m,PetscInt n,PetscInt M,PetscInt N,Mat *A),(PETSC_COMM_WORLD,m,n,M,N,0,PETSC_NULL,0,PETSC_NULL,A)) 197 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateMPIRowbs(MPI_Comm,PetscInt,PetscInt,PetscInt,const PetscInt[],Mat*); 198 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateSeqBDiag(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],PetscScalar*[],Mat*); 199 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateMPIBDiag(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],PetscScalar*[],Mat*); 200 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateSeqBAIJ(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],Mat*); 201 PetscPolymorphicFunction(MatCreateSeqBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt nz,const PetscInt nnz[]),(PETSC_COMM_SELF,bs,m,n,nz,nnz,&A),Mat,A) 202 PetscPolymorphicFunction(MatCreateSeqBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt nz),(PETSC_COMM_SELF,bs,m,n,nz,PETSC_NULL,&A),Mat,A) 203 PetscPolymorphicFunction(MatCreateSeqBAIJ,(PetscInt bs,PetscInt m,PetscInt n,const PetscInt nnz[]),(PETSC_COMM_SELF,bs,m,n,0,nnz,&A),Mat,A) 204 PetscPolymorphicFunction(MatCreateSeqBAIJ,(PetscInt bs,PetscInt m,PetscInt n),(PETSC_COMM_SELF,bs,m,n,0,PETSC_NULL,&A),Mat,A) 205 PetscPolymorphicSubroutine(MatCreateSeqBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt nz,Mat *A),(PETSC_COMM_SELF,bs,m,n,nz,PETSC_NULL,A)) 206 PetscPolymorphicSubroutine(MatCreateSeqBAIJ,(PetscInt bs,PetscInt m,PetscInt n,const PetscInt nnz[],Mat *A),(PETSC_COMM_SELF,bs,m,n,0,nnz,A)) 207 PetscPolymorphicSubroutine(MatCreateSeqBAIJ,(PetscInt bs,PetscInt m,PetscInt n,Mat *A),(PETSC_COMM_SELF,bs,m,n,0,PETSC_NULL,A)) 208 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateMPIBAIJ(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],PetscInt,const PetscInt[],Mat*); 209 PetscPolymorphicFunction(MatCreateMPIBAIJ,(MPI_Comm comm,PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,PetscInt nz,const PetscInt nnz[],PetscInt onz,const PetscInt onnz[]),(comm,bs,m,n,M,N,nz,nnz,onz,onnz,&A),Mat,A) 210 PetscPolymorphicFunction(MatCreateMPIBAIJ,(MPI_Comm comm,PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,PetscInt nz,PetscInt nnz),(comm,bs,m,n,M,N,nz,PETSC_NULL,nnz,PETSC_NULL,&A),Mat,A) 211 PetscPolymorphicFunction(MatCreateMPIBAIJ,(MPI_Comm comm,PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,const PetscInt nnz[],const PetscInt onz[]),(comm,bs,m,n,M,N,0,nnz,0,onz,&A),Mat,A) 212 PetscPolymorphicFunction(MatCreateMPIBAIJ,(MPI_Comm comm,PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N),(comm,bs,m,n,M,N,0,PETSC_NULL,0,PETSC_NULL,&A),Mat,A) 213 PetscPolymorphicSubroutine(MatCreateMPIBAIJ,(MPI_Comm comm,PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,PetscInt nz,PetscInt nnz,Mat *A),(comm,bs,m,n,M,N,nz,PETSC_NULL,nnz,PETSC_NULL,A)) 214 PetscPolymorphicSubroutine(MatCreateMPIBAIJ,(MPI_Comm comm,PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,const PetscInt nnz[],const PetscInt onz[],Mat *A),(comm,bs,m,n,M,N,0,nnz,0,onz,A)) 215 PetscPolymorphicSubroutine(MatCreateMPIBAIJ,(MPI_Comm comm,PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,Mat *A),(comm,bs,m,n,M,N,0,PETSC_NULL,0,PETSC_NULL,A)) 216 PetscPolymorphicFunction(MatCreateMPIBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,PetscInt nz,const PetscInt nnz[],PetscInt onz,const PetscInt onnz[]),(PETSC_COMM_WORLD,bs,m,n,M,N,nz,nnz,onz,onnz,&A),Mat,A) 217 PetscPolymorphicFunction(MatCreateMPIBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,PetscInt nz,PetscInt nnz),(PETSC_COMM_WORLD,bs,m,n,M,N,nz,PETSC_NULL,nnz,PETSC_NULL,&A),Mat,A) 218 PetscPolymorphicFunction(MatCreateMPIBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,const PetscInt nnz[],const PetscInt onz[]),(PETSC_COMM_WORLD,bs,m,n,M,N,0,nnz,0,onz,&A),Mat,A) 219 PetscPolymorphicFunction(MatCreateMPIBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N),(PETSC_COMM_WORLD,bs,m,n,M,N,0,PETSC_NULL,0,PETSC_NULL,&A),Mat,A) 220 PetscPolymorphicSubroutine(MatCreateMPIBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,PetscInt nz,PetscInt nnz,Mat *A),(PETSC_COMM_WORLD,bs,m,n,M,N,nz,PETSC_NULL,nnz,PETSC_NULL,A)) 221 PetscPolymorphicSubroutine(MatCreateMPIBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,const PetscInt nnz[],const PetscInt onz[],Mat *A),(PETSC_COMM_WORLD,bs,m,n,M,N,0,nnz,0,onz,A)) 222 PetscPolymorphicSubroutine(MatCreateMPIBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,Mat *A),(PETSC_COMM_WORLD,bs,m,n,M,N,0,PETSC_NULL,0,PETSC_NULL,A)) 223 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateMPIAdj(MPI_Comm,PetscInt,PetscInt,PetscInt[],PetscInt[],PetscInt[],Mat*); 224 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateSeqSBAIJ(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],Mat*); 225 PetscPolymorphicFunction(MatCreateSeqSBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt nz,const PetscInt nnz[]),(PETSC_COMM_SELF,bs,m,n,nz,nnz,&A),Mat,A) 226 PetscPolymorphicFunction(MatCreateSeqSBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt nz),(PETSC_COMM_SELF,bs,m,n,nz,PETSC_NULL,&A),Mat,A) 227 PetscPolymorphicFunction(MatCreateSeqSBAIJ,(PetscInt bs,PetscInt m,PetscInt n,const PetscInt nnz[]),(PETSC_COMM_SELF,bs,m,n,0,nnz,&A),Mat,A) 228 PetscPolymorphicFunction(MatCreateSeqSBAIJ,(PetscInt bs,PetscInt m,PetscInt n),(PETSC_COMM_SELF,bs,m,n,0,PETSC_NULL,&A),Mat,A) 229 PetscPolymorphicSubroutine(MatCreateSeqSBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt nz,Mat *A),(PETSC_COMM_SELF,bs,m,n,nz,PETSC_NULL,A)) 230 PetscPolymorphicSubroutine(MatCreateSeqSBAIJ,(PetscInt bs,PetscInt m,PetscInt n,const PetscInt nnz[],Mat *A),(PETSC_COMM_SELF,bs,m,n,0,nnz,A)) 231 PetscPolymorphicSubroutine(MatCreateSeqSBAIJ,(PetscInt bs,PetscInt m,PetscInt n,Mat *A),(PETSC_COMM_SELF,bs,m,n,0,PETSC_NULL,A)) 232 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateMPISBAIJ(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],PetscInt,const PetscInt[],Mat*); 233 PetscPolymorphicFunction(MatCreateMPISBAIJ,(MPI_Comm comm,PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,PetscInt nz,const PetscInt nnz[],PetscInt onz,const PetscInt onnz[]),(comm,bs,m,n,M,N,nz,nnz,onz,onnz,&A),Mat,A) 234 PetscPolymorphicFunction(MatCreateMPISBAIJ,(MPI_Comm comm,PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,PetscInt nz,PetscInt nnz),(comm,bs,m,n,M,N,nz,PETSC_NULL,nnz,PETSC_NULL,&A),Mat,A) 235 PetscPolymorphicFunction(MatCreateMPISBAIJ,(MPI_Comm comm,PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,const PetscInt nnz[],const PetscInt onz[]),(comm,bs,m,n,M,N,0,nnz,0,onz,&A),Mat,A) 236 PetscPolymorphicFunction(MatCreateMPISBAIJ,(MPI_Comm comm,PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N),(comm,bs,m,n,M,N,0,PETSC_NULL,0,PETSC_NULL,&A),Mat,A) 237 PetscPolymorphicSubroutine(MatCreateMPISBAIJ,(MPI_Comm comm,PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,PetscInt nz,PetscInt nnz,Mat *A),(comm,bs,m,n,M,N,nz,PETSC_NULL,nnz,PETSC_NULL,A)) 238 PetscPolymorphicSubroutine(MatCreateMPISBAIJ,(MPI_Comm comm,PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,const PetscInt nnz[],const PetscInt onz[],Mat *A),(comm,bs,m,n,M,N,0,nnz,0,onz,A)) 239 PetscPolymorphicSubroutine(MatCreateMPISBAIJ,(MPI_Comm comm,PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,Mat *A),(comm,bs,m,n,M,N,0,PETSC_NULL,0,PETSC_NULL,A)) 240 PetscPolymorphicFunction(MatCreateMPISBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,PetscInt nz,const PetscInt nnz[],PetscInt onz,const PetscInt onnz[]),(PETSC_COMM_WORLD,bs,m,n,M,N,nz,nnz,onz,onnz,&A),Mat,A) 241 PetscPolymorphicFunction(MatCreateMPISBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,PetscInt nz,PetscInt nnz),(PETSC_COMM_WORLD,bs,m,n,M,N,nz,PETSC_NULL,nnz,PETSC_NULL,&A),Mat,A) 242 PetscPolymorphicFunction(MatCreateMPISBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,const PetscInt nnz[],const PetscInt onz[]),(PETSC_COMM_WORLD,bs,m,n,M,N,0,nnz,0,onz,&A),Mat,A) 243 PetscPolymorphicFunction(MatCreateMPISBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N),(PETSC_COMM_WORLD,bs,m,n,M,N,0,PETSC_NULL,0,PETSC_NULL,&A),Mat,A) 244 PetscPolymorphicSubroutine(MatCreateMPISBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,PetscInt nz,PetscInt nnz,Mat *A),(PETSC_COMM_WORLD,bs,m,n,M,N,nz,PETSC_NULL,nnz,PETSC_NULL,A)) 245 PetscPolymorphicSubroutine(MatCreateMPISBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,const PetscInt nnz[],const PetscInt onz[],Mat *A),(PETSC_COMM_WORLD,bs,m,n,M,N,0,nnz,0,onz,A)) 246 PetscPolymorphicSubroutine(MatCreateMPISBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,Mat *A),(PETSC_COMM_WORLD,bs,m,n,M,N,0,PETSC_NULL,0,PETSC_NULL,A)) 247 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateShell(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,void *,Mat*); 248 PetscPolymorphicFunction(MatCreateShell,(MPI_Comm comm,PetscInt m,PetscInt n,PetscInt M,PetscInt N,void *ctx),(comm,m,n,M,N,ctx,&A),Mat,A) 249 PetscPolymorphicFunction(MatCreateShell,(PetscInt m,PetscInt n,PetscInt M,PetscInt N,void *ctx),(PETSC_COMM_WORLD,m,n,M,N,ctx,&A),Mat,A) 250 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateAdic(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,void (*)(void),Mat*); 251 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateNormal(Mat,Mat*); 252 PetscPolymorphicFunction(MatCreateNormal,(Mat mat),(mat,&A),Mat,A) 253 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateLRC(Mat,Mat,Mat,Mat*); 254 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetUp(Mat); 255 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatDestroy(Mat); 256 257 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPrintHelp(Mat); 258 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetPetscMaps(Mat,PetscMap*,PetscMap*); 259 260 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatConjugate(Mat); 261 /* ------------------------------------------------------------*/ 262 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetValues(Mat,PetscInt,const PetscInt[],PetscInt,const PetscInt[],const PetscScalar[],InsertMode); 263 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetValuesBlocked(Mat,PetscInt,const PetscInt[],PetscInt,const PetscInt[],const PetscScalar[],InsertMode); 264 265 /*S 266 MatStencil - Data structure (C struct) for storing information about a single row or 267 column of a matrix as index on an associated grid. 268 269 Level: beginner 270 271 Concepts: matrix; linear operator 272 273 .seealso: MatSetValuesStencil(), MatSetStencil(), MatSetValuesBlockStencil() 274 S*/ 275 typedef struct { 276 PetscInt k,j,i,c; 277 } MatStencil; 278 279 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetValuesStencil(Mat,PetscInt,const MatStencil[],PetscInt,const MatStencil[],const PetscScalar[],InsertMode); 280 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetValuesBlockedStencil(Mat,PetscInt,const MatStencil[],PetscInt,const MatStencil[],const PetscScalar[],InsertMode); 281 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetStencil(Mat,PetscInt,const PetscInt[],const PetscInt[],PetscInt); 282 283 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetColoring(Mat,ISColoring); 284 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetValuesAdic(Mat,void*); 285 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetValuesAdifor(Mat,PetscInt,void*); 286 287 /*E 288 MatAssemblyType - Indicates if the matrix is now to be used, or if you plan 289 to continue to add values to it 290 291 Level: beginner 292 293 .seealso: MatAssemblyBegin(), MatAssemblyEnd() 294 E*/ 295 typedef enum {MAT_FLUSH_ASSEMBLY=1,MAT_FINAL_ASSEMBLY=0} MatAssemblyType; 296 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatAssemblyBegin(Mat,MatAssemblyType); 297 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatAssemblyEnd(Mat,MatAssemblyType); 298 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatAssembled(Mat,PetscTruth*); 299 300 extern PETSCMAT_DLLEXPORT PetscInt MatSetValue_Row; 301 extern PETSCMAT_DLLEXPORT PetscInt MatSetValue_Column; 302 extern PETSCMAT_DLLEXPORT PetscScalar MatSetValue_Value; 303 304 /*MC 305 MatSetValue - Set a single entry into a matrix. 306 307 Synopsis: 308 PetscErrorCode MatSetValue(Mat m,PetscInt row,PetscInt col,PetscScalar value,InsertMode mode); 309 310 Not collective 311 312 Input Parameters: 313 + m - the matrix 314 . row - the row location of the entry 315 . col - the column location of the entry 316 . value - the value to insert 317 - mode - either INSERT_VALUES or ADD_VALUES 318 319 Notes: 320 For efficiency one should use MatSetValues() and set several or many 321 values simultaneously if possible. 322 323 Level: beginner 324 325 .seealso: MatSetValues(), MatSetValueLocal() 326 M*/ 327 #define MatSetValue(v,i,j,va,mode) \ 328 ((MatSetValue_Row = i,MatSetValue_Column = j,MatSetValue_Value = va,0) || \ 329 MatSetValues(v,1,&MatSetValue_Row,1,&MatSetValue_Column,&MatSetValue_Value,mode)) 330 331 #define MatGetValue(v,i,j,va) \ 332 ((MatSetValue_Row = i,MatSetValue_Column = j,0) || \ 333 MatGetValues(v,1,&MatSetValue_Row,1,&MatSetValue_Column,&va)) 334 335 #define MatSetValueLocal(v,i,j,va,mode) \ 336 ((MatSetValue_Row = i,MatSetValue_Column = j,MatSetValue_Value = va,0) || \ 337 MatSetValuesLocal(v,1,&MatSetValue_Row,1,&MatSetValue_Column,&MatSetValue_Value,mode)) 338 339 /*E 340 MatOption - Options that may be set for a matrix and its behavior or storage 341 342 Level: beginner 343 344 Any additions/changes here MUST also be made in include/finclude/petscmat.h 345 346 .seealso: MatSetOption() 347 E*/ 348 typedef enum {MAT_ROW_ORIENTED=1,MAT_COLUMN_ORIENTED=2,MAT_ROWS_SORTED=4, 349 MAT_COLUMNS_SORTED=8,MAT_NO_NEW_NONZERO_LOCATIONS=16, 350 MAT_YES_NEW_NONZERO_LOCATIONS=32,MAT_SYMMETRIC=64, 351 MAT_STRUCTURALLY_SYMMETRIC=65,MAT_NO_NEW_DIAGONALS=66, 352 MAT_YES_NEW_DIAGONALS=67,MAT_INODE_LIMIT_1=68,MAT_INODE_LIMIT_2=69, 353 MAT_INODE_LIMIT_3=70,MAT_INODE_LIMIT_4=71,MAT_INODE_LIMIT_5=72, 354 MAT_IGNORE_OFF_PROC_ENTRIES=73,MAT_ROWS_UNSORTED=74, 355 MAT_COLUMNS_UNSORTED=75,MAT_NEW_NONZERO_LOCATION_ERR=76, 356 MAT_NEW_NONZERO_ALLOCATION_ERR=77,MAT_USE_HASH_TABLE=78, 357 MAT_KEEP_ZEROED_ROWS=79,MAT_IGNORE_ZERO_ENTRIES=80,MAT_USE_INODES=81, 358 MAT_DO_NOT_USE_INODES=82,MAT_NOT_SYMMETRIC=83,MAT_HERMITIAN=84, 359 MAT_NOT_STRUCTURALLY_SYMMETRIC=85,MAT_NOT_HERMITIAN=86, 360 MAT_SYMMETRY_ETERNAL=87,MAT_NOT_SYMMETRY_ETERNAL=88, 361 MAT_USE_COMPRESSEDROW=89,MAT_DO_NOT_USE_COMPRESSEDROW=90, 362 MAT_IGNORE_LOWER_TRIANGULAR=91,MAT_ERROR_LOWER_TRIANGULAR=92} MatOption; 363 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetOption(Mat,MatOption); 364 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetType(Mat,MatType*); 365 PetscPolymorphicFunction(MatGetType,(Mat mat),(mat,&t),MatType,t) 366 367 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetValues(Mat,PetscInt,const PetscInt[],PetscInt,const PetscInt[],PetscScalar[]); 368 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetRow(Mat,PetscInt,PetscInt *,const PetscInt *[],const PetscScalar*[]); 369 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatRestoreRow(Mat,PetscInt,PetscInt *,const PetscInt *[],const PetscScalar*[]); 370 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetColumn(Mat,PetscInt,PetscInt *,const PetscInt *[],const PetscScalar*[]); 371 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatRestoreColumn(Mat,PetscInt,PetscInt *,const PetscInt *[],const PetscScalar*[]); 372 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetColumnVector(Mat,Vec,PetscInt); 373 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetArray(Mat,PetscScalar *[]); 374 PetscPolymorphicFunction(MatGetArray,(Mat mat),(mat,&a),PetscScalar*,a) 375 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatRestoreArray(Mat,PetscScalar *[]); 376 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetBlockSize(Mat,PetscInt *); 377 PetscPolymorphicFunction(MatGetBlockSize,(Mat mat),(mat,&a),PetscInt,a) 378 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetBlockSize(Mat,PetscInt); 379 380 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMult(Mat,Vec,Vec); 381 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMultAdd(Mat,Vec,Vec,Vec); 382 PetscPolymorphicSubroutine(MatMultAdd,(Mat A,Vec x,Vec y),(A,x,y,y)) 383 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMultTranspose(Mat,Vec,Vec); 384 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatIsTranspose(Mat,Mat,PetscReal,PetscTruth*); 385 PetscPolymorphicFunction(MatIsTranspose,(Mat A,Mat B,PetscReal tol),(A,B,tol,&t),PetscTruth,t) 386 PetscPolymorphicFunction(MatIsTranspose,(Mat A,Mat B),(A,B,0.0,&t),PetscTruth,t) 387 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMultTransposeAdd(Mat,Vec,Vec,Vec); 388 PetscPolymorphicSubroutine(MatMultTransposeAdd,(Mat A,Vec x,Vec y),(A,x,y,y)) 389 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMultConstrained(Mat,Vec,Vec); 390 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMultTransposeConstrained(Mat,Vec,Vec); 391 392 /*E 393 MatDuplicateOption - Indicates if a duplicated sparse matrix should have 394 its numerical values copied over or just its nonzero structure. 395 396 Level: beginner 397 398 Any additions/changes here MUST also be made in include/finclude/petscmat.h 399 400 .seealso: MatDuplicate() 401 E*/ 402 typedef enum {MAT_DO_NOT_COPY_VALUES,MAT_COPY_VALUES} MatDuplicateOption; 403 404 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatConvertRegister(const char[],const char[],const char[],PetscErrorCode (*)(Mat,MatType,MatReuse,Mat*)); 405 #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 406 #define MatConvertRegisterDynamic(a,b,c,d) MatConvertRegister(a,b,c,0) 407 #else 408 #define MatConvertRegisterDynamic(a,b,c,d) MatConvertRegister(a,b,c,d) 409 #endif 410 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatConvertRegisterAll(const char[]); 411 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatConvertRegisterDestroy(void); 412 extern PetscTruth MatConvertRegisterAllCalled; 413 extern PetscFList MatConvertList; 414 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatConvert(Mat,MatType,MatReuse,Mat*); 415 PetscPolymorphicFunction(MatConvert,(Mat A,MatType t),(A,t,MAT_INITIAL_MATRIX,&a),Mat,a) 416 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatDuplicate(Mat,MatDuplicateOption,Mat*); 417 PetscPolymorphicFunction(MatDuplicate,(Mat A,MatDuplicateOption o),(A,o,&a),Mat,a) 418 PetscPolymorphicFunction(MatDuplicate,(Mat A),(A,MAT_COPY_VALUES,&a),Mat,a) 419 420 /*E 421 MatStructure - Indicates if the matrix has the same nonzero structure 422 423 Level: beginner 424 425 Any additions/changes here MUST also be made in include/finclude/petscmat.h 426 427 .seealso: MatCopy(), KSPSetOperators(), PCSetOperators() 428 E*/ 429 typedef enum {SAME_NONZERO_PATTERN,DIFFERENT_NONZERO_PATTERN,SAME_PRECONDITIONER,SUBSET_NONZERO_PATTERN} MatStructure; 430 431 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCopy(Mat,Mat,MatStructure); 432 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatView(Mat,PetscViewer); 433 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatIsSymmetric(Mat,PetscReal,PetscTruth*); 434 PetscPolymorphicFunction(MatIsSymmetric,(Mat A,PetscReal tol),(A,tol,&t),PetscTruth,t) 435 PetscPolymorphicFunction(MatIsSymmetric,(Mat A),(A,0.0,&t),PetscTruth,t) 436 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatIsStructurallySymmetric(Mat,PetscTruth*); 437 PetscPolymorphicFunction(MatIsStructurallySymmetric,(Mat A),(A,&t),PetscTruth,t) 438 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatIsHermitian(Mat,PetscTruth*); 439 PetscPolymorphicFunction(MatIsHermitian,(Mat A),(A,&t),PetscTruth,t) 440 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatIsSymmetricKnown(Mat,PetscTruth*,PetscTruth*); 441 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatIsHermitianKnown(Mat,PetscTruth*,PetscTruth*); 442 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatLoad(PetscViewer,MatType,Mat*); 443 PetscPolymorphicFunction(MatLoad,(PetscViewer v,MatType t),(v,t,&a),Mat,a) 444 445 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetRowIJ(Mat,PetscInt,PetscTruth,PetscInt*,PetscInt *[],PetscInt *[],PetscTruth *); 446 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatRestoreRowIJ(Mat,PetscInt,PetscTruth,PetscInt *,PetscInt *[],PetscInt *[],PetscTruth *); 447 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetColumnIJ(Mat,PetscInt,PetscTruth,PetscInt*,PetscInt *[],PetscInt *[],PetscTruth *); 448 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatRestoreColumnIJ(Mat,PetscInt,PetscTruth,PetscInt *,PetscInt *[],PetscInt *[],PetscTruth *); 449 450 /*S 451 MatInfo - Context of matrix information, used with MatGetInfo() 452 453 In Fortran this is simply a double precision array of dimension MAT_INFO_SIZE 454 455 Level: intermediate 456 457 Concepts: matrix^nonzero information 458 459 .seealso: MatGetInfo(), MatInfoType 460 S*/ 461 typedef struct { 462 PetscLogDouble rows_global,columns_global; /* number of global rows and columns */ 463 PetscLogDouble rows_local,columns_local; /* number of local rows and columns */ 464 PetscLogDouble block_size; /* block size */ 465 PetscLogDouble nz_allocated,nz_used,nz_unneeded; /* number of nonzeros */ 466 PetscLogDouble memory; /* memory allocated */ 467 PetscLogDouble assemblies; /* number of matrix assemblies called */ 468 PetscLogDouble mallocs; /* number of mallocs during MatSetValues() */ 469 PetscLogDouble fill_ratio_given,fill_ratio_needed; /* fill ratio for LU/ILU */ 470 PetscLogDouble factor_mallocs; /* number of mallocs during factorization */ 471 } MatInfo; 472 473 /*E 474 MatInfoType - Indicates if you want information about the local part of the matrix, 475 the entire parallel matrix or the maximum over all the local parts. 476 477 Level: beginner 478 479 Any additions/changes here MUST also be made in include/finclude/petscmat.h 480 481 .seealso: MatGetInfo(), MatInfo 482 E*/ 483 typedef enum {MAT_LOCAL=1,MAT_GLOBAL_MAX=2,MAT_GLOBAL_SUM=3} MatInfoType; 484 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetInfo(Mat,MatInfoType,MatInfo*); 485 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatValid(Mat,PetscTruth*); 486 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetDiagonal(Mat,Vec); 487 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetRowMax(Mat,Vec); 488 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatTranspose(Mat,Mat*); 489 PetscPolymorphicFunction(MatTranspose,(Mat A),(A,&t),Mat,t) 490 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPermute(Mat,IS,IS,Mat *); 491 PetscPolymorphicFunction(MatPermute,(Mat A,IS is1,IS is2),(A,is1,is2,&t),Mat,t) 492 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPermuteSparsify(Mat,PetscInt,PetscReal,PetscReal,IS,IS,Mat *); 493 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatDiagonalScale(Mat,Vec,Vec); 494 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatDiagonalSet(Mat,Vec,InsertMode); 495 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatEqual(Mat,Mat,PetscTruth*); 496 PetscPolymorphicFunction(MatEqual,(Mat A,Mat B),(A,B,&t),PetscTruth,t) 497 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMultEqual(Mat,Mat,PetscInt,PetscTruth*); 498 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMultAddEqual(Mat,Mat,PetscInt,PetscTruth*); 499 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMultTransposeEqual(Mat,Mat,PetscInt,PetscTruth*); 500 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMultTransposeAddEqual(Mat,Mat,PetscInt,PetscTruth*); 501 502 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatNorm(Mat,NormType,PetscReal *); 503 PetscPolymorphicFunction(MatNorm,(Mat A,NormType t),(A,t,&n),PetscReal,n) 504 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatZeroEntries(Mat); 505 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatZeroRows(Mat,PetscInt,const PetscInt [],PetscScalar); 506 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatZeroRowsIS(Mat,IS,PetscScalar); 507 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatZeroColumns(Mat,PetscInt,const PetscInt [],const PetscScalar*); 508 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatZeroColumnsIS(Mat,IS,const PetscScalar*); 509 510 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatUseScaledForm(Mat,PetscTruth); 511 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatScaleSystem(Mat,Vec,Vec); 512 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatUnScaleSystem(Mat,Vec,Vec); 513 514 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetSize(Mat,PetscInt*,PetscInt*); 515 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetLocalSize(Mat,PetscInt*,PetscInt*); 516 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetOwnershipRange(Mat,PetscInt*,PetscInt*); 517 518 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetSubMatrices(Mat,PetscInt,const IS[],const IS[],MatReuse,Mat *[]); 519 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatDestroyMatrices(PetscInt,Mat *[]); 520 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetSubMatrix(Mat,IS,IS,PetscInt,MatReuse,Mat *); 521 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetSubMatrixRaw(Mat,PetscInt,const PetscInt[],PetscInt,const PetscInt[],PetscInt,MatReuse,Mat *); 522 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMerge(MPI_Comm,Mat,PetscInt,MatReuse,Mat*); 523 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMerge_SeqsToMPI(MPI_Comm,Mat,PetscInt,PetscInt,MatReuse,Mat*); 524 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMerge_SeqsToMPISymbolic(MPI_Comm,Mat,PetscInt,PetscInt,Mat*); 525 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMerge_SeqsToMPINumeric(Mat,Mat); 526 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatDestroy_MPIAIJ_SeqsToMPI(Mat); 527 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetLocalMat(Mat,MatReuse,Mat*); 528 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetLocalMatCondensed(Mat,MatReuse,IS*,IS*,Mat*); 529 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetBrowsOfAcols(Mat,Mat,MatReuse,IS*,IS*,PetscInt*,Mat*); 530 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetBrowsOfAoCols(Mat,Mat,MatReuse,PetscInt**,PetscScalar**,Mat*); 531 #if defined (PETSC_USE_CTABLE) 532 #include "petscctable.h" 533 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetCommunicationStructs(Mat, Vec *, PetscTable *, VecScatter *); 534 #else 535 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetCommunicationStructs(Mat, Vec *, PetscInt *[], VecScatter *); 536 #endif 537 538 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatIncreaseOverlap(Mat,PetscInt,IS[],PetscInt); 539 540 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMatMult(Mat,Mat,MatReuse,PetscReal,Mat*); 541 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMatMultSymbolic(Mat,Mat,PetscReal,Mat*); 542 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMatMultNumeric(Mat,Mat,Mat); 543 544 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPtAP(Mat,Mat,MatReuse,PetscReal,Mat*); 545 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPtAPSymbolic(Mat,Mat,PetscReal,Mat*); 546 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPtAPNumeric(Mat,Mat,Mat); 547 548 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMatMultTranspose(Mat,Mat,MatReuse,PetscReal,Mat*); 549 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMatMultTransposeSymbolic(Mat,Mat,PetscReal,Mat*); 550 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMatMultTransposeNumeric(Mat,Mat,Mat); 551 552 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatAXPY(Mat,PetscScalar,Mat,MatStructure); 553 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatAYPX(Mat,PetscScalar,Mat); 554 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCompress(Mat); 555 556 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatScale(Mat,PetscScalar); 557 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatShift(Mat,PetscScalar); 558 559 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetLocalToGlobalMapping(Mat,ISLocalToGlobalMapping); 560 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetLocalToGlobalMappingBlock(Mat,ISLocalToGlobalMapping); 561 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatZeroRowsLocal(Mat,PetscInt,const PetscInt [],PetscScalar); 562 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatZeroRowsLocalIS(Mat,IS,PetscScalar); 563 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetValuesLocal(Mat,PetscInt,const PetscInt[],PetscInt,const PetscInt[],const PetscScalar[],InsertMode); 564 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetValuesBlockedLocal(Mat,PetscInt,const PetscInt[],PetscInt,const PetscInt[],const PetscScalar[],InsertMode); 565 566 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatStashSetInitialSize(Mat,PetscInt,PetscInt); 567 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatStashGetInfo(Mat,PetscInt*,PetscInt*,PetscInt*,PetscInt*); 568 569 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatInterpolate(Mat,Vec,Vec); 570 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatInterpolateAdd(Mat,Vec,Vec,Vec); 571 PetscPolymorphicSubroutine(MatInterpolateAdd,(Mat A,Vec x,Vec y),(A,x,y,y)) 572 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatRestrict(Mat,Vec,Vec); 573 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetVecs(Mat,Vec*,Vec*); 574 575 /*MC 576 MatPreallocInitialize - Begins the block of code that will count the number of nonzeros per 577 row in a matrix providing the data that one can use to correctly preallocate the matrix. 578 579 Synopsis: 580 PetscErrorCode MatPreallocateInitialize(MPI_Comm comm, PetscInt nrows, PetscInt ncols, PetscInt *dnz, PetscInt *onz) 581 582 Collective on MPI_Comm 583 584 Input Parameters: 585 + comm - the communicator that will share the eventually allocated matrix 586 . nrows - the number of LOCAL rows in the matrix 587 - ncols - the number of LOCAL columns in the matrix 588 589 Output Parameters: 590 + dnz - the array that will be passed to the matrix preallocation routines 591 - ozn - the other array passed to the matrix preallocation routines 592 593 594 Level: intermediate 595 596 Notes: 597 See the chapter in the users manual on performance for more details 598 599 Do not malloc or free dnz and onz, that is handled internally by these routines 600 601 Use MatPreallocateInitializeSymmetric() for symmetric matrices (MPISBAIJ matrices) 602 603 Concepts: preallocation^Matrix 604 605 .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateSetLocal(), 606 MatPreallocateInitializeSymmetric(), MatPreallocateSymmetricSetLocal() 607 M*/ 608 #define MatPreallocateInitialize(comm,nrows,ncols,dnz,onz) 0; \ 609 { \ 610 PetscErrorCode _4_ierr; PetscInt __tmp = (nrows),__ctmp = (ncols),__rstart,__start,__end; \ 611 _4_ierr = PetscMalloc(2*__tmp*sizeof(PetscInt),&dnz);CHKERRQ(_4_ierr);onz = dnz + __tmp;\ 612 _4_ierr = PetscMemzero(dnz,2*__tmp*sizeof(PetscInt));CHKERRQ(_4_ierr);\ 613 _4_ierr = MPI_Scan(&__ctmp,&__end,1,MPIU_INT,MPI_SUM,comm);CHKERRQ(_4_ierr); __start = __end - __ctmp;\ 614 _4_ierr = MPI_Scan(&__tmp,&__rstart,1,MPIU_INT,MPI_SUM,comm);CHKERRQ(_4_ierr); __rstart = __rstart - __tmp; 615 616 /*MC 617 MatPreallocSymmetricInitialize - Begins the block of code that will count the number of nonzeros per 618 row in a matrix providing the data that one can use to correctly preallocate the matrix. 619 620 Synopsis: 621 PetscErrorCode MatPreallocateSymmetricInitialize(MPI_Comm comm, PetscInt nrows, PetscInt ncols, PetscInt *dnz, PetscInt *onz) 622 623 Collective on MPI_Comm 624 625 Input Parameters: 626 + comm - the communicator that will share the eventually allocated matrix 627 . nrows - the number of LOCAL rows in the matrix 628 - ncols - the number of LOCAL columns in the matrix 629 630 Output Parameters: 631 + dnz - the array that will be passed to the matrix preallocation routines 632 - ozn - the other array passed to the matrix preallocation routines 633 634 635 Level: intermediate 636 637 Notes: 638 See the chapter in the users manual on performance for more details 639 640 Do not malloc or free dnz and onz, that is handled internally by these routines 641 642 Concepts: preallocation^Matrix 643 644 .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateSetLocal(), 645 MatPreallocateInitialize(), MatPreallocateSymmetricSetLocal() 646 M*/ 647 #define MatPreallocateSymmetricInitialize(comm,nrows,ncols,dnz,onz) 0; \ 648 { \ 649 PetscErrorCode _4_ierr; PetscInt __tmp = (nrows),__ctmp = (ncols),__rstart,__end; \ 650 _4_ierr = PetscMalloc(2*__tmp*sizeof(PetscInt),&dnz);CHKERRQ(_4_ierr);onz = dnz + __tmp;\ 651 _4_ierr = PetscMemzero(dnz,2*__tmp*sizeof(PetscInt));CHKERRQ(_4_ierr);\ 652 _4_ierr = MPI_Scan(&__ctmp,&__end,1,MPIU_INT,MPI_SUM,comm);CHKERRQ(_4_ierr);\ 653 _4_ierr = MPI_Scan(&__tmp,&__rstart,1,MPIU_INT,MPI_SUM,comm);CHKERRQ(_4_ierr); __rstart = __rstart - __tmp; 654 655 /*MC 656 MatPreallocateSetLocal - Indicates the locations (rows and columns) in the matrix where nonzeros will be 657 inserted using a local number of the rows and columns 658 659 Synopsis: 660 PetscErrorCode MatPreallocateSetLocal(ISLocalToGlobalMappping map,PetscInt nrows, PetscInt *rows,PetscInt ncols, PetscInt *cols,PetscInt *dnz, PetscInt *onz) 661 662 Not Collective 663 664 Input Parameters: 665 + map - the mapping between local numbering and global numbering 666 . nrows - the number of rows indicated 667 . rows - the indices of the rows 668 . ncols - the number of columns in the matrix 669 . cols - the columns indicated 670 . dnz - the array that will be passed to the matrix preallocation routines 671 - ozn - the other array passed to the matrix preallocation routines 672 673 674 Level: intermediate 675 676 Notes: 677 See the chapter in the users manual on performance for more details 678 679 Do not malloc or free dnz and onz, that is handled internally by these routines 680 681 Concepts: preallocation^Matrix 682 683 .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateInitialize(), 684 MatPreallocateInitialize(), MatPreallocateSymmetricSetLocal() 685 M*/ 686 #define MatPreallocateSetLocal(map,nrows,rows,ncols,cols,dnz,onz) 0;\ 687 {\ 688 PetscInt __l;\ 689 _4_ierr = ISLocalToGlobalMappingApply(map,nrows,rows,rows);CHKERRQ(_4_ierr);\ 690 _4_ierr = ISLocalToGlobalMappingApply(map,ncols,cols,cols);CHKERRQ(_4_ierr);\ 691 for (__l=0;__l<nrows;__l++) {\ 692 _4_ierr = MatPreallocateSet((rows)[__l],ncols,cols,dnz,onz);CHKERRQ(_4_ierr);\ 693 }\ 694 } 695 696 /*MC 697 MatPreallocateSymmetricSetLocal - Indicates the locations (rows and columns) in the matrix where nonzeros will be 698 inserted using a local number of the rows and columns 699 700 Synopsis: 701 PetscErrorCode MatPreallocateSymmetricSetLocal(ISLocalToGlobalMappping map,PetscInt nrows, PetscInt *rows,PetscInt ncols, PetscInt *cols,PetscInt *dnz, PetscInt *onz) 702 703 Not Collective 704 705 Input Parameters: 706 + map - the mapping between local numbering and global numbering 707 . nrows - the number of rows indicated 708 . rows - the indices of the rows 709 . ncols - the number of columns in the matrix 710 . cols - the columns indicated 711 . dnz - the array that will be passed to the matrix preallocation routines 712 - ozn - the other array passed to the matrix preallocation routines 713 714 715 Level: intermediate 716 717 Notes: 718 See the chapter in the users manual on performance for more details 719 720 Do not malloc or free dnz and onz that is handled internally by these routines 721 722 Concepts: preallocation^Matrix 723 724 .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateInitialize(), 725 MatPreallocateInitialize(), MatPreallocateSymmetricSetLocal(), MatPreallocateSetLocal() 726 M*/ 727 #define MatPreallocateSymmetricSetLocal(map,nrows,rows,ncols,cols,dnz,onz) 0;\ 728 {\ 729 PetscInt __l;\ 730 _4_ierr = ISLocalToGlobalMappingApply(map,nrows,rows,rows);CHKERRQ(_4_ierr);\ 731 _4_ierr = ISLocalToGlobalMappingApply(map,ncols,cols,cols);CHKERRQ(_4_ierr);\ 732 for (__l=0;__l<nrows;__l++) {\ 733 _4_ierr = MatPreallocateSymmetricSet((rows)[__l],ncols,cols,dnz,onz);CHKERRQ(_4_ierr);\ 734 }\ 735 } 736 737 /*MC 738 MatPreallocateSet - Indicates the locations (rows and columns) in the matrix where nonzeros will be 739 inserted using a local number of the rows and columns 740 741 Synopsis: 742 PetscErrorCode MatPreallocateSet(PetscInt nrows, PetscInt *rows,PetscInt ncols, PetscInt *cols,PetscInt *dnz, PetscInt *onz) 743 744 Not Collective 745 746 Input Parameters: 747 + nrows - the number of rows indicated 748 . rows - the indices of the rows 749 . ncols - the number of columns in the matrix 750 - cols - the columns indicated 751 752 Output Parameters: 753 + dnz - the array that will be passed to the matrix preallocation routines 754 - ozn - the other array passed to the matrix preallocation routines 755 756 757 Level: intermediate 758 759 Notes: 760 See the chapter in the users manual on performance for more details 761 762 Do not malloc or free dnz and onz that is handled internally by these routines 763 764 Concepts: preallocation^Matrix 765 766 .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateInitialize(), 767 MatPreallocateInitialize(), MatPreallocateSymmetricSetLocal(), MatPreallocateSetLocal() 768 M*/ 769 #define MatPreallocateSet(row,nc,cols,dnz,onz) 0;\ 770 { PetscInt __i; \ 771 for (__i=0; __i<nc; __i++) {\ 772 if (cols[__i] < __start || cols[__i] >= __end) onz[row - __rstart]++; \ 773 }\ 774 dnz[row - __rstart] = nc - onz[row - __rstart];\ 775 } 776 777 /*MC 778 MatPreallocateSymmetricSet - Indicates the locations (rows and columns) in the matrix where nonzeros will be 779 inserted using a local number of the rows and columns 780 781 Synopsis: 782 PetscErrorCode MatPreallocateSymmetricSet(PetscInt nrows, PetscInt *rows,PetscInt ncols, PetscInt *cols,PetscInt *dnz, PetscInt *onz) 783 784 Not Collective 785 786 Input Parameters: 787 + nrows - the number of rows indicated 788 . rows - the indices of the rows 789 . ncols - the number of columns in the matrix 790 . cols - the columns indicated 791 . dnz - the array that will be passed to the matrix preallocation routines 792 - ozn - the other array passed to the matrix preallocation routines 793 794 795 Level: intermediate 796 797 Notes: 798 See the chapter in the users manual on performance for more details 799 800 Do not malloc or free dnz and onz that is handled internally by these routines 801 802 Concepts: preallocation^Matrix 803 804 .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateInitialize(), 805 MatPreallocateInitialize(), MatPreallocateSymmetricSetLocal(), MatPreallocateSetLocal() 806 M*/ 807 #define MatPreallocateSymmetricSet(row,nc,cols,dnz,onz) 0;\ 808 { PetscInt __i; \ 809 for (__i=0; __i<nc; __i++) {\ 810 if (cols[__i] >= __end) onz[row - __rstart]++; \ 811 else if (cols[__i] >= row) dnz[row - __rstart]++;\ 812 }\ 813 } 814 815 /*MC 816 MatPreallocFinalize - Ends the block of code that will count the number of nonzeros per 817 row in a matrix providing the data that one can use to correctly preallocate the matrix. 818 819 Synopsis: 820 PetscErrorCode MatPreallocateFinalize(PetscInt *dnz, PetscInt *onz) 821 822 Collective on MPI_Comm 823 824 Input Parameters: 825 + dnz - the array that will be passed to the matrix preallocation routines 826 - ozn - the other array passed to the matrix preallocation routines 827 828 829 Level: intermediate 830 831 Notes: 832 See the chapter in the users manual on performance for more details 833 834 Do not malloc or free dnz and onz that is handled internally by these routines 835 836 Concepts: preallocation^Matrix 837 838 .seealso: MatPreallocateInitialize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateSetLocal(), 839 MatPreallocateSymmetricInitialize(), MatPreallocateSymmetricSetLocal() 840 M*/ 841 #define MatPreallocateFinalize(dnz,onz) 0;_4_ierr = PetscFree(dnz);CHKERRQ(_4_ierr);} 842 843 844 845 /* Routines unique to particular data structures */ 846 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatShellGetContext(Mat,void **); 847 PetscPolymorphicFunction(MatShellGetContext,(Mat A),(A,&t),void*,t) 848 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatBDiagGetData(Mat,PetscInt*,PetscInt*,PetscInt*[],PetscInt*[],PetscScalar***); 849 850 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatInodeAdjustForInodes(Mat,IS*,IS*); 851 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatInodeGetInodeSizes(Mat,PetscInt *,PetscInt *[],PetscInt *); 852 853 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSeqAIJSetColumnIndices(Mat,PetscInt[]); 854 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSeqBAIJSetColumnIndices(Mat,PetscInt[]); 855 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateSeqAIJWithArrays(MPI_Comm,PetscInt,PetscInt,PetscInt[],PetscInt[],PetscScalar[],Mat*); 856 857 #define MAT_SKIP_ALLOCATION -4 858 859 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSeqBAIJSetPreallocation(Mat,PetscInt,PetscInt,const PetscInt[]); 860 PetscPolymorphicSubroutine(MatSeqBAIJSetPreallocation,(Mat A,PetscInt bs,const PetscInt nnz[]),(A,bs,0,nnz)) 861 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSeqSBAIJSetPreallocation(Mat,PetscInt,PetscInt,const PetscInt[]); 862 PetscPolymorphicSubroutine(MatSeqSBAIJSetPreallocation,(Mat A,PetscInt bs,const PetscInt nnz[]),(A,bs,0,nnz)) 863 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSeqAIJSetPreallocation(Mat,PetscInt,const PetscInt[]); 864 PetscPolymorphicSubroutine(MatSeqAIJSetPreallocation,(Mat A,const PetscInt nnz[]),(A,0,nnz)) 865 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSeqDensePreallocation(Mat,PetscScalar[]); 866 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSeqBDiagSetPreallocation(Mat,PetscInt,PetscInt,const PetscInt[],PetscScalar*[]); 867 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSeqDenseSetPreallocation(Mat,PetscScalar[]); 868 869 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPIBAIJSetPreallocation(Mat,PetscInt,PetscInt,const PetscInt[],PetscInt,const PetscInt[]); 870 PetscPolymorphicSubroutine(MatMPIBAIJSetPreallocation,(Mat A,PetscInt bs,const PetscInt nnz[],const PetscInt onz[]),(A,bs,0,nnz,0,onz)) 871 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPISBAIJSetPreallocation(Mat,PetscInt,PetscInt,const PetscInt[],PetscInt,const PetscInt[]); 872 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPIAIJSetPreallocation(Mat,PetscInt,const PetscInt[],PetscInt,const PetscInt[]); 873 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPIAIJSetPreallocationCSR(Mat,const PetscInt[],const PetscInt[],const PetscScalar[]); 874 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPIBAIJSetPreallocationCSR(Mat,PetscInt,const PetscInt[],const PetscInt[],const PetscScalar[]); 875 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPIDensePreallocation(Mat,PetscScalar[]); 876 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPIBDiagSetPreallocation(Mat,PetscInt,PetscInt,const PetscInt[],PetscScalar*[]); 877 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPIAdjSetPreallocation(Mat,PetscInt[],PetscInt[],PetscInt[]); 878 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPIDenseSetPreallocation(Mat,PetscScalar[]); 879 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPIRowbsSetPreallocation(Mat,PetscInt,const PetscInt[]); 880 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPIAIJGetSeqAIJ(Mat,Mat*,Mat*,PetscInt*[]); 881 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPIBAIJGetSeqBAIJ(Mat,Mat*,Mat*,PetscInt*[]); 882 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatAdicSetLocalFunction(Mat,void (*)(void)); 883 884 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSeqDenseSetLDA(Mat,PetscInt); 885 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatDenseGetLocalMatrix(Mat,Mat*); 886 887 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatStoreValues(Mat); 888 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatRetrieveValues(Mat); 889 890 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatDAADSetCtx(Mat,void*); 891 892 /* 893 These routines are not usually accessed directly, rather solving is 894 done through the KSP and PC interfaces. 895 */ 896 897 /*E 898 MatOrderingType - String with the name of a PETSc matrix ordering or the creation function 899 with an optional dynamic library name, for example 900 http://www.mcs.anl.gov/petsc/lib.a:orderingcreate() 901 902 Level: beginner 903 904 .seealso: MatGetOrdering() 905 E*/ 906 #define MatOrderingType char* 907 #define MATORDERING_NATURAL "natural" 908 #define MATORDERING_ND "nd" 909 #define MATORDERING_1WD "1wd" 910 #define MATORDERING_RCM "rcm" 911 #define MATORDERING_QMD "qmd" 912 #define MATORDERING_ROWLENGTH "rowlength" 913 #define MATORDERING_DSC_ND "dsc_nd" 914 #define MATORDERING_DSC_MMD "dsc_mmd" 915 #define MATORDERING_DSC_MDF "dsc_mdf" 916 #define MATORDERING_CONSTRAINED "constrained" 917 #define MATORDERING_IDENTITY "identity" 918 #define MATORDERING_REVERSE "reverse" 919 920 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetOrdering(Mat,const MatOrderingType,IS*,IS*); 921 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetOrderingList(PetscFList *list); 922 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatOrderingRegister(const char[],const char[],const char[],PetscErrorCode(*)(Mat,const MatOrderingType,IS*,IS*)); 923 924 /*MC 925 MatOrderingRegisterDynamic - Adds a new sparse matrix ordering to the 926 matrix package. 927 928 Synopsis: 929 PetscErrorCode MatOrderingRegisterDynamic(char *name_ordering,char *path,char *name_create,PetscErrorCode (*routine_create)(MatOrdering)) 930 931 Not Collective 932 933 Input Parameters: 934 + sname - name of ordering (for example MATORDERING_ND) 935 . path - location of library where creation routine is 936 . name - name of function that creates the ordering type,a string 937 - function - function pointer that creates the ordering 938 939 Level: developer 940 941 If dynamic libraries are used, then the fourth input argument (function) 942 is ignored. 943 944 Sample usage: 945 .vb 946 MatOrderingRegisterDynamic("my_order",/home/username/my_lib/lib/libO/solaris/mylib.a, 947 "MyOrder",MyOrder); 948 .ve 949 950 Then, your partitioner can be chosen with the procedural interface via 951 $ MatOrderingSetType(part,"my_order) 952 or at runtime via the option 953 $ -pc_ilu_mat_ordering_type my_order 954 $ -pc_lu_mat_ordering_type my_order 955 956 ${PETSC_ARCH} occuring in pathname will be replaced with appropriate values. 957 958 .keywords: matrix, ordering, register 959 960 .seealso: MatOrderingRegisterDestroy(), MatOrderingRegisterAll() 961 M*/ 962 #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 963 #define MatOrderingRegisterDynamic(a,b,c,d) MatOrderingRegister(a,b,c,0) 964 #else 965 #define MatOrderingRegisterDynamic(a,b,c,d) MatOrderingRegister(a,b,c,d) 966 #endif 967 968 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatOrderingRegisterDestroy(void); 969 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatOrderingRegisterAll(const char[]); 970 extern PetscTruth MatOrderingRegisterAllCalled; 971 extern PetscFList MatOrderingList; 972 973 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatReorderForNonzeroDiagonal(Mat,PetscReal,IS,IS); 974 975 /*S 976 MatFactorInfo - Data based into the matrix factorization routines 977 978 In Fortran these are simply double precision arrays of size MAT_FACTORINFO_SIZE 979 980 Notes: These are not usually directly used by users, instead use PC type of LU, ILU, CHOLESKY or ICC. 981 982 Level: developer 983 984 .seealso: MatLUFactorSymbolic(), MatILUFactorSymbolic(), MatCholeskyFactorSymbolic(), MatICCFactorSymbolic(), MatICCFactor(), 985 MatFactorInfoInitialize() 986 987 S*/ 988 typedef struct { 989 PetscReal shiftnz; /* scaling of identity added to matrix to prevent zero pivots */ 990 PetscReal shiftpd; /* if true, shift until positive pivots */ 991 PetscReal shift_fraction; /* record shift fraction taken */ 992 PetscReal diagonal_fill; /* force diagonal to fill in if initially not filled */ 993 PetscReal dt; /* drop tolerance */ 994 PetscReal dtcol; /* tolerance for pivoting */ 995 PetscReal dtcount; /* maximum nonzeros to be allowed per row */ 996 PetscReal fill; /* expected fill; nonzeros in factored matrix/nonzeros in original matrix*/ 997 PetscReal levels; /* ICC/ILU(levels) */ 998 PetscReal pivotinblocks; /* for BAIJ and SBAIJ matrices pivot in factorization on blocks, default 1.0 999 factorization may be faster if do not pivot */ 1000 PetscReal zeropivot; /* pivot is called zero if less than this */ 1001 } MatFactorInfo; 1002 1003 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFactorInfoInitialize(MatFactorInfo*); 1004 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCholeskyFactor(Mat,IS,MatFactorInfo*); 1005 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCholeskyFactorSymbolic(Mat,IS,MatFactorInfo*,Mat*); 1006 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCholeskyFactorNumeric(Mat,MatFactorInfo*,Mat*); 1007 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatLUFactor(Mat,IS,IS,MatFactorInfo*); 1008 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatILUFactor(Mat,IS,IS,MatFactorInfo*); 1009 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatLUFactorSymbolic(Mat,IS,IS,MatFactorInfo*,Mat*); 1010 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatILUFactorSymbolic(Mat,IS,IS,MatFactorInfo*,Mat*); 1011 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatICCFactorSymbolic(Mat,IS,MatFactorInfo*,Mat*); 1012 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatICCFactor(Mat,IS,MatFactorInfo*); 1013 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatLUFactorNumeric(Mat,MatFactorInfo*,Mat*); 1014 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatILUDTFactor(Mat,IS,IS,MatFactorInfo*,Mat *); 1015 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetInertia(Mat,PetscInt*,PetscInt*,PetscInt*); 1016 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSolve(Mat,Vec,Vec); 1017 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatForwardSolve(Mat,Vec,Vec); 1018 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatBackwardSolve(Mat,Vec,Vec); 1019 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSolveAdd(Mat,Vec,Vec,Vec); 1020 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSolveTranspose(Mat,Vec,Vec); 1021 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSolveTransposeAdd(Mat,Vec,Vec,Vec); 1022 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSolves(Mat,Vecs,Vecs); 1023 1024 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetUnfactored(Mat); 1025 1026 /*E 1027 MatSORType - What type of (S)SOR to perform 1028 1029 Level: beginner 1030 1031 May be bitwise ORd together 1032 1033 Any additions/changes here MUST also be made in include/finclude/petscmat.h 1034 1035 MatSORType may be bitwise ORd together, so do not change the numbers 1036 1037 .seealso: MatRelax(), MatPBRelax() 1038 E*/ 1039 typedef enum {SOR_FORWARD_SWEEP=1,SOR_BACKWARD_SWEEP=2,SOR_SYMMETRIC_SWEEP=3, 1040 SOR_LOCAL_FORWARD_SWEEP=4,SOR_LOCAL_BACKWARD_SWEEP=8, 1041 SOR_LOCAL_SYMMETRIC_SWEEP=12,SOR_ZERO_INITIAL_GUESS=16, 1042 SOR_EISENSTAT=32,SOR_APPLY_UPPER=64,SOR_APPLY_LOWER=128} MatSORType; 1043 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatRelax(Mat,Vec,PetscReal,MatSORType,PetscReal,PetscInt,PetscInt,Vec); 1044 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPBRelax(Mat,Vec,PetscReal,MatSORType,PetscReal,PetscInt,PetscInt,Vec); 1045 1046 /* 1047 These routines are for efficiently computing Jacobians via finite differences. 1048 */ 1049 1050 /*E 1051 MatColoringType - String with the name of a PETSc matrix coloring or the creation function 1052 with an optional dynamic library name, for example 1053 http://www.mcs.anl.gov/petsc/lib.a:coloringcreate() 1054 1055 Level: beginner 1056 1057 .seealso: MatGetColoring() 1058 E*/ 1059 #define MatColoringType char* 1060 #define MATCOLORING_NATURAL "natural" 1061 #define MATCOLORING_SL "sl" 1062 #define MATCOLORING_LF "lf" 1063 #define MATCOLORING_ID "id" 1064 1065 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetColoring(Mat,const MatColoringType,ISColoring*); 1066 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatColoringRegister(const char[],const char[],const char[],PetscErrorCode(*)(Mat,const MatColoringType,ISColoring *)); 1067 1068 /*MC 1069 MatColoringRegisterDynamic - Adds a new sparse matrix coloring to the 1070 matrix package. 1071 1072 Synopsis: 1073 PetscErrorCode MatColoringRegisterDynamic(char *name_coloring,char *path,char *name_create,PetscErrorCode (*routine_create)(MatColoring)) 1074 1075 Not Collective 1076 1077 Input Parameters: 1078 + sname - name of Coloring (for example MATCOLORING_SL) 1079 . path - location of library where creation routine is 1080 . name - name of function that creates the Coloring type, a string 1081 - function - function pointer that creates the coloring 1082 1083 Level: developer 1084 1085 If dynamic libraries are used, then the fourth input argument (function) 1086 is ignored. 1087 1088 Sample usage: 1089 .vb 1090 MatColoringRegisterDynamic("my_color",/home/username/my_lib/lib/libO/solaris/mylib.a, 1091 "MyColor",MyColor); 1092 .ve 1093 1094 Then, your partitioner can be chosen with the procedural interface via 1095 $ MatColoringSetType(part,"my_color") 1096 or at runtime via the option 1097 $ -mat_coloring_type my_color 1098 1099 $PETSC_ARCH occuring in pathname will be replaced with appropriate values. 1100 1101 .keywords: matrix, Coloring, register 1102 1103 .seealso: MatColoringRegisterDestroy(), MatColoringRegisterAll() 1104 M*/ 1105 #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 1106 #define MatColoringRegisterDynamic(a,b,c,d) MatColoringRegister(a,b,c,0) 1107 #else 1108 #define MatColoringRegisterDynamic(a,b,c,d) MatColoringRegister(a,b,c,d) 1109 #endif 1110 1111 extern PetscTruth MatColoringRegisterAllCalled; 1112 1113 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatColoringRegisterAll(const char[]); 1114 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatColoringRegisterDestroy(void); 1115 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatColoringPatch(Mat,PetscInt,PetscInt,ISColoringValue[],ISColoring*); 1116 1117 /*S 1118 MatFDColoring - Object for computing a sparse Jacobian via finite differences 1119 and coloring 1120 1121 Level: beginner 1122 1123 Concepts: coloring, sparse Jacobian, finite differences 1124 1125 .seealso: MatFDColoringCreate() 1126 S*/ 1127 typedef struct _p_MatFDColoring* MatFDColoring; 1128 1129 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFDColoringCreate(Mat,ISColoring,MatFDColoring *); 1130 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFDColoringDestroy(MatFDColoring); 1131 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFDColoringView(MatFDColoring,PetscViewer); 1132 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFDColoringSetFunction(MatFDColoring,PetscErrorCode (*)(void),void*); 1133 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFDColoringSetParameters(MatFDColoring,PetscReal,PetscReal); 1134 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFDColoringSetFrequency(MatFDColoring,PetscInt); 1135 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFDColoringGetFrequency(MatFDColoring,PetscInt*); 1136 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFDColoringSetFromOptions(MatFDColoring); 1137 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFDColoringApply(Mat,MatFDColoring,Vec,MatStructure*,void *); 1138 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFDColoringApplyTS(Mat,MatFDColoring,PetscReal,Vec,MatStructure*,void *); 1139 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFDColoringSetRecompute(MatFDColoring); 1140 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFDColoringSetF(MatFDColoring,Vec); 1141 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFDColoringGetPerturbedColumns(MatFDColoring,PetscInt*,PetscInt*[]); 1142 /* 1143 These routines are for partitioning matrices: currently used only 1144 for adjacency matrix, MatCreateMPIAdj(). 1145 */ 1146 1147 /*S 1148 MatPartitioning - Object for managing the partitioning of a matrix or graph 1149 1150 Level: beginner 1151 1152 Concepts: partitioning 1153 1154 .seealso: MatPartitioningCreate(), MatPartitioningType 1155 S*/ 1156 typedef struct _p_MatPartitioning* MatPartitioning; 1157 1158 /*E 1159 MatPartitioningType - String with the name of a PETSc matrix partitioning or the creation function 1160 with an optional dynamic library name, for example 1161 http://www.mcs.anl.gov/petsc/lib.a:partitioningcreate() 1162 1163 Level: beginner 1164 1165 .seealso: MatPartitioningCreate(), MatPartitioning 1166 E*/ 1167 #define MatPartitioningType char* 1168 #define MAT_PARTITIONING_CURRENT "current" 1169 #define MAT_PARTITIONING_SQUARE "square" 1170 #define MAT_PARTITIONING_PARMETIS "parmetis" 1171 #define MAT_PARTITIONING_CHACO "chaco" 1172 #define MAT_PARTITIONING_JOSTLE "jostle" 1173 #define MAT_PARTITIONING_PARTY "party" 1174 #define MAT_PARTITIONING_SCOTCH "scotch" 1175 1176 1177 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningCreate(MPI_Comm,MatPartitioning*); 1178 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningSetType(MatPartitioning,const MatPartitioningType); 1179 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningSetNParts(MatPartitioning,PetscInt); 1180 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningSetAdjacency(MatPartitioning,Mat); 1181 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningSetVertexWeights(MatPartitioning,const PetscInt[]); 1182 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningSetPartitionWeights(MatPartitioning,const PetscReal []); 1183 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningApply(MatPartitioning,IS*); 1184 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningDestroy(MatPartitioning); 1185 1186 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningRegister(const char[],const char[],const char[],PetscErrorCode (*)(MatPartitioning)); 1187 1188 /*MC 1189 MatPartitioningRegisterDynamic - Adds a new sparse matrix partitioning to the 1190 matrix package. 1191 1192 Synopsis: 1193 PetscErrorCode MatPartitioningRegisterDynamic(char *name_partitioning,char *path,char *name_create,PetscErrorCode (*routine_create)(MatPartitioning)) 1194 1195 Not Collective 1196 1197 Input Parameters: 1198 + sname - name of partitioning (for example MAT_PARTITIONING_CURRENT) or parmetis 1199 . path - location of library where creation routine is 1200 . name - name of function that creates the partitioning type, a string 1201 - function - function pointer that creates the partitioning type 1202 1203 Level: developer 1204 1205 If dynamic libraries are used, then the fourth input argument (function) 1206 is ignored. 1207 1208 Sample usage: 1209 .vb 1210 MatPartitioningRegisterDynamic("my_part",/home/username/my_lib/lib/libO/solaris/mylib.a, 1211 "MyPartCreate",MyPartCreate); 1212 .ve 1213 1214 Then, your partitioner can be chosen with the procedural interface via 1215 $ MatPartitioningSetType(part,"my_part") 1216 or at runtime via the option 1217 $ -mat_partitioning_type my_part 1218 1219 $PETSC_ARCH occuring in pathname will be replaced with appropriate values. 1220 1221 .keywords: matrix, partitioning, register 1222 1223 .seealso: MatPartitioningRegisterDestroy(), MatPartitioningRegisterAll() 1224 M*/ 1225 #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 1226 #define MatPartitioningRegisterDynamic(a,b,c,d) MatPartitioningRegister(a,b,c,0) 1227 #else 1228 #define MatPartitioningRegisterDynamic(a,b,c,d) MatPartitioningRegister(a,b,c,d) 1229 #endif 1230 1231 extern PetscTruth MatPartitioningRegisterAllCalled; 1232 1233 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningRegisterAll(const char[]); 1234 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningRegisterDestroy(void); 1235 1236 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningView(MatPartitioning,PetscViewer); 1237 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningSetFromOptions(MatPartitioning); 1238 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningGetType(MatPartitioning,MatPartitioningType*); 1239 1240 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningParmetisSetCoarseSequential(MatPartitioning); 1241 1242 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningJostleSetCoarseLevel(MatPartitioning,PetscReal); 1243 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningJostleSetCoarseSequential(MatPartitioning); 1244 1245 typedef enum { MP_CHACO_MULTILEVEL_KL, MP_CHACO_SPECTRAL, MP_CHACO_LINEAR, 1246 MP_CHACO_RANDOM, MP_CHACO_SCATTERED } MPChacoGlobalType; 1247 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningChacoSetGlobal(MatPartitioning, MPChacoGlobalType); 1248 typedef enum { MP_CHACO_KERNIGHAN_LIN, MP_CHACO_NONE } MPChacoLocalType; 1249 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningChacoSetLocal(MatPartitioning, MPChacoLocalType); 1250 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningChacoSetCoarseLevel(MatPartitioning,PetscReal); 1251 typedef enum { MP_CHACO_LANCZOS, MP_CHACO_RQI_SYMMLQ } MPChacoEigenType; 1252 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningChacoSetEigenSolver(MatPartitioning,MPChacoEigenType); 1253 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningChacoSetEigenTol(MatPartitioning, PetscReal); 1254 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningChacoSetEigenNumber(MatPartitioning, PetscInt); 1255 1256 #define MP_PARTY_OPT "opt" 1257 #define MP_PARTY_LIN "lin" 1258 #define MP_PARTY_SCA "sca" 1259 #define MP_PARTY_RAN "ran" 1260 #define MP_PARTY_GBF "gbf" 1261 #define MP_PARTY_GCF "gcf" 1262 #define MP_PARTY_BUB "bub" 1263 #define MP_PARTY_DEF "def" 1264 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningPartySetGlobal(MatPartitioning, const char*); 1265 #define MP_PARTY_HELPFUL_SETS "hs" 1266 #define MP_PARTY_KERNIGHAN_LIN "kl" 1267 #define MP_PARTY_NONE "no" 1268 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningPartySetLocal(MatPartitioning, const char*); 1269 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningPartySetCoarseLevel(MatPartitioning,PetscReal); 1270 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningPartySetBipart(MatPartitioning,PetscTruth); 1271 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningPartySetMatchOptimization(MatPartitioning,PetscTruth); 1272 1273 typedef enum { MP_SCOTCH_GREEDY, MP_SCOTCH_GPS, MP_SCOTCH_GR_GPS } MPScotchGlobalType; 1274 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningScotchSetArch(MatPartitioning,const char*); 1275 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningScotchSetMultilevel(MatPartitioning); 1276 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningScotchSetGlobal(MatPartitioning,MPScotchGlobalType); 1277 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningScotchSetCoarseLevel(MatPartitioning,PetscReal); 1278 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningScotchSetHostList(MatPartitioning,const char*); 1279 typedef enum { MP_SCOTCH_KERNIGHAN_LIN, MP_SCOTCH_NONE } MPScotchLocalType; 1280 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningScotchSetLocal(MatPartitioning,MPScotchLocalType); 1281 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningScotchSetMapping(MatPartitioning); 1282 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningScotchSetStrategy(MatPartitioning,char*); 1283 1284 /* 1285 If you add entries here you must also add them to finclude/petscmat.h 1286 */ 1287 typedef enum { MATOP_SET_VALUES=0, 1288 MATOP_GET_ROW=1, 1289 MATOP_RESTORE_ROW=2, 1290 MATOP_MULT=3, 1291 MATOP_MULT_ADD=4, 1292 MATOP_MULT_TRANSPOSE=5, 1293 MATOP_MULT_TRANSPOSE_ADD=6, 1294 MATOP_SOLVE=7, 1295 MATOP_SOLVE_ADD=8, 1296 MATOP_SOLVE_TRANSPOSE=9, 1297 MATOP_SOLVE_TRANSPOSE_ADD=10, 1298 MATOP_LUFACTOR=11, 1299 MATOP_CHOLESKYFACTOR=12, 1300 MATOP_RELAX=13, 1301 MATOP_TRANSPOSE=14, 1302 MATOP_GETINFO=15, 1303 MATOP_EQUAL=16, 1304 MATOP_GET_DIAGONAL=17, 1305 MATOP_DIAGONAL_SCALE=18, 1306 MATOP_NORM=19, 1307 MATOP_ASSEMBLY_BEGIN=20, 1308 MATOP_ASSEMBLY_END=21, 1309 MATOP_COMPRESS=22, 1310 MATOP_SET_OPTION=23, 1311 MATOP_ZERO_ENTRIES=24, 1312 MATOP_ZERO_ROWS=25, 1313 MATOP_LUFACTOR_SYMBOLIC=26, 1314 MATOP_LUFACTOR_NUMERIC=27, 1315 MATOP_CHOLESKY_FACTOR_SYMBOLIC=28, 1316 MATOP_CHOLESKY_FACTOR_NUMERIC=29, 1317 MATOP_SETUP_PREALLOCATION=30, 1318 MATOP_ILUFACTOR_SYMBOLIC=31, 1319 MATOP_ICCFACTOR_SYMBOLIC=32, 1320 MATOP_GET_ARRAY=33, 1321 MATOP_RESTORE_ARRAY=34, 1322 MATOP_DUPLICATE=35, 1323 MATOP_FORWARD_SOLVE=36, 1324 MATOP_BACKWARD_SOLVE=37, 1325 MATOP_ILUFACTOR=38, 1326 MATOP_ICCFACTOR=39, 1327 MATOP_AXPY=40, 1328 MATOP_GET_SUBMATRICES=41, 1329 MATOP_INCREASE_OVERLAP=42, 1330 MATOP_GET_VALUES=43, 1331 MATOP_COPY=44, 1332 MATOP_PRINT_HELP=45, 1333 MATOP_SCALE=46, 1334 MATOP_SHIFT=47, 1335 MATOP_DIAGONAL_SHIFT=48, 1336 MATOP_ILUDT_FACTOR=49, 1337 MATOP_GET_BLOCK_SIZE=50, 1338 MATOP_GET_ROW_IJ=51, 1339 MATOP_RESTORE_ROW_IJ=52, 1340 MATOP_GET_COLUMN_IJ=53, 1341 MATOP_RESTORE_COLUMN_IJ=54, 1342 MATOP_FDCOLORING_CREATE=55, 1343 MATOP_COLORING_PATCH=56, 1344 MATOP_SET_UNFACTORED=57, 1345 MATOP_PERMUTE=58, 1346 MATOP_SET_VALUES_BLOCKED=59, 1347 MATOP_GET_SUBMATRIX=60, 1348 MATOP_DESTROY=61, 1349 MATOP_VIEW=62, 1350 MATOP_GET_MAPS=63, 1351 MATOP_USE_SCALED_FORM=64, 1352 MATOP_SCALE_SYSTEM=65, 1353 MATOP_UNSCALE_SYSTEM=66, 1354 MATOP_SET_LOCAL_TO_GLOBAL_MAP=67, 1355 MATOP_SET_VALUES_LOCAL=68, 1356 MATOP_ZERO_ROWS_LOCAL=69, 1357 MATOP_GET_ROW_MAX=70, 1358 MATOP_CONVERT=71, 1359 MATOP_SET_COLORING=72, 1360 MATOP_SET_VALUES_ADIC=73, 1361 MATOP_SET_VALUES_ADIFOR=74, 1362 MATOP_FD_COLORING_APPLY=75, 1363 MATOP_SET_FROM_OPTIONS=76, 1364 MATOP_MULT_CON=77, 1365 MATOP_MULT_TRANSPOSE_CON=78, 1366 MATOP_ILU_FACTOR_SYMBOLIC_CON=79, 1367 MATOP_PERMUTE_SPARSIFY=80, 1368 MATOP_MULT_MULTIPLE=81, 1369 MATOP_SOLVE_MULTIPLE=82, 1370 MATOP_GET_INERTIA=83, 1371 MATOP_LOAD=84, 1372 MATOP_IS_SYMMETRIC=85, 1373 MATOP_IS_HERMITIAN=86, 1374 MATOP_IS_STRUCTURALLY_SYMMETRIC=87, 1375 MATOP_PB_RELAX=88, 1376 MATOP_GET_VECS=89, 1377 MATOP_MAT_MULT=90, 1378 MATOP_MAT_MULT_SYMBOLIC=91, 1379 MATOP_MAT_MULT_NUMERIC=92, 1380 MATOP_PTAP=93, 1381 MATOP_PTAP_SYMBOLIC=94, 1382 MATOP_PTAP_NUMERIC=95, 1383 MATOP_MAT_MULTTRANSPOSE=96, 1384 MATOP_MAT_MULTTRANSPOSE_SYMBOLIC=97, 1385 MATOP_MAT_MULTTRANSPOSE_NUMERIC=98, 1386 MATOP_PTAP_SYMBOLIC_SEQAIJ=99, 1387 MATOP_PTAP_NUMERIC_SEQAIJ=100, 1388 MATOP_PTAP_SYMBOLIC_MPIAIJ=101, 1389 MATOP_PTAP_NUMERIC_MPIAIJ=102 1390 } MatOperation; 1391 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatHasOperation(Mat,MatOperation,PetscTruth*); 1392 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatShellSetOperation(Mat,MatOperation,void(*)(void)); 1393 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatShellGetOperation(Mat,MatOperation,void(**)(void)); 1394 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatShellSetContext(Mat,void*); 1395 1396 /* 1397 Codes for matrices stored on disk. By default they are 1398 stored in a universal format. By changing the format with 1399 PetscViewerSetFormat(viewer,PETSC_VIEWER_BINARY_NATIVE); the matrices will 1400 be stored in a way natural for the matrix, for example dense matrices 1401 would be stored as dense. Matrices stored this way may only be 1402 read into matrices of the same time. 1403 */ 1404 #define MATRIX_BINARY_FORMAT_DENSE -1 1405 1406 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPIBAIJSetHashTableFactor(Mat,PetscReal); 1407 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPIRowbsGetColor(Mat,ISColoring *); 1408 1409 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatISGetLocalMat(Mat,Mat*); 1410 1411 /*S 1412 MatNullSpace - Object that removes a null space from a vector, i.e. 1413 orthogonalizes the vector to a subsapce 1414 1415 Level: advanced 1416 1417 Concepts: matrix; linear operator, null space 1418 1419 Users manual sections: 1420 . sec_singular 1421 1422 .seealso: MatNullSpaceCreate() 1423 S*/ 1424 typedef struct _p_MatNullSpace* MatNullSpace; 1425 1426 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatNullSpaceCreate(MPI_Comm,PetscTruth,PetscInt,const Vec[],MatNullSpace*); 1427 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatNullSpaceDestroy(MatNullSpace); 1428 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatNullSpaceRemove(MatNullSpace,Vec,Vec*); 1429 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatNullSpaceAttach(Mat,MatNullSpace); 1430 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatNullSpaceTest(MatNullSpace,Mat); 1431 1432 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatReorderingSeqSBAIJ(Mat,IS); 1433 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPISBAIJSetHashTableFactor(Mat,PetscReal); 1434 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSeqSBAIJSetColumnIndices(Mat,PetscInt *); 1435 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSeqBAIJInvertBlockDiagonal(Mat); 1436 1437 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateMAIJ(Mat,PetscInt,Mat*); 1438 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMAIJRedimension(Mat,PetscInt,Mat*); 1439 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMAIJGetAIJ(Mat,Mat*); 1440 1441 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatComputeExplicitOperator(Mat,Mat*); 1442 1443 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatDiagonalScaleLocal(Mat,Vec); 1444 1445 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT PetscViewerMathematicaPutMatrix(PetscViewer, PetscInt, PetscInt, PetscReal *); 1446 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT PetscViewerMathematicaPutCSRMatrix(PetscViewer, PetscInt, PetscInt, PetscInt *, PetscInt *, PetscReal *); 1447 1448 PETSC_EXTERN_CXX_END 1449 #endif 1450