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 738 EXTERN PetscErrorCode MatSeqAIJSetColumnIndices(Mat,PetscInt[]); 739 EXTERN PetscErrorCode MatSeqBAIJSetColumnIndices(Mat,PetscInt[]); 740 EXTERN PetscErrorCode MatCreateSeqAIJWithArrays(MPI_Comm,PetscInt,PetscInt,PetscInt[],PetscInt[],PetscScalar[],Mat*); 741 742 EXTERN PetscErrorCode MatSeqBAIJSetPreallocation(Mat,PetscInt,PetscInt,const PetscInt[]); 743 EXTERN PetscErrorCode MatSeqSBAIJSetPreallocation(Mat,PetscInt,PetscInt,const PetscInt[]); 744 EXTERN PetscErrorCode MatSeqAIJSetPreallocation(Mat,PetscInt,const PetscInt[]); 745 EXTERN PetscErrorCode MatSeqDensePreallocation(Mat,PetscScalar[]); 746 EXTERN PetscErrorCode MatSeqBDiagSetPreallocation(Mat,PetscInt,PetscInt,const PetscInt[],PetscScalar*[]); 747 EXTERN PetscErrorCode MatSeqDenseSetPreallocation(Mat,PetscScalar[]); 748 749 EXTERN PetscErrorCode MatMPIBAIJSetPreallocation(Mat,PetscInt,PetscInt,const PetscInt[],PetscInt,const PetscInt[]); 750 EXTERN PetscErrorCode MatMPISBAIJSetPreallocation(Mat,PetscInt,PetscInt,const PetscInt[],PetscInt,const PetscInt[]); 751 EXTERN PetscErrorCode MatMPIAIJSetPreallocation(Mat,PetscInt,const PetscInt[],PetscInt,const PetscInt[]); 752 EXTERN PetscErrorCode MatMPIAIJSetPreallocationCSR(Mat,const PetscInt[],const PetscInt[],const PetscScalar[]); 753 EXTERN PetscErrorCode MatMPIBAIJSetPreallocationCSR(Mat,PetscInt,const PetscInt[],const PetscInt[],const PetscScalar[]); 754 EXTERN PetscErrorCode MatMPIDensePreallocation(Mat,PetscScalar[]); 755 EXTERN PetscErrorCode MatMPIBDiagSetPreallocation(Mat,PetscInt,PetscInt,const PetscInt[],PetscScalar*[]); 756 EXTERN PetscErrorCode MatMPIAdjSetPreallocation(Mat,PetscInt[],PetscInt[],PetscInt[]); 757 EXTERN PetscErrorCode MatMPIDenseSetPreallocation(Mat,PetscScalar[]); 758 EXTERN PetscErrorCode MatMPIRowbsSetPreallocation(Mat,PetscInt,const PetscInt[]); 759 EXTERN PetscErrorCode MatMPIAIJGetSeqAIJ(Mat,Mat*,Mat*,PetscInt*[]); 760 EXTERN PetscErrorCode MatMPIBAIJGetSeqBAIJ(Mat,Mat*,Mat*,PetscInt*[]); 761 EXTERN PetscErrorCode MatAdicSetLocalFunction(Mat,void (*)(void)); 762 763 EXTERN PetscErrorCode MatSeqDenseSetLDA(Mat,PetscInt); 764 765 EXTERN PetscErrorCode MatStoreValues(Mat); 766 EXTERN PetscErrorCode MatRetrieveValues(Mat); 767 768 EXTERN PetscErrorCode MatDAADSetCtx(Mat,void*); 769 770 /* 771 These routines are not usually accessed directly, rather solving is 772 done through the KSP and PC interfaces. 773 */ 774 775 /*E 776 MatOrderingType - String with the name of a PETSc matrix ordering or the creation function 777 with an optional dynamic library name, for example 778 http://www.mcs.anl.gov/petsc/lib.a:orderingcreate() 779 780 Level: beginner 781 782 .seealso: MatGetOrdering() 783 E*/ 784 #define MatOrderingType char* 785 #define MATORDERING_NATURAL "natural" 786 #define MATORDERING_ND "nd" 787 #define MATORDERING_1WD "1wd" 788 #define MATORDERING_RCM "rcm" 789 #define MATORDERING_QMD "qmd" 790 #define MATORDERING_ROWLENGTH "rowlength" 791 #define MATORDERING_DSC_ND "dsc_nd" 792 #define MATORDERING_DSC_MMD "dsc_mmd" 793 #define MATORDERING_DSC_MDF "dsc_mdf" 794 #define MATORDERING_CONSTRAINED "constrained" 795 #define MATORDERING_IDENTITY "identity" 796 #define MATORDERING_REVERSE "reverse" 797 798 EXTERN PetscErrorCode MatGetOrdering(Mat,const MatOrderingType,IS*,IS*); 799 EXTERN PetscErrorCode MatOrderingRegister(const char[],const char[],const char[],PetscErrorCode(*)(Mat,const MatOrderingType,IS*,IS*)); 800 801 /*MC 802 MatOrderingRegisterDynamic - Adds a new sparse matrix ordering to the 803 matrix package. 804 805 Synopsis: 806 PetscErrorCode MatOrderingRegisterDynamic(char *name_ordering,char *path,char *name_create,PetscErrorCode (*routine_create)(MatOrdering)) 807 808 Not Collective 809 810 Input Parameters: 811 + sname - name of ordering (for example MATORDERING_ND) 812 . path - location of library where creation routine is 813 . name - name of function that creates the ordering type,a string 814 - function - function pointer that creates the ordering 815 816 Level: developer 817 818 If dynamic libraries are used, then the fourth input argument (function) 819 is ignored. 820 821 Sample usage: 822 .vb 823 MatOrderingRegisterDynamic("my_order",/home/username/my_lib/lib/libO/solaris/mylib.a, 824 "MyOrder",MyOrder); 825 .ve 826 827 Then, your partitioner can be chosen with the procedural interface via 828 $ MatOrderingSetType(part,"my_order) 829 or at runtime via the option 830 $ -pc_ilu_mat_ordering_type my_order 831 $ -pc_lu_mat_ordering_type my_order 832 833 ${PETSC_ARCH} occuring in pathname will be replaced with appropriate values. 834 835 .keywords: matrix, ordering, register 836 837 .seealso: MatOrderingRegisterDestroy(), MatOrderingRegisterAll() 838 M*/ 839 #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 840 #define MatOrderingRegisterDynamic(a,b,c,d) MatOrderingRegister(a,b,c,0) 841 #else 842 #define MatOrderingRegisterDynamic(a,b,c,d) MatOrderingRegister(a,b,c,d) 843 #endif 844 845 EXTERN PetscErrorCode MatOrderingRegisterDestroy(void); 846 EXTERN PetscErrorCode MatOrderingRegisterAll(const char[]); 847 extern PetscTruth MatOrderingRegisterAllCalled; 848 extern PetscFList MatOrderingList; 849 850 EXTERN PetscErrorCode MatReorderForNonzeroDiagonal(Mat,PetscReal,IS,IS); 851 852 /*S 853 MatFactorInfo - Data based into the matrix factorization routines 854 855 In Fortran these are simply double precision arrays of size MAT_FACTORINFO_SIZE 856 857 Notes: These are not usually directly used by users, instead use PC type of LU, ILU, CHOLESKY or ICC. 858 859 Level: developer 860 861 .seealso: MatLUFactorSymbolic(), MatILUFactorSymbolic(), MatCholeskyFactorSymbolic(), MatICCFactorSymbolic(), MatICCFactor(), 862 MatFactorInfoInitialize() 863 864 S*/ 865 typedef struct { 866 PetscReal shiftnz; /* scaling of identity added to matrix to prevent zero pivots */ 867 PetscTruth shiftpd; /* if true, shift until positive pivots */ 868 PetscReal shift_fraction; /* record shift fraction taken */ 869 PetscReal diagonal_fill; /* force diagonal to fill in if initially not filled */ 870 PetscReal dt; /* drop tolerance */ 871 PetscReal dtcol; /* tolerance for pivoting */ 872 PetscReal dtcount; /* maximum nonzeros to be allowed per row */ 873 PetscReal fill; /* expected fill; nonzeros in factored matrix/nonzeros in original matrix*/ 874 PetscReal levels; /* ICC/ILU(levels) */ 875 PetscReal pivotinblocks; /* for BAIJ and SBAIJ matrices pivot in factorization on blocks, default 1.0 876 factorization may be faster if do not pivot */ 877 PetscReal zeropivot; /* pivot is called zero if less than this */ 878 } MatFactorInfo; 879 880 EXTERN PetscErrorCode MatFactorInfoInitialize(MatFactorInfo*); 881 EXTERN PetscErrorCode MatCholeskyFactor(Mat,IS,MatFactorInfo*); 882 EXTERN PetscErrorCode MatCholeskyFactorSymbolic(Mat,IS,MatFactorInfo*,Mat*); 883 EXTERN PetscErrorCode MatCholeskyFactorNumeric(Mat,MatFactorInfo*,Mat*); 884 EXTERN PetscErrorCode MatLUFactor(Mat,IS,IS,MatFactorInfo*); 885 EXTERN PetscErrorCode MatILUFactor(Mat,IS,IS,MatFactorInfo*); 886 EXTERN PetscErrorCode MatLUFactorSymbolic(Mat,IS,IS,MatFactorInfo*,Mat*); 887 EXTERN PetscErrorCode MatILUFactorSymbolic(Mat,IS,IS,MatFactorInfo*,Mat*); 888 EXTERN PetscErrorCode MatICCFactorSymbolic(Mat,IS,MatFactorInfo*,Mat*); 889 EXTERN PetscErrorCode MatICCFactor(Mat,IS,MatFactorInfo*); 890 EXTERN PetscErrorCode MatLUFactorNumeric(Mat,MatFactorInfo*,Mat*); 891 EXTERN PetscErrorCode MatILUDTFactor(Mat,MatFactorInfo*,IS,IS,Mat *); 892 EXTERN PetscErrorCode MatGetInertia(Mat,PetscInt*,PetscInt*,PetscInt*); 893 EXTERN PetscErrorCode MatSolve(Mat,Vec,Vec); 894 EXTERN PetscErrorCode MatForwardSolve(Mat,Vec,Vec); 895 EXTERN PetscErrorCode MatBackwardSolve(Mat,Vec,Vec); 896 EXTERN PetscErrorCode MatSolveAdd(Mat,Vec,Vec,Vec); 897 EXTERN PetscErrorCode MatSolveTranspose(Mat,Vec,Vec); 898 EXTERN PetscErrorCode MatSolveTransposeAdd(Mat,Vec,Vec,Vec); 899 EXTERN PetscErrorCode MatSolves(Mat,Vecs,Vecs); 900 901 EXTERN PetscErrorCode MatSetUnfactored(Mat); 902 903 /*E 904 MatSORType - What type of (S)SOR to perform 905 906 Level: beginner 907 908 May be bitwise ORd together 909 910 Any additions/changes here MUST also be made in include/finclude/petscmat.h 911 912 MatSORType may be bitwise ORd together, so do not change the numbers 913 914 .seealso: MatRelax(), MatPBRelax() 915 E*/ 916 typedef enum {SOR_FORWARD_SWEEP=1,SOR_BACKWARD_SWEEP=2,SOR_SYMMETRIC_SWEEP=3, 917 SOR_LOCAL_FORWARD_SWEEP=4,SOR_LOCAL_BACKWARD_SWEEP=8, 918 SOR_LOCAL_SYMMETRIC_SWEEP=12,SOR_ZERO_INITIAL_GUESS=16, 919 SOR_EISENSTAT=32,SOR_APPLY_UPPER=64,SOR_APPLY_LOWER=128} MatSORType; 920 EXTERN PetscErrorCode MatRelax(Mat,Vec,PetscReal,MatSORType,PetscReal,PetscInt,PetscInt,Vec); 921 EXTERN PetscErrorCode MatPBRelax(Mat,Vec,PetscReal,MatSORType,PetscReal,PetscInt,PetscInt,Vec); 922 923 /* 924 These routines are for efficiently computing Jacobians via finite differences. 925 */ 926 927 /*E 928 MatColoringType - String with the name of a PETSc matrix coloring or the creation function 929 with an optional dynamic library name, for example 930 http://www.mcs.anl.gov/petsc/lib.a:coloringcreate() 931 932 Level: beginner 933 934 .seealso: MatGetColoring() 935 E*/ 936 #define MatColoringType char* 937 #define MATCOLORING_NATURAL "natural" 938 #define MATCOLORING_SL "sl" 939 #define MATCOLORING_LF "lf" 940 #define MATCOLORING_ID "id" 941 942 EXTERN PetscErrorCode MatGetColoring(Mat,const MatColoringType,ISColoring*); 943 EXTERN PetscErrorCode MatColoringRegister(const char[],const char[],const char[],PetscErrorCode(*)(Mat,const MatColoringType,ISColoring *)); 944 945 /*MC 946 MatColoringRegisterDynamic - Adds a new sparse matrix coloring to the 947 matrix package. 948 949 Synopsis: 950 PetscErrorCode MatColoringRegisterDynamic(char *name_coloring,char *path,char *name_create,PetscErrorCode (*routine_create)(MatColoring)) 951 952 Not Collective 953 954 Input Parameters: 955 + sname - name of Coloring (for example MATCOLORING_SL) 956 . path - location of library where creation routine is 957 . name - name of function that creates the Coloring type, a string 958 - function - function pointer that creates the coloring 959 960 Level: developer 961 962 If dynamic libraries are used, then the fourth input argument (function) 963 is ignored. 964 965 Sample usage: 966 .vb 967 MatColoringRegisterDynamic("my_color",/home/username/my_lib/lib/libO/solaris/mylib.a, 968 "MyColor",MyColor); 969 .ve 970 971 Then, your partitioner can be chosen with the procedural interface via 972 $ MatColoringSetType(part,"my_color") 973 or at runtime via the option 974 $ -mat_coloring_type my_color 975 976 $PETSC_ARCH occuring in pathname will be replaced with appropriate values. 977 978 .keywords: matrix, Coloring, register 979 980 .seealso: MatColoringRegisterDestroy(), MatColoringRegisterAll() 981 M*/ 982 #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 983 #define MatColoringRegisterDynamic(a,b,c,d) MatColoringRegister(a,b,c,0) 984 #else 985 #define MatColoringRegisterDynamic(a,b,c,d) MatColoringRegister(a,b,c,d) 986 #endif 987 988 extern PetscTruth MatColoringRegisterAllCalled; 989 990 EXTERN PetscErrorCode MatColoringRegisterAll(const char[]); 991 EXTERN PetscErrorCode MatColoringRegisterDestroy(void); 992 EXTERN PetscErrorCode MatColoringPatch(Mat,PetscInt,PetscInt,ISColoringValue[],ISColoring*); 993 994 /*S 995 MatFDColoring - Object for computing a sparse Jacobian via finite differences 996 and coloring 997 998 Level: beginner 999 1000 Concepts: coloring, sparse Jacobian, finite differences 1001 1002 .seealso: MatFDColoringCreate() 1003 S*/ 1004 typedef struct _p_MatFDColoring *MatFDColoring; 1005 1006 EXTERN PetscErrorCode MatFDColoringCreate(Mat,ISColoring,MatFDColoring *); 1007 EXTERN PetscErrorCode MatFDColoringDestroy(MatFDColoring); 1008 EXTERN PetscErrorCode MatFDColoringView(MatFDColoring,PetscViewer); 1009 EXTERN PetscErrorCode MatFDColoringSetFunction(MatFDColoring,PetscErrorCode (*)(void),void*); 1010 EXTERN PetscErrorCode MatFDColoringSetParameters(MatFDColoring,PetscReal,PetscReal); 1011 EXTERN PetscErrorCode MatFDColoringSetFrequency(MatFDColoring,PetscInt); 1012 EXTERN PetscErrorCode MatFDColoringGetFrequency(MatFDColoring,PetscInt*); 1013 EXTERN PetscErrorCode MatFDColoringSetFromOptions(MatFDColoring); 1014 EXTERN PetscErrorCode MatFDColoringApply(Mat,MatFDColoring,Vec,MatStructure*,void *); 1015 EXTERN PetscErrorCode MatFDColoringApplyTS(Mat,MatFDColoring,PetscReal,Vec,MatStructure*,void *); 1016 EXTERN PetscErrorCode MatFDColoringSetRecompute(MatFDColoring); 1017 EXTERN PetscErrorCode MatFDColoringSetF(MatFDColoring,Vec); 1018 EXTERN PetscErrorCode MatFDColoringGetPerturbedColumns(MatFDColoring,PetscInt*,PetscInt*[]); 1019 /* 1020 These routines are for partitioning matrices: currently used only 1021 for adjacency matrix, MatCreateMPIAdj(). 1022 */ 1023 1024 /*S 1025 MatPartitioning - Object for managing the partitioning of a matrix or graph 1026 1027 Level: beginner 1028 1029 Concepts: partitioning 1030 1031 .seealso: MatPartitioningCreate(), MatPartitioningType 1032 S*/ 1033 typedef struct _p_MatPartitioning *MatPartitioning; 1034 1035 /*E 1036 MatPartitioningType - String with the name of a PETSc matrix partitioning or the creation function 1037 with an optional dynamic library name, for example 1038 http://www.mcs.anl.gov/petsc/lib.a:partitioningcreate() 1039 1040 Level: beginner 1041 1042 .seealso: MatPartitioningCreate(), MatPartitioning 1043 E*/ 1044 #define MatPartitioningType char* 1045 #define MAT_PARTITIONING_CURRENT "current" 1046 #define MAT_PARTITIONING_SQUARE "square" 1047 #define MAT_PARTITIONING_PARMETIS "parmetis" 1048 #define MAT_PARTITIONING_CHACO "chaco" 1049 #define MAT_PARTITIONING_JOSTLE "jostle" 1050 #define MAT_PARTITIONING_PARTY "party" 1051 #define MAT_PARTITIONING_SCOTCH "scotch" 1052 1053 1054 EXTERN PetscErrorCode MatPartitioningCreate(MPI_Comm,MatPartitioning*); 1055 EXTERN PetscErrorCode MatPartitioningSetType(MatPartitioning,const MatPartitioningType); 1056 EXTERN PetscErrorCode MatPartitioningSetNParts(MatPartitioning,PetscInt); 1057 EXTERN PetscErrorCode MatPartitioningSetAdjacency(MatPartitioning,Mat); 1058 EXTERN PetscErrorCode MatPartitioningSetVertexWeights(MatPartitioning,const PetscInt[]); 1059 EXTERN PetscErrorCode MatPartitioningSetPartitionWeights(MatPartitioning,const PetscReal []); 1060 EXTERN PetscErrorCode MatPartitioningApply(MatPartitioning,IS*); 1061 EXTERN PetscErrorCode MatPartitioningDestroy(MatPartitioning); 1062 1063 EXTERN PetscErrorCode MatPartitioningRegister(const char[],const char[],const char[],PetscErrorCode (*)(MatPartitioning)); 1064 1065 /*MC 1066 MatPartitioningRegisterDynamic - Adds a new sparse matrix partitioning to the 1067 matrix package. 1068 1069 Synopsis: 1070 PetscErrorCode MatPartitioningRegisterDynamic(char *name_partitioning,char *path,char *name_create,PetscErrorCode (*routine_create)(MatPartitioning)) 1071 1072 Not Collective 1073 1074 Input Parameters: 1075 + sname - name of partitioning (for example MAT_PARTITIONING_CURRENT) or parmetis 1076 . path - location of library where creation routine is 1077 . name - name of function that creates the partitioning type, a string 1078 - function - function pointer that creates the partitioning type 1079 1080 Level: developer 1081 1082 If dynamic libraries are used, then the fourth input argument (function) 1083 is ignored. 1084 1085 Sample usage: 1086 .vb 1087 MatPartitioningRegisterDynamic("my_part",/home/username/my_lib/lib/libO/solaris/mylib.a, 1088 "MyPartCreate",MyPartCreate); 1089 .ve 1090 1091 Then, your partitioner can be chosen with the procedural interface via 1092 $ MatPartitioningSetType(part,"my_part") 1093 or at runtime via the option 1094 $ -mat_partitioning_type my_part 1095 1096 $PETSC_ARCH occuring in pathname will be replaced with appropriate values. 1097 1098 .keywords: matrix, partitioning, register 1099 1100 .seealso: MatPartitioningRegisterDestroy(), MatPartitioningRegisterAll() 1101 M*/ 1102 #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 1103 #define MatPartitioningRegisterDynamic(a,b,c,d) MatPartitioningRegister(a,b,c,0) 1104 #else 1105 #define MatPartitioningRegisterDynamic(a,b,c,d) MatPartitioningRegister(a,b,c,d) 1106 #endif 1107 1108 extern PetscTruth MatPartitioningRegisterAllCalled; 1109 1110 EXTERN PetscErrorCode MatPartitioningRegisterAll(const char[]); 1111 EXTERN PetscErrorCode MatPartitioningRegisterDestroy(void); 1112 1113 EXTERN PetscErrorCode MatPartitioningView(MatPartitioning,PetscViewer); 1114 EXTERN PetscErrorCode MatPartitioningSetFromOptions(MatPartitioning); 1115 EXTERN PetscErrorCode MatPartitioningGetType(MatPartitioning,MatPartitioningType*); 1116 1117 EXTERN PetscErrorCode MatPartitioningParmetisSetCoarseSequential(MatPartitioning); 1118 1119 EXTERN PetscErrorCode MatPartitioningJostleSetCoarseLevel(MatPartitioning,PetscReal); 1120 EXTERN PetscErrorCode MatPartitioningJostleSetCoarseSequential(MatPartitioning); 1121 1122 typedef enum { MP_CHACO_MULTILEVEL_KL, MP_CHACO_SPECTRAL, MP_CHACO_LINEAR, 1123 MP_CHACO_RANDOM, MP_CHACO_SCATTERED } MPChacoGlobalType; 1124 EXTERN PetscErrorCode MatPartitioningChacoSetGlobal(MatPartitioning, MPChacoGlobalType); 1125 typedef enum { MP_CHACO_KERNIGHAN_LIN, MP_CHACO_NONE } MPChacoLocalType; 1126 EXTERN PetscErrorCode MatPartitioningChacoSetLocal(MatPartitioning, MPChacoLocalType); 1127 EXTERN PetscErrorCode MatPartitioningChacoSetCoarseLevel(MatPartitioning,PetscReal); 1128 typedef enum { MP_CHACO_LANCZOS, MP_CHACO_RQI_SYMMLQ } MPChacoEigenType; 1129 EXTERN PetscErrorCode MatPartitioningChacoSetEigenSolver(MatPartitioning,MPChacoEigenType); 1130 EXTERN PetscErrorCode MatPartitioningChacoSetEigenTol(MatPartitioning, PetscReal); 1131 EXTERN PetscErrorCode MatPartitioningChacoSetEigenNumber(MatPartitioning, PetscInt); 1132 1133 #define MP_PARTY_OPT "opt" 1134 #define MP_PARTY_LIN "lin" 1135 #define MP_PARTY_SCA "sca" 1136 #define MP_PARTY_RAN "ran" 1137 #define MP_PARTY_GBF "gbf" 1138 #define MP_PARTY_GCF "gcf" 1139 #define MP_PARTY_BUB "bub" 1140 #define MP_PARTY_DEF "def" 1141 EXTERN PetscErrorCode MatPartitioningPartySetGlobal(MatPartitioning, const char*); 1142 #define MP_PARTY_HELPFUL_SETS "hs" 1143 #define MP_PARTY_KERNIGHAN_LIN "kl" 1144 #define MP_PARTY_NONE "no" 1145 EXTERN PetscErrorCode MatPartitioningPartySetLocal(MatPartitioning, const char*); 1146 EXTERN PetscErrorCode MatPartitioningPartySetCoarseLevel(MatPartitioning,PetscReal); 1147 EXTERN PetscErrorCode MatPartitioningPartySetBipart(MatPartitioning,PetscTruth); 1148 EXTERN PetscErrorCode MatPartitioningPartySetMatchOptimization(MatPartitioning,PetscTruth); 1149 1150 typedef enum { MP_SCOTCH_GREEDY, MP_SCOTCH_GPS, MP_SCOTCH_GR_GPS } MPScotchGlobalType; 1151 EXTERN PetscErrorCode MatPartitioningScotchSetArch(MatPartitioning,const char*); 1152 EXTERN PetscErrorCode MatPartitioningScotchSetMultilevel(MatPartitioning); 1153 EXTERN PetscErrorCode MatPartitioningScotchSetGlobal(MatPartitioning,MPScotchGlobalType); 1154 EXTERN PetscErrorCode MatPartitioningScotchSetCoarseLevel(MatPartitioning,PetscReal); 1155 EXTERN PetscErrorCode MatPartitioningScotchSetHostList(MatPartitioning,const char*); 1156 typedef enum { MP_SCOTCH_KERNIGHAN_LIN, MP_SCOTCH_NONE } MPScotchLocalType; 1157 EXTERN PetscErrorCode MatPartitioningScotchSetLocal(MatPartitioning,MPScotchLocalType); 1158 EXTERN PetscErrorCode MatPartitioningScotchSetMapping(MatPartitioning); 1159 EXTERN PetscErrorCode MatPartitioningScotchSetStrategy(MatPartitioning,char*); 1160 1161 /* 1162 If you add entries here you must also add them to finclude/petscmat.h 1163 */ 1164 typedef enum { MATOP_SET_VALUES=0, 1165 MATOP_GET_ROW=1, 1166 MATOP_RESTORE_ROW=2, 1167 MATOP_MULT=3, 1168 MATOP_MULT_ADD=4, 1169 MATOP_MULT_TRANSPOSE=5, 1170 MATOP_MULT_TRANSPOSE_ADD=6, 1171 MATOP_SOLVE=7, 1172 MATOP_SOLVE_ADD=8, 1173 MATOP_SOLVE_TRANSPOSE=9, 1174 MATOP_SOLVE_TRANSPOSE_ADD=10, 1175 MATOP_LUFACTOR=11, 1176 MATOP_CHOLESKYFACTOR=12, 1177 MATOP_RELAX=13, 1178 MATOP_TRANSPOSE=14, 1179 MATOP_GETINFO=15, 1180 MATOP_EQUAL=16, 1181 MATOP_GET_DIAGONAL=17, 1182 MATOP_DIAGONAL_SCALE=18, 1183 MATOP_NORM=19, 1184 MATOP_ASSEMBLY_BEGIN=20, 1185 MATOP_ASSEMBLY_END=21, 1186 MATOP_COMPRESS=22, 1187 MATOP_SET_OPTION=23, 1188 MATOP_ZERO_ENTRIES=24, 1189 MATOP_ZERO_ROWS=25, 1190 MATOP_LUFACTOR_SYMBOLIC=26, 1191 MATOP_LUFACTOR_NUMERIC=27, 1192 MATOP_CHOLESKY_FACTOR_SYMBOLIC=28, 1193 MATOP_CHOLESKY_FACTOR_NUMERIC=29, 1194 MATOP_SETUP_PREALLOCATION=30, 1195 MATOP_ILUFACTOR_SYMBOLIC=31, 1196 MATOP_ICCFACTOR_SYMBOLIC=32, 1197 MATOP_GET_ARRAY=33, 1198 MATOP_RESTORE_ARRAY=34, 1199 MATOP_DUPLCIATE=35, 1200 MATOP_FORWARD_SOLVE=36, 1201 MATOP_BACKWARD_SOLVE=37, 1202 MATOP_ILUFACTOR=38, 1203 MATOP_ICCFACTOR=39, 1204 MATOP_AXPY=40, 1205 MATOP_GET_SUBMATRICES=41, 1206 MATOP_INCREASE_OVERLAP=42, 1207 MATOP_GET_VALUES=43, 1208 MATOP_COPY=44, 1209 MATOP_PRINT_HELP=45, 1210 MATOP_SCALE=46, 1211 MATOP_SHIFT=47, 1212 MATOP_DIAGONAL_SHIFT=48, 1213 MATOP_ILUDT_FACTOR=49, 1214 MATOP_GET_BLOCK_SIZE=50, 1215 MATOP_GET_ROW_IJ=51, 1216 MATOP_RESTORE_ROW_IJ=52, 1217 MATOP_GET_COLUMN_IJ=53, 1218 MATOP_RESTORE_COLUMN_IJ=54, 1219 MATOP_FDCOLORING_CREATE=55, 1220 MATOP_COLORING_PATCH=56, 1221 MATOP_SET_UNFACTORED=57, 1222 MATOP_PERMUTE=58, 1223 MATOP_SET_VALUES_BLOCKED=59, 1224 MATOP_GET_SUBMATRIX=60, 1225 MATOP_DESTROY=61, 1226 MATOP_VIEW=62, 1227 MATOP_GET_MAPS=63, 1228 MATOP_USE_SCALED_FORM=64, 1229 MATOP_SCALE_SYSTEM=65, 1230 MATOP_UNSCALE_SYSTEM=66, 1231 MATOP_SET_LOCAL_TO_GLOBAL_MAP=67, 1232 MATOP_SET_VALUES_LOCAL=68, 1233 MATOP_ZERO_ROWS_LOCAL=69, 1234 MATOP_GET_ROW_MAX=70, 1235 MATOP_CONVERT=71, 1236 MATOP_SET_COLORING=72, 1237 MATOP_SET_VALUES_ADIC=73, 1238 MATOP_SET_VALUES_ADIFOR=74, 1239 MATOP_FD_COLORING_APPLY=75, 1240 MATOP_SET_FROM_OPTIONS=76, 1241 MATOP_MULT_CON=77, 1242 MATOP_MULT_TRANSPOSE_CON=78, 1243 MATOP_ILU_FACTOR_SYMBOLIC_CON=79, 1244 MATOP_PERMUTE_SPARSIFY=80, 1245 MATOP_MULT_MULTIPLE=81, 1246 MATOP_SOLVE_MULTIPLE=82, 1247 MATOP_GET_INERTIA=83, 1248 MATOP_LOAD=84, 1249 MATOP_IS_SYMMETRIC=85, 1250 MATOP_IS_HERMITIAN=86, 1251 MATOP_IS_STRUCTURALLY_SYMMETRIC=87, 1252 MATOP_PB_RELAX=88, 1253 MATOP_GET_VECS=89, 1254 MATOP_MAT_MULT=90, 1255 MATOP_MAT_MULT_SYMBOLIC=91, 1256 MATOP_MAT_MULT_NUMERIC=92, 1257 MATOP_PTAP=93, 1258 MATOP_PTAP_SYMBOLIC=94, 1259 MATOP_PTAP_NUMERIC=95, 1260 MATOP_MAT_MULTTRANSPOSE=96, 1261 MATOP_MAT_MULTTRANSPOSE_SYMBOLIC=97, 1262 MATOP_MAT_MULTTRANSPOSE_NUMERIC=98, 1263 MATOP_PTAP_SYMBOLIC_SEQAIJ=99, 1264 MATOP_PTAP_NUMERIC_SEQAIJ=100, 1265 MATOP_PTAP_SYMBOLIC_MPIAIJ=101, 1266 MATOP_PTAP_NUMERIC_MPIAIJ=102 1267 } MatOperation; 1268 EXTERN PetscErrorCode MatHasOperation(Mat,MatOperation,PetscTruth*); 1269 EXTERN PetscErrorCode MatShellSetOperation(Mat,MatOperation,void(*)(void)); 1270 EXTERN PetscErrorCode MatShellGetOperation(Mat,MatOperation,void(**)(void)); 1271 EXTERN PetscErrorCode MatShellSetContext(Mat,void*); 1272 1273 /* 1274 Codes for matrices stored on disk. By default they are 1275 stored in a universal format. By changing the format with 1276 PetscViewerSetFormat(viewer,PETSC_VIEWER_BINARY_NATIVE); the matrices will 1277 be stored in a way natural for the matrix, for example dense matrices 1278 would be stored as dense. Matrices stored this way may only be 1279 read into matrices of the same time. 1280 */ 1281 #define MATRIX_BINARY_FORMAT_DENSE -1 1282 1283 EXTERN PetscErrorCode MatMPIBAIJSetHashTableFactor(Mat,PetscReal); 1284 EXTERN PetscErrorCode MatSeqAIJGetInodeSizes(Mat,PetscInt *,PetscInt *[],PetscInt *); 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