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