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