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