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