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