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