xref: /petsc/include/petscmat.h (revision fa59e80594ae4f5b96fb1a0d88f82abc4bbaec69)
1 /*
2      Include file for the matrix component of PETSc
3 */
4 #ifndef __PETSCMAT_H
5 #define __PETSCMAT_H
6 #include <petscvec.h>
7 
8 /*S
9      Mat - Abstract PETSc matrix object
10 
11    Level: beginner
12 
13   Concepts: matrix; linear operator
14 
15 .seealso:  MatCreate(), MatType, MatSetType()
16 S*/
17 typedef struct _p_Mat*           Mat;
18 
19 /*J
20     MatType - String with the name of a PETSc matrix or the creation function
21        with an optional dynamic library name, for example
22        http://www.mcs.anl.gov/petsc/lib.a:mymatcreate()
23 
24    Level: beginner
25 
26 .seealso: MatSetType(), Mat, MatSolverPackage
27 J*/
28 typedef const char* MatType;
29 #define MATSAME            "same"
30 #define MATMAIJ            "maij"
31 #define MATSEQMAIJ         "seqmaij"
32 #define MATMPIMAIJ         "mpimaij"
33 #define MATIS              "is"
34 #define MATAIJ             "aij"
35 #define MATSEQAIJ          "seqaij"
36 #define MATSEQAIJPTHREAD   "seqaijpthread"
37 #define MATAIJPTHREAD      "aijpthread"
38 #define MATMPIAIJ          "mpiaij"
39 #define MATAIJCRL          "aijcrl"
40 #define MATSEQAIJCRL       "seqaijcrl"
41 #define MATMPIAIJCRL       "mpiaijcrl"
42 #define MATAIJCUSP         "aijcusp"
43 #define MATSEQAIJCUSP      "seqaijcusp"
44 #define MATMPIAIJCUSP      "mpiaijcusp"
45 #define MATAIJCUSPARSE     "aijcusparse"
46 #define MATSEQAIJCUSPARSE  "seqaijcusparse"
47 #define MATMPIAIJCUSPARSE  "mpiaijcusparse"
48 #define MATAIJPERM         "aijperm"
49 #define MATSEQAIJPERM      "seqaijperm"
50 #define MATMPIAIJPERM      "mpiaijperm"
51 #define MATSHELL           "shell"
52 #define MATDENSE           "dense"
53 #define MATSEQDENSE        "seqdense"
54 #define MATMPIDENSE        "mpidense"
55 #define MATELEMENTAL       "elemental"
56 #define MATBAIJ            "baij"
57 #define MATSEQBAIJ         "seqbaij"
58 #define MATMPIBAIJ         "mpibaij"
59 #define MATMPIADJ          "mpiadj"
60 #define MATSBAIJ           "sbaij"
61 #define MATSEQSBAIJ        "seqsbaij"
62 #define MATMPISBAIJ        "mpisbaij"
63 #define MATSEQBSTRM        "seqbstrm"
64 #define MATMPIBSTRM        "mpibstrm"
65 #define MATBSTRM           "bstrm"
66 #define MATSEQSBSTRM       "seqsbstrm"
67 #define MATMPISBSTRM       "mpisbstrm"
68 #define MATSBSTRM          "sbstrm"
69 #define MATDAAD            "daad"
70 #define MATMFFD            "mffd"
71 #define MATNORMAL          "normal"
72 #define MATLRC             "lrc"
73 #define MATSCATTER         "scatter"
74 #define MATBLOCKMAT        "blockmat"
75 #define MATCOMPOSITE       "composite"
76 #define MATFFT             "fft"
77 #define MATFFTW            "fftw"
78 #define MATSEQCUFFT        "seqcufft"
79 #define MATTRANSPOSEMAT    "transpose"
80 #define MATSCHURCOMPLEMENT "schurcomplement"
81 #define MATPYTHON          "python"
82 #define MATHYPRESTRUCT     "hyprestruct"
83 #define MATHYPRESSTRUCT    "hypresstruct"
84 #define MATSUBMATRIX       "submatrix"
85 #define MATLOCALREF        "localref"
86 #define MATNEST            "nest"
87 #define MATIJ              "ij"
88 
89 /*J
90     MatSolverPackage - String with the name of a PETSc matrix solver type.
91 
92     For example: "petsc" indicates what PETSc provides, "superlu" indicates either
93        SuperLU or SuperLU_Dist etc.
94 
95 
96    Level: beginner
97 
98 .seealso: MatGetFactor(), Mat, MatSetType(), MatType
99 J*/
100 #define MatSolverPackage char*
101 #define MATSOLVERSUPERLU      "superlu"
102 #define MATSOLVERSUPERLU_DIST "superlu_dist"
103 #define MATSOLVERUMFPACK      "umfpack"
104 #define MATSOLVERCHOLMOD      "cholmod"
105 #define MATSOLVERESSL         "essl"
106 #define MATSOLVERLUSOL        "lusol"
107 #define MATSOLVERMUMPS        "mumps"
108 #define MATSOLVERPASTIX       "pastix"
109 #define MATSOLVERMATLAB       "matlab"
110 #define MATSOLVERPETSC        "petsc"
111 #define MATSOLVERBAS          "bas"
112 #define MATSOLVERCUSPARSE     "cusparse"
113 #define MATSOLVERBSTRM        "bstrm"
114 #define MATSOLVERSBSTRM       "sbstrm"
115 #define MATSOLVERELEMENTAL    "elemental"
116 #define MATSOLVERCLIQUE       "clique"
117 
118 /*E
119     MatFactorType - indicates what type of factorization is requested
120 
121     Level: beginner
122 
123    Any additions/changes here MUST also be made in include/finclude/petscmat.h
124 
125 .seealso: MatSolverPackage, MatGetFactor()
126 E*/
127 typedef enum {MAT_FACTOR_NONE, MAT_FACTOR_LU, MAT_FACTOR_CHOLESKY, MAT_FACTOR_ILU, MAT_FACTOR_ICC,MAT_FACTOR_ILUDT} MatFactorType;
128 PETSC_EXTERN const char *const MatFactorTypes[];
129 
130 PETSC_EXTERN PetscErrorCode MatGetFactor(Mat,const MatSolverPackage,MatFactorType,Mat*);
131 PETSC_EXTERN PetscErrorCode MatGetFactorAvailable(Mat,const MatSolverPackage,MatFactorType,PetscBool *);
132 PETSC_EXTERN PetscErrorCode MatFactorGetSolverPackage(Mat,const MatSolverPackage*);
133 PETSC_EXTERN PetscErrorCode MatGetFactorType(Mat,MatFactorType*);
134 
135 /* Logging support */
136 #define    MAT_FILE_CLASSID 1211216    /* used to indicate matrices in binary files */
137 PETSC_EXTERN PetscClassId MAT_CLASSID;
138 PETSC_EXTERN PetscClassId MAT_FDCOLORING_CLASSID;
139 PETSC_EXTERN PetscClassId MAT_TRANSPOSECOLORING_CLASSID;
140 PETSC_EXTERN PetscClassId MAT_PARTITIONING_CLASSID;
141 PETSC_EXTERN PetscClassId MAT_COARSEN_CLASSID;
142 PETSC_EXTERN PetscClassId MAT_NULLSPACE_CLASSID;
143 PETSC_EXTERN PetscClassId MATMFFD_CLASSID;
144 
145 /*E
146     MatReuse - Indicates if matrices obtained from a previous call to MatGetSubMatrices()
147      or MatGetSubMatrix() are to be reused to store the new matrix values. For MatConvert() is used to indicate
148      that the input matrix is to be replaced with the converted matrix.
149 
150     Level: beginner
151 
152    Any additions/changes here MUST also be made in include/finclude/petscmat.h
153 
154 .seealso: MatGetSubMatrices(), MatGetSubMatrix(), MatDestroyMatrices(), MatConvert()
155 E*/
156 typedef enum {MAT_INITIAL_MATRIX,MAT_REUSE_MATRIX,MAT_IGNORE_MATRIX} MatReuse;
157 
158 /*E
159     MatGetSubMatrixOption - Indicates if matrices obtained from a call to MatGetSubMatrices()
160      include the matrix values. Currently it is only used by MatGetSeqNonzerostructure().
161 
162     Level: beginner
163 
164 .seealso: MatGetSeqNonzerostructure()
165 E*/
166 typedef enum {MAT_DO_NOT_GET_VALUES,MAT_GET_VALUES} MatGetSubMatrixOption;
167 
168 PETSC_EXTERN PetscErrorCode MatInitializePackage(const char[]);
169 
170 PETSC_EXTERN PetscErrorCode MatCreate(MPI_Comm,Mat*);
171 PETSC_EXTERN PetscErrorCode MatSetSizes(Mat,PetscInt,PetscInt,PetscInt,PetscInt);
172 PETSC_EXTERN PetscErrorCode MatSetType(Mat,MatType);
173 PETSC_EXTERN PetscErrorCode MatSetFromOptions(Mat);
174 PETSC_EXTERN PetscErrorCode MatRegisterAll(const char[]);
175 PETSC_EXTERN PetscErrorCode MatRegister(const char[],const char[],const char[],PetscErrorCode(*)(Mat));
176 PETSC_EXTERN PetscErrorCode MatRegisterBaseName(const char[],const char[],const char[]);
177 PETSC_EXTERN PetscErrorCode MatSetOptionsPrefix(Mat,const char[]);
178 PETSC_EXTERN PetscErrorCode MatAppendOptionsPrefix(Mat,const char[]);
179 PETSC_EXTERN PetscErrorCode MatGetOptionsPrefix(Mat,const char*[]);
180 
181 /*MC
182    MatRegisterDynamic - Adds a new matrix type
183 
184    Synopsis:
185    PetscErrorCode MatRegisterDynamic(const char *name,const char *path,const char *name_create,PetscErrorCode (*routine_create)(Mat))
186 
187    Not Collective
188 
189    Input Parameters:
190 +  name - name of a new user-defined matrix type
191 .  path - path (either absolute or relative) the library containing this solver
192 .  name_create - name of routine to create method context
193 -  routine_create - routine to create method context
194 
195    Notes:
196    MatRegisterDynamic() may be called multiple times to add several user-defined solvers.
197 
198    If dynamic libraries are used, then the fourth input argument (routine_create)
199    is ignored.
200 
201    Sample usage:
202 .vb
203    MatRegisterDynamic("my_mat",/home/username/my_lib/lib/libO/solaris/mylib.a,
204                "MyMatCreate",MyMatCreate);
205 .ve
206 
207    Then, your solver can be chosen with the procedural interface via
208 $     MatSetType(Mat,"my_mat")
209    or at runtime via the option
210 $     -mat_type my_mat
211 
212    Level: advanced
213 
214    Notes: ${PETSC_ARCH} occuring in pathname will be replaced with appropriate values.
215          If your function is not being put into a shared library then use VecRegister() instead
216 
217 .keywords: Mat, register
218 
219 .seealso: MatRegisterAll(), MatRegisterDestroy()
220 
221 M*/
222 #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
223 #define MatRegisterDynamic(a,b,c,d) MatRegister(a,b,c,0)
224 #else
225 #define MatRegisterDynamic(a,b,c,d) MatRegister(a,b,c,d)
226 #endif
227 
228 PETSC_EXTERN PetscBool MatRegisterAllCalled;
229 PETSC_EXTERN PetscFList MatList;
230 PETSC_EXTERN PetscFList MatColoringList;
231 PETSC_EXTERN PetscFList MatPartitioningList;
232 PETSC_EXTERN PetscFList MatCoarsenList;
233 
234 /*E
235     MatStructure - Indicates if the matrix has the same nonzero structure
236 
237     Level: beginner
238 
239    Any additions/changes here MUST also be made in include/finclude/petscmat.h
240 
241 .seealso: MatCopy(), KSPSetOperators(), PCSetOperators()
242 E*/
243 typedef enum {DIFFERENT_NONZERO_PATTERN,SUBSET_NONZERO_PATTERN,SAME_NONZERO_PATTERN,SAME_PRECONDITIONER} MatStructure;
244 
245 PETSC_EXTERN PetscErrorCode MatCreateSeqDense(MPI_Comm,PetscInt,PetscInt,PetscScalar[],Mat*);
246 PETSC_EXTERN PetscErrorCode MatCreateDense(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,PetscScalar[],Mat*);
247 PETSC_EXTERN PetscErrorCode MatCreateSeqAIJ(MPI_Comm,PetscInt,PetscInt,PetscInt,const PetscInt[],Mat*);
248 PETSC_EXTERN PetscErrorCode MatCreateAIJ(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],PetscInt,const PetscInt[],Mat*);
249 PETSC_EXTERN PetscErrorCode MatCreateMPIAIJWithArrays(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],const PetscInt[],const PetscScalar[],Mat *);
250 PETSC_EXTERN PetscErrorCode MatCreateMPIAIJWithSplitArrays(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt[],PetscInt[],PetscScalar[],PetscInt[],PetscInt[],PetscScalar[],Mat*);
251 
252 PETSC_EXTERN PetscErrorCode MatCreateSeqBAIJ(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],Mat*);
253 PETSC_EXTERN PetscErrorCode MatCreateBAIJ(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],PetscInt,const PetscInt[],Mat*);
254 PETSC_EXTERN PetscErrorCode MatCreateMPIBAIJWithArrays(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],const PetscInt[],const PetscScalar[],Mat*);
255 
256 PETSC_EXTERN PetscErrorCode MatCreateMPIAdj(MPI_Comm,PetscInt,PetscInt,PetscInt[],PetscInt[],PetscInt[],Mat*);
257 PETSC_EXTERN PetscErrorCode MatCreateSeqSBAIJ(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],Mat*);
258 
259 PETSC_EXTERN PetscErrorCode MatCreateSBAIJ(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],PetscInt,const PetscInt[],Mat*);
260 PETSC_EXTERN PetscErrorCode MatCreateMPISBAIJWithArrays(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],const PetscInt[],const PetscScalar[],Mat *);
261 PETSC_EXTERN PetscErrorCode MatMPISBAIJSetPreallocationCSR(Mat,PetscInt,const PetscInt[],const PetscInt[],const PetscScalar[]);
262 PETSC_EXTERN PetscErrorCode MatXAIJSetPreallocation(Mat,PetscInt,const PetscInt*,const PetscInt*,const PetscInt*,const PetscInt*);
263 
264 PETSC_EXTERN PetscErrorCode MatCreateShell(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,void *,Mat*);
265 PETSC_EXTERN PetscErrorCode MatCreateAdic(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,void (*)(void),Mat*);
266 PETSC_EXTERN PetscErrorCode MatCreateNormal(Mat,Mat*);
267 PETSC_EXTERN PetscErrorCode MatCreateLRC(Mat,Mat,Mat,Mat*);
268 PETSC_EXTERN PetscErrorCode MatCreateIS(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,ISLocalToGlobalMapping,Mat*);
269 PETSC_EXTERN PetscErrorCode MatCreateSeqAIJCRL(MPI_Comm,PetscInt,PetscInt,PetscInt,const PetscInt[],Mat*);
270 PETSC_EXTERN PetscErrorCode MatCreateMPIAIJCRL(MPI_Comm,PetscInt,PetscInt,PetscInt,const PetscInt[],PetscInt,const PetscInt[],Mat*);
271 
272 PETSC_EXTERN PetscErrorCode MatCreateSeqBSTRM(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],Mat*);
273 PETSC_EXTERN PetscErrorCode MatCreateMPIBSTRM(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],PetscInt,const PetscInt[],Mat*);
274 PETSC_EXTERN PetscErrorCode MatCreateSeqSBSTRM(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],Mat*);
275 PETSC_EXTERN PetscErrorCode MatCreateMPISBSTRM(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],PetscInt,const PetscInt[],Mat*);
276 
277 PETSC_EXTERN PetscErrorCode MatCreateScatter(MPI_Comm,VecScatter,Mat*);
278 PETSC_EXTERN PetscErrorCode MatScatterSetVecScatter(Mat,VecScatter);
279 PETSC_EXTERN PetscErrorCode MatScatterGetVecScatter(Mat,VecScatter*);
280 PETSC_EXTERN PetscErrorCode MatCreateBlockMat(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt*,Mat*);
281 PETSC_EXTERN PetscErrorCode MatCompositeAddMat(Mat,Mat);
282 PETSC_EXTERN PetscErrorCode MatCompositeMerge(Mat);
283 PETSC_EXTERN PetscErrorCode MatCreateComposite(MPI_Comm,PetscInt,const Mat*,Mat*);
284 typedef enum {MAT_COMPOSITE_ADDITIVE,MAT_COMPOSITE_MULTIPLICATIVE} MatCompositeType;
285 PETSC_EXTERN PetscErrorCode MatCompositeSetType(Mat,MatCompositeType);
286 
287 PETSC_EXTERN PetscErrorCode MatCreateFFT(MPI_Comm,PetscInt,const PetscInt[],MatType,Mat*);
288 PETSC_EXTERN PetscErrorCode MatCreateSeqCUFFT(MPI_Comm,PetscInt,const PetscInt[],Mat*);
289 
290 PETSC_EXTERN PetscErrorCode MatCreateTranspose(Mat,Mat*);
291 PETSC_EXTERN PetscErrorCode MatCreateSubMatrix(Mat,IS,IS,Mat*);
292 PETSC_EXTERN PetscErrorCode MatSubMatrixUpdate(Mat,Mat,IS,IS);
293 PETSC_EXTERN PetscErrorCode MatCreateLocalRef(Mat,IS,IS,Mat*);
294 
295 PETSC_EXTERN PetscErrorCode MatPythonSetType(Mat,const char[]);
296 
297 PETSC_EXTERN PetscErrorCode MatSetUp(Mat);
298 PETSC_EXTERN PetscErrorCode MatDestroy(Mat*);
299 
300 PETSC_EXTERN PetscErrorCode MatConjugate(Mat);
301 PETSC_EXTERN PetscErrorCode MatRealPart(Mat);
302 PETSC_EXTERN PetscErrorCode MatImaginaryPart(Mat);
303 PETSC_EXTERN PetscErrorCode MatGetDiagonalBlock(Mat,Mat*);
304 PETSC_EXTERN PetscErrorCode MatGetTrace(Mat,PetscScalar*);
305 PETSC_EXTERN PetscErrorCode MatInvertBlockDiagonal(Mat,const PetscScalar **);
306 
307 /* ------------------------------------------------------------*/
308 PETSC_EXTERN PetscErrorCode MatSetValues(Mat,PetscInt,const PetscInt[],PetscInt,const PetscInt[],const PetscScalar[],InsertMode);
309 PETSC_EXTERN PetscErrorCode MatSetValuesBlocked(Mat,PetscInt,const PetscInt[],PetscInt,const PetscInt[],const PetscScalar[],InsertMode);
310 PETSC_EXTERN PetscErrorCode MatSetValuesRow(Mat,PetscInt,const PetscScalar[]);
311 PETSC_EXTERN PetscErrorCode MatSetValuesRowLocal(Mat,PetscInt,const PetscScalar[]);
312 PETSC_EXTERN PetscErrorCode MatSetValuesBatch(Mat,PetscInt,PetscInt,PetscInt[],const PetscScalar[]);
313 PETSC_EXTERN PetscErrorCode MatSetRandom(Mat,PetscRandom);
314 
315 /*S
316      MatStencil - Data structure (C struct) for storing information about a single row or
317         column of a matrix as indexed on an associated grid.
318 
319    Fortran usage is different, see MatSetValuesStencil() for details.
320 
321    Level: beginner
322 
323   Concepts: matrix; linear operator
324 
325 .seealso:  MatSetValuesStencil(), MatSetStencil(), MatSetValuesBlockedStencil()
326 S*/
327 typedef struct {
328   PetscInt k,j,i,c;
329 } MatStencil;
330 
331 PETSC_EXTERN PetscErrorCode MatSetValuesStencil(Mat,PetscInt,const MatStencil[],PetscInt,const MatStencil[],const PetscScalar[],InsertMode);
332 PETSC_EXTERN PetscErrorCode MatSetValuesBlockedStencil(Mat,PetscInt,const MatStencil[],PetscInt,const MatStencil[],const PetscScalar[],InsertMode);
333 PETSC_EXTERN PetscErrorCode MatSetStencil(Mat,PetscInt,const PetscInt[],const PetscInt[],PetscInt);
334 
335 PETSC_EXTERN PetscErrorCode MatSetColoring(Mat,ISColoring);
336 PETSC_EXTERN PetscErrorCode MatSetValuesAdic(Mat,void*);
337 PETSC_EXTERN PetscErrorCode MatSetValuesAdifor(Mat,PetscInt,void*);
338 
339 /*E
340     MatAssemblyType - Indicates if the matrix is now to be used, or if you plan
341      to continue to add values to it
342 
343     Level: beginner
344 
345 .seealso: MatAssemblyBegin(), MatAssemblyEnd()
346 E*/
347 typedef enum {MAT_FLUSH_ASSEMBLY=1,MAT_FINAL_ASSEMBLY=0} MatAssemblyType;
348 PETSC_EXTERN PetscErrorCode MatAssemblyBegin(Mat,MatAssemblyType);
349 PETSC_EXTERN PetscErrorCode MatAssemblyEnd(Mat,MatAssemblyType);
350 PETSC_EXTERN PetscErrorCode MatAssembled(Mat,PetscBool *);
351 
352 
353 
354 /*E
355     MatOption - Options that may be set for a matrix and its behavior or storage
356 
357     Level: beginner
358 
359    Any additions/changes here MUST also be made in include/finclude/petscmat.h
360 
361    Developer Notes: Entries that are negative need not be called collectively by all processes.
362 
363 .seealso: MatSetOption()
364 E*/
365 typedef enum {MAT_OPTION_MIN = -8,
366               MAT_NEW_NONZERO_LOCATION_ERR = -7,
367               MAT_NO_OFF_PROC_ZERO_ROWS = -6,
368               MAT_NO_OFF_PROC_ENTRIES = -5,
369               MAT_UNUSED_NONZERO_LOCATION_ERR = -4,
370               MAT_NEW_NONZERO_ALLOCATION_ERR = -3,
371               MAT_ROW_ORIENTED = -2,
372               MAT_NEW_NONZERO_LOCATIONS = -1,
373               MAT_SYMMETRIC = 1,
374               MAT_STRUCTURALLY_SYMMETRIC = 2,
375               MAT_NEW_DIAGONALS = 3,
376               MAT_IGNORE_OFF_PROC_ENTRIES = 4,
377               MAT_USE_HASH_TABLE = 5,
378               MAT_KEEP_NONZERO_PATTERN = 6,
379               MAT_IGNORE_ZERO_ENTRIES = 7,
380               MAT_USE_INODES = 8,
381               MAT_HERMITIAN = 9,
382               MAT_SYMMETRY_ETERNAL = 10,
383               MAT_CHECK_COMPRESSED_ROW = 11,
384               MAT_IGNORE_LOWER_TRIANGULAR = 12,
385               MAT_ERROR_LOWER_TRIANGULAR = 13,
386               MAT_GETROW_UPPERTRIANGULAR = 14,
387               MAT_SPD = 15,
388               MAT_OPTION_MAX = 16} MatOption;
389 
390 PETSC_EXTERN const char *MatOptions[];
391 PETSC_EXTERN PetscErrorCode MatSetOption(Mat,MatOption,PetscBool );
392 PETSC_EXTERN PetscErrorCode MatGetType(Mat,MatType*);
393 
394 PETSC_EXTERN PetscErrorCode MatGetValues(Mat,PetscInt,const PetscInt[],PetscInt,const PetscInt[],PetscScalar[]);
395 PETSC_EXTERN PetscErrorCode MatGetRow(Mat,PetscInt,PetscInt *,const PetscInt *[],const PetscScalar*[]);
396 PETSC_EXTERN PetscErrorCode MatRestoreRow(Mat,PetscInt,PetscInt *,const PetscInt *[],const PetscScalar*[]);
397 PETSC_EXTERN PetscErrorCode MatGetRowUpperTriangular(Mat);
398 PETSC_EXTERN PetscErrorCode MatRestoreRowUpperTriangular(Mat);
399 PETSC_EXTERN PetscErrorCode MatGetColumn(Mat,PetscInt,PetscInt *,const PetscInt *[],const PetscScalar*[]);
400 PETSC_EXTERN PetscErrorCode MatRestoreColumn(Mat,PetscInt,PetscInt *,const PetscInt *[],const PetscScalar*[]);
401 PETSC_EXTERN PetscErrorCode MatGetColumnVector(Mat,Vec,PetscInt);
402 PETSC_EXTERN PetscErrorCode MatSeqAIJGetArray(Mat,PetscScalar *[]);
403 PETSC_EXTERN PetscErrorCode MatSeqAIJRestoreArray(Mat,PetscScalar *[]);
404 PETSC_EXTERN PetscErrorCode MatDenseGetArray(Mat,PetscScalar *[]);
405 PETSC_EXTERN PetscErrorCode MatDenseRestoreArray(Mat,PetscScalar *[]);
406 PETSC_EXTERN PetscErrorCode MatGetBlockSize(Mat,PetscInt *);
407 PETSC_EXTERN PetscErrorCode MatSetBlockSize(Mat,PetscInt);
408 PETSC_EXTERN PetscErrorCode MatGetBlockSizes(Mat,PetscInt *,PetscInt *);
409 PETSC_EXTERN PetscErrorCode MatSetBlockSizes(Mat,PetscInt,PetscInt);
410 PETSC_EXTERN PetscErrorCode MatSetNThreads(Mat,PetscInt);
411 PETSC_EXTERN PetscErrorCode MatGetNThreads(Mat,PetscInt*);
412 
413 PETSC_EXTERN PetscErrorCode MatMult(Mat,Vec,Vec);
414 PETSC_EXTERN PetscErrorCode MatMultDiagonalBlock(Mat,Vec,Vec);
415 PETSC_EXTERN PetscErrorCode MatMultAdd(Mat,Vec,Vec,Vec);
416 PETSC_EXTERN PetscErrorCode MatMultTranspose(Mat,Vec,Vec);
417 PETSC_EXTERN PetscErrorCode MatMultHermitianTranspose(Mat,Vec,Vec);
418 PETSC_EXTERN PetscErrorCode MatIsTranspose(Mat,Mat,PetscReal,PetscBool *);
419 PETSC_EXTERN PetscErrorCode MatIsHermitianTranspose(Mat,Mat,PetscReal,PetscBool *);
420 PETSC_EXTERN PetscErrorCode MatMultTransposeAdd(Mat,Vec,Vec,Vec);
421 PETSC_EXTERN PetscErrorCode MatMultHermitianTransposeAdd(Mat,Vec,Vec,Vec);
422 PETSC_EXTERN PetscErrorCode MatMultConstrained(Mat,Vec,Vec);
423 PETSC_EXTERN PetscErrorCode MatMultTransposeConstrained(Mat,Vec,Vec);
424 PETSC_EXTERN PetscErrorCode MatMatSolve(Mat,Mat,Mat);
425 
426 /*E
427     MatDuplicateOption - Indicates if a duplicated sparse matrix should have
428   its numerical values copied over or just its nonzero structure.
429 
430     Level: beginner
431 
432    Any additions/changes here MUST also be made in include/finclude/petscmat.h
433 
434 $   MAT_SHARE_NONZERO_PATTERN - the i and j arrays in the new matrix will be shared with the original matrix
435 $                               this also triggers the MAT_DO_NOT_COPY_VALUES option. This is used when you
436 $                               have several matrices with the same nonzero pattern.
437 
438 .seealso: MatDuplicate()
439 E*/
440 typedef enum {MAT_DO_NOT_COPY_VALUES,MAT_COPY_VALUES,MAT_SHARE_NONZERO_PATTERN} MatDuplicateOption;
441 
442 PETSC_EXTERN PetscErrorCode MatConvert(Mat,MatType,MatReuse,Mat*);
443 PETSC_EXTERN PetscErrorCode MatDuplicate(Mat,MatDuplicateOption,Mat*);
444 
445 
446 PETSC_EXTERN PetscErrorCode MatCopy(Mat,Mat,MatStructure);
447 PETSC_EXTERN PetscErrorCode MatView(Mat,PetscViewer);
448 PETSC_EXTERN PetscErrorCode MatIsSymmetric(Mat,PetscReal,PetscBool *);
449 PETSC_EXTERN PetscErrorCode MatIsStructurallySymmetric(Mat,PetscBool *);
450 PETSC_EXTERN PetscErrorCode MatIsHermitian(Mat,PetscReal,PetscBool *);
451 PETSC_EXTERN PetscErrorCode MatIsSymmetricKnown(Mat,PetscBool *,PetscBool *);
452 PETSC_EXTERN PetscErrorCode MatIsHermitianKnown(Mat,PetscBool *,PetscBool *);
453 PETSC_EXTERN PetscErrorCode MatMissingDiagonal(Mat,PetscBool  *,PetscInt *);
454 PETSC_EXTERN PetscErrorCode MatLoad(Mat, PetscViewer);
455 
456 PETSC_EXTERN PetscErrorCode MatGetRowIJ(Mat,PetscInt,PetscBool ,PetscBool ,PetscInt*,const PetscInt *[],const PetscInt *[],PetscBool  *);
457 PETSC_EXTERN PetscErrorCode MatRestoreRowIJ(Mat,PetscInt,PetscBool ,PetscBool ,PetscInt *,const PetscInt *[],const PetscInt *[],PetscBool  *);
458 PETSC_EXTERN PetscErrorCode MatGetColumnIJ(Mat,PetscInt,PetscBool ,PetscBool ,PetscInt*,const PetscInt *[],const PetscInt *[],PetscBool  *);
459 PETSC_EXTERN PetscErrorCode MatRestoreColumnIJ(Mat,PetscInt,PetscBool ,PetscBool ,PetscInt *,const PetscInt *[],const PetscInt *[],PetscBool  *);
460 
461 /*S
462      MatInfo - Context of matrix information, used with MatGetInfo()
463 
464    In Fortran this is simply a double precision array of dimension MAT_INFO_SIZE
465 
466    Level: intermediate
467 
468   Concepts: matrix^nonzero information
469 
470 .seealso:  MatGetInfo(), MatInfoType
471 S*/
472 typedef struct {
473   PetscLogDouble block_size;                         /* block size */
474   PetscLogDouble nz_allocated,nz_used,nz_unneeded;   /* number of nonzeros */
475   PetscLogDouble memory;                             /* memory allocated */
476   PetscLogDouble assemblies;                         /* number of matrix assemblies called */
477   PetscLogDouble mallocs;                            /* number of mallocs during MatSetValues() */
478   PetscLogDouble fill_ratio_given,fill_ratio_needed; /* fill ratio for LU/ILU */
479   PetscLogDouble factor_mallocs;                     /* number of mallocs during factorization */
480 } MatInfo;
481 
482 /*E
483     MatInfoType - Indicates if you want information about the local part of the matrix,
484      the entire parallel matrix or the maximum over all the local parts.
485 
486     Level: beginner
487 
488    Any additions/changes here MUST also be made in include/finclude/petscmat.h
489 
490 .seealso: MatGetInfo(), MatInfo
491 E*/
492 typedef enum {MAT_LOCAL=1,MAT_GLOBAL_MAX=2,MAT_GLOBAL_SUM=3} MatInfoType;
493 PETSC_EXTERN PetscErrorCode MatGetInfo(Mat,MatInfoType,MatInfo*);
494 PETSC_EXTERN PetscErrorCode MatGetDiagonal(Mat,Vec);
495 PETSC_EXTERN PetscErrorCode MatGetRowMax(Mat,Vec,PetscInt[]);
496 PETSC_EXTERN PetscErrorCode MatGetRowMin(Mat,Vec,PetscInt[]);
497 PETSC_EXTERN PetscErrorCode MatGetRowMaxAbs(Mat,Vec,PetscInt[]);
498 PETSC_EXTERN PetscErrorCode MatGetRowMinAbs(Mat,Vec,PetscInt[]);
499 PETSC_EXTERN PetscErrorCode MatGetRowSum(Mat,Vec);
500 PETSC_EXTERN PetscErrorCode MatTranspose(Mat,MatReuse,Mat*);
501 PETSC_EXTERN PetscErrorCode MatHermitianTranspose(Mat,MatReuse,Mat*);
502 PETSC_EXTERN PetscErrorCode MatPermute(Mat,IS,IS,Mat *);
503 PETSC_EXTERN PetscErrorCode MatDiagonalScale(Mat,Vec,Vec);
504 PETSC_EXTERN PetscErrorCode MatDiagonalSet(Mat,Vec,InsertMode);
505 PETSC_EXTERN PetscErrorCode MatEqual(Mat,Mat,PetscBool *);
506 PETSC_EXTERN PetscErrorCode MatMultEqual(Mat,Mat,PetscInt,PetscBool *);
507 PETSC_EXTERN PetscErrorCode MatMultAddEqual(Mat,Mat,PetscInt,PetscBool *);
508 PETSC_EXTERN PetscErrorCode MatMultTransposeEqual(Mat,Mat,PetscInt,PetscBool *);
509 PETSC_EXTERN PetscErrorCode MatMultTransposeAddEqual(Mat,Mat,PetscInt,PetscBool *);
510 
511 PETSC_EXTERN PetscErrorCode MatNorm(Mat,NormType,PetscReal *);
512 PETSC_EXTERN PetscErrorCode MatGetColumnNorms(Mat,NormType,PetscReal *);
513 PETSC_EXTERN PetscErrorCode MatZeroEntries(Mat);
514 PETSC_EXTERN PetscErrorCode MatZeroRows(Mat,PetscInt,const PetscInt [],PetscScalar,Vec,Vec);
515 PETSC_EXTERN PetscErrorCode MatZeroRowsIS(Mat,IS,PetscScalar,Vec,Vec);
516 PETSC_EXTERN PetscErrorCode MatZeroRowsStencil(Mat,PetscInt,const MatStencil [],PetscScalar,Vec,Vec);
517 PETSC_EXTERN PetscErrorCode MatZeroRowsColumnsStencil(Mat,PetscInt,const MatStencil[],PetscScalar,Vec,Vec);
518 PETSC_EXTERN PetscErrorCode MatZeroRowsColumns(Mat,PetscInt,const PetscInt [],PetscScalar,Vec,Vec);
519 PETSC_EXTERN PetscErrorCode MatZeroRowsColumnsIS(Mat,IS,PetscScalar,Vec,Vec);
520 
521 PETSC_EXTERN PetscErrorCode MatGetSize(Mat,PetscInt*,PetscInt*);
522 PETSC_EXTERN PetscErrorCode MatGetLocalSize(Mat,PetscInt*,PetscInt*);
523 PETSC_EXTERN PetscErrorCode MatGetOwnershipRange(Mat,PetscInt*,PetscInt*);
524 PETSC_EXTERN PetscErrorCode MatGetOwnershipRanges(Mat,const PetscInt**);
525 PETSC_EXTERN PetscErrorCode MatGetOwnershipRangeColumn(Mat,PetscInt*,PetscInt*);
526 PETSC_EXTERN PetscErrorCode MatGetOwnershipRangesColumn(Mat,const PetscInt**);
527 PETSC_EXTERN PetscErrorCode MatGetOwnershipIS(Mat,IS*,IS*);
528 
529 PETSC_EXTERN PetscErrorCode MatGetSubMatrices(Mat,PetscInt,const IS[],const IS[],MatReuse,Mat *[]);
530 PETSC_EXTERN PetscErrorCode MatGetSubMatricesParallel(Mat,PetscInt,const IS[],const IS[],MatReuse,Mat *[]);
531 PETSC_EXTERN PetscErrorCode MatDestroyMatrices(PetscInt,Mat *[]);
532 PETSC_EXTERN PetscErrorCode MatGetSubMatrix(Mat,IS,IS,MatReuse,Mat *);
533 PETSC_EXTERN PetscErrorCode MatGetLocalSubMatrix(Mat,IS,IS,Mat*);
534 PETSC_EXTERN PetscErrorCode MatRestoreLocalSubMatrix(Mat,IS,IS,Mat*);
535 PETSC_EXTERN PetscErrorCode MatGetSeqNonzeroStructure(Mat,Mat*);
536 PETSC_EXTERN PetscErrorCode MatDestroySeqNonzeroStructure(Mat*);
537 
538 PETSC_EXTERN PetscErrorCode MatCreateMPIAIJConcatenateSeqAIJ(MPI_Comm,Mat,PetscInt,MatReuse,Mat*);
539 PETSC_EXTERN PetscErrorCode MatCreateMPIAIJConcatenateSeqAIJSymbolic(MPI_Comm,Mat,PetscInt,Mat*);
540 PETSC_EXTERN PetscErrorCode MatCreateMPIAIJConcatenateSeqAIJNumeric(MPI_Comm,Mat,PetscInt,Mat);
541 PETSC_EXTERN PetscErrorCode MatCreateMPIAIJSumSeqAIJ(MPI_Comm,Mat,PetscInt,PetscInt,MatReuse,Mat*);
542 PETSC_EXTERN PetscErrorCode MatCreateMPIAIJSumSeqAIJSymbolic(MPI_Comm,Mat,PetscInt,PetscInt,Mat*);
543 PETSC_EXTERN PetscErrorCode MatCreateMPIAIJSumSeqAIJNumeric(Mat,Mat);
544 PETSC_EXTERN PetscErrorCode MatMPIAIJGetLocalMat(Mat,MatReuse,Mat*);
545 PETSC_EXTERN PetscErrorCode MatMPIAIJGetLocalMatCondensed(Mat,MatReuse,IS*,IS*,Mat*);
546 PETSC_EXTERN PetscErrorCode MatGetBrowsOfAcols(Mat,Mat,MatReuse,IS*,IS*,Mat*);
547 #if defined (PETSC_USE_CTABLE)
548 PETSC_EXTERN PetscErrorCode MatGetCommunicationStructs(Mat, Vec *, PetscTable *, VecScatter *);
549 #else
550 PETSC_EXTERN PetscErrorCode MatGetCommunicationStructs(Mat, Vec *, PetscInt *[], VecScatter *);
551 #endif
552 PETSC_EXTERN PetscErrorCode MatGetGhosts(Mat, PetscInt *,const PetscInt *[]);
553 
554 PETSC_EXTERN PetscErrorCode MatIncreaseOverlap(Mat,PetscInt,IS[],PetscInt);
555 
556 PETSC_EXTERN PetscErrorCode MatMatMult(Mat,Mat,MatReuse,PetscReal,Mat*);
557 PETSC_EXTERN PetscErrorCode MatMatMultSymbolic(Mat,Mat,PetscReal,Mat*);
558 PETSC_EXTERN PetscErrorCode MatMatMultNumeric(Mat,Mat,Mat);
559 
560 PETSC_EXTERN PetscErrorCode MatMatMatMult(Mat,Mat,Mat,MatReuse,PetscReal,Mat*);
561 PETSC_EXTERN PetscErrorCode MatMatMatMultSymbolic(Mat,Mat,Mat,PetscReal,Mat*);
562 PETSC_EXTERN PetscErrorCode MatMatMatMultNumeric(Mat,Mat,Mat,Mat);
563 
564 PETSC_EXTERN PetscErrorCode MatPtAP(Mat,Mat,MatReuse,PetscReal,Mat*);
565 PETSC_EXTERN PetscErrorCode MatPtAPSymbolic(Mat,Mat,PetscReal,Mat*);
566 PETSC_EXTERN PetscErrorCode MatPtAPNumeric(Mat,Mat,Mat);
567 PETSC_EXTERN PetscErrorCode MatRARt(Mat,Mat,MatReuse,PetscReal,Mat*);
568 PETSC_EXTERN PetscErrorCode MatRARtSymbolic(Mat,Mat,PetscReal,Mat*);
569 PETSC_EXTERN PetscErrorCode MatRARtNumeric(Mat,Mat,Mat);
570 
571 PETSC_EXTERN PetscErrorCode MatTransposeMatMult(Mat,Mat,MatReuse,PetscReal,Mat*);
572 PETSC_EXTERN PetscErrorCode MatTransposetMatMultSymbolic(Mat,Mat,PetscReal,Mat*);
573 PETSC_EXTERN PetscErrorCode MatTransposetMatMultNumeric(Mat,Mat,Mat);
574 PETSC_EXTERN PetscErrorCode MatMatTransposeMult(Mat,Mat,MatReuse,PetscReal,Mat*);
575 PETSC_EXTERN PetscErrorCode MatMatTransposeMultSymbolic(Mat,Mat,PetscReal,Mat*);
576 PETSC_EXTERN PetscErrorCode MatMatTransposeMultNumeric(Mat,Mat,Mat);
577 
578 PETSC_EXTERN PetscErrorCode MatAXPY(Mat,PetscScalar,Mat,MatStructure);
579 PETSC_EXTERN PetscErrorCode MatAYPX(Mat,PetscScalar,Mat,MatStructure);
580 
581 PETSC_EXTERN PetscErrorCode MatScale(Mat,PetscScalar);
582 PETSC_EXTERN PetscErrorCode MatShift(Mat,PetscScalar);
583 
584 PETSC_EXTERN PetscErrorCode MatSetLocalToGlobalMapping(Mat,ISLocalToGlobalMapping,ISLocalToGlobalMapping);
585 PETSC_EXTERN PetscErrorCode MatSetLocalToGlobalMappingBlock(Mat,ISLocalToGlobalMapping,ISLocalToGlobalMapping);
586 PETSC_EXTERN PetscErrorCode MatGetLocalToGlobalMapping(Mat,ISLocalToGlobalMapping*,ISLocalToGlobalMapping*);
587 PETSC_EXTERN PetscErrorCode MatGetLocalToGlobalMappingBlock(Mat,ISLocalToGlobalMapping*,ISLocalToGlobalMapping*);
588 PETSC_EXTERN PetscErrorCode MatZeroRowsLocal(Mat,PetscInt,const PetscInt [],PetscScalar,Vec,Vec);
589 PETSC_EXTERN PetscErrorCode MatZeroRowsLocalIS(Mat,IS,PetscScalar,Vec,Vec);
590 PETSC_EXTERN PetscErrorCode MatZeroRowsColumnsLocal(Mat,PetscInt,const PetscInt [],PetscScalar,Vec,Vec);
591 PETSC_EXTERN PetscErrorCode MatZeroRowsColumnsLocalIS(Mat,IS,PetscScalar,Vec,Vec);
592 PETSC_EXTERN PetscErrorCode MatSetValuesLocal(Mat,PetscInt,const PetscInt[],PetscInt,const PetscInt[],const PetscScalar[],InsertMode);
593 PETSC_EXTERN PetscErrorCode MatSetValuesBlockedLocal(Mat,PetscInt,const PetscInt[],PetscInt,const PetscInt[],const PetscScalar[],InsertMode);
594 
595 PETSC_EXTERN PetscErrorCode MatStashSetInitialSize(Mat,PetscInt,PetscInt);
596 PETSC_EXTERN PetscErrorCode MatStashGetInfo(Mat,PetscInt*,PetscInt*,PetscInt*,PetscInt*);
597 
598 PETSC_EXTERN PetscErrorCode MatInterpolate(Mat,Vec,Vec);
599 PETSC_EXTERN PetscErrorCode MatInterpolateAdd(Mat,Vec,Vec,Vec);
600 PETSC_EXTERN PetscErrorCode MatRestrict(Mat,Vec,Vec);
601 PETSC_EXTERN PetscErrorCode MatGetVecs(Mat,Vec*,Vec*);
602 PETSC_EXTERN PetscErrorCode MatGetRedundantMatrix(Mat,PetscInt,MPI_Comm,PetscInt,MatReuse,Mat*);
603 PETSC_EXTERN PetscErrorCode MatGetMultiProcBlock(Mat,MPI_Comm,MatReuse,Mat*);
604 PETSC_EXTERN PetscErrorCode MatFindZeroDiagonals(Mat,IS*);
605 
606 /*MC
607    MatSetValue - Set a single entry into a matrix.
608 
609    Not collective
610 
611    Input Parameters:
612 +  m - the matrix
613 .  row - the row location of the entry
614 .  col - the column location of the entry
615 .  value - the value to insert
616 -  mode - either INSERT_VALUES or ADD_VALUES
617 
618    Notes:
619    For efficiency one should use MatSetValues() and set several or many
620    values simultaneously if possible.
621 
622    Level: beginner
623 
624 .seealso: MatSetValues(), MatSetValueLocal()
625 M*/
626 PETSC_STATIC_INLINE PetscErrorCode MatSetValue(Mat v,PetscInt i,PetscInt j,PetscScalar va,InsertMode mode) {return MatSetValues(v,1,&i,1,&j,&va,mode);}
627 
628 PETSC_STATIC_INLINE PetscErrorCode MatGetValue(Mat v,PetscInt i,PetscInt j,PetscScalar *va) {return MatGetValues(v,1,&i,1,&j,va);}
629 
630 PETSC_STATIC_INLINE PetscErrorCode MatSetValueLocal(Mat v,PetscInt i,PetscInt j,PetscScalar va,InsertMode mode) {return MatSetValuesLocal(v,1,&i,1,&j,&va,mode);}
631 
632 /*MC
633    MatPreallocateInitialize - Begins the block of code that will count the number of nonzeros per
634        row in a matrix providing the data that one can use to correctly preallocate the matrix.
635 
636    Synopsis:
637    PetscErrorCode MatPreallocateInitialize(MPI_Comm comm, PetscInt nrows, PetscInt ncols, PetscInt *dnz, PetscInt *onz)
638 
639    Collective on MPI_Comm
640 
641    Input Parameters:
642 +  comm - the communicator that will share the eventually allocated matrix
643 .  nrows - the number of LOCAL rows in the matrix
644 -  ncols - the number of LOCAL columns in the matrix
645 
646    Output Parameters:
647 +  dnz - the array that will be passed to the matrix preallocation routines
648 -  ozn - the other array passed to the matrix preallocation routines
649 
650 
651    Level: intermediate
652 
653    Notes:
654     See the <A href="../../docs/manual.pdf#nameddest=ch_performance">Hints for Performance Improvment</A> chapter in the users manual for more details.
655 
656    Do not malloc or free dnz and onz, that is handled internally by these routines
657 
658    Use MatPreallocateInitializeSymmetric() for symmetric matrices (MPISBAIJ matrices)
659 
660    This is a MACRO not a function because it has a leading { that is closed by PetscPreallocateFinalize().
661 
662   Concepts: preallocation^Matrix
663 
664 .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateSetLocal(),
665           MatPreallocateInitializeSymmetric(), MatPreallocateSymmetricSetLocal()
666 M*/
667 #define MatPreallocateInitialize(comm,nrows,ncols,dnz,onz) 0; \
668 { \
669   PetscErrorCode _4_ierr; PetscInt __nrows = (nrows),__ctmp = (ncols),__rstart,__start,__end; \
670   _4_ierr = PetscMalloc2(__nrows,PetscInt,&dnz,__nrows,PetscInt,&onz);CHKERRQ(_4_ierr); \
671   _4_ierr = PetscMemzero(dnz,__nrows*sizeof(PetscInt));CHKERRQ(_4_ierr);\
672   _4_ierr = PetscMemzero(onz,__nrows*sizeof(PetscInt));CHKERRQ(_4_ierr); __start = 0; __end = __start; \
673   _4_ierr = MPI_Scan(&__ctmp,&__end,1,MPIU_INT,MPI_SUM,comm);CHKERRQ(_4_ierr); __start = __end - __ctmp;\
674   _4_ierr = MPI_Scan(&__nrows,&__rstart,1,MPIU_INT,MPI_SUM,comm);CHKERRQ(_4_ierr); __rstart = __rstart - __nrows;
675 
676 /*MC
677    MatPreallocateSetLocal - Indicates the locations (rows and columns) in the matrix where nonzeros will be
678        inserted using a local number of the rows and columns
679 
680    Synopsis:
681    PetscErrorCode MatPreallocateSetLocal(ISLocalToGlobalMappping map,PetscInt nrows, PetscInt *rows,PetscInt ncols, PetscInt *cols,PetscInt *dnz, PetscInt *onz)
682 
683    Not Collective
684 
685    Input Parameters:
686 +  map - the row mapping from local numbering to global numbering
687 .  nrows - the number of rows indicated
688 .  rows - the indices of the rows
689 .  cmap - the column mapping from local to global numbering
690 .  ncols - the number of columns in the matrix
691 .  cols - the columns indicated
692 .  dnz - the array that will be passed to the matrix preallocation routines
693 -  ozn - the other array passed to the matrix preallocation routines
694 
695 
696    Level: intermediate
697 
698    Notes:
699     See the <A href="../../docs/manual.pdf#nameddest=ch_performance">Hints for Performance Improvment</A> chapter in the users manual for more details.
700 
701    Do not malloc or free dnz and onz, that is handled internally by these routines
702 
703   Concepts: preallocation^Matrix
704 
705 .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateInitialize(),
706           MatPreallocateInitialize(), MatPreallocateSymmetricSetLocal()
707 M*/
708 #define MatPreallocateSetLocal(rmap,nrows,rows,cmap,ncols,cols,dnz,onz) 0; \
709 {\
710   PetscInt __l;\
711   _4_ierr = ISLocalToGlobalMappingApply(rmap,nrows,rows,rows);CHKERRQ(_4_ierr);\
712   _4_ierr = ISLocalToGlobalMappingApply(cmap,ncols,cols,cols);CHKERRQ(_4_ierr);\
713   for (__l=0;__l<nrows;__l++) {\
714     _4_ierr = MatPreallocateSet((rows)[__l],ncols,cols,dnz,onz);CHKERRQ(_4_ierr);\
715   }\
716 }
717 
718 /*MC
719    MatPreallocateSymmetricSetLocal - Indicates the locations (rows and columns) in the matrix where nonzeros will be
720        inserted using a local number of the rows and columns
721 
722    Synopsis:
723    PetscErrorCode MatPreallocateSymmetricSetLocal(ISLocalToGlobalMappping map,PetscInt nrows, PetscInt *rows,PetscInt ncols, PetscInt *cols,PetscInt *dnz, PetscInt *onz)
724 
725    Not Collective
726 
727    Input Parameters:
728 +  map - the mapping between local numbering and global numbering
729 .  nrows - the number of rows indicated
730 .  rows - the indices of the rows
731 .  ncols - the number of columns in the matrix
732 .  cols - the columns indicated
733 .  dnz - the array that will be passed to the matrix preallocation routines
734 -  ozn - the other array passed to the matrix preallocation routines
735 
736 
737    Level: intermediate
738 
739    Notes:
740     See the <A href="../../docs/manual.pdf#nameddest=ch_performance">Hints for Performance Improvment</A> chapter in the users manual for more details.
741 
742    Do not malloc or free dnz and onz that is handled internally by these routines
743 
744   Concepts: preallocation^Matrix
745 
746 .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateInitialize(),
747           MatPreallocateInitialize(), MatPreallocateSymmetricSetLocal(), MatPreallocateSetLocal()
748 M*/
749 #define MatPreallocateSymmetricSetLocal(map,nrows,rows,ncols,cols,dnz,onz) 0;\
750 {\
751   PetscInt __l;\
752   _4_ierr = ISLocalToGlobalMappingApply(map,nrows,rows,rows);CHKERRQ(_4_ierr);\
753   _4_ierr = ISLocalToGlobalMappingApply(map,ncols,cols,cols);CHKERRQ(_4_ierr);\
754   for (__l=0;__l<nrows;__l++) {\
755     _4_ierr = MatPreallocateSymmetricSet((rows)[__l],ncols,cols,dnz,onz);CHKERRQ(_4_ierr);\
756   }\
757 }
758 
759 /*MC
760    MatPreallocateSet - Indicates the locations (rows and columns) in the matrix where nonzeros will be
761        inserted using a local number of the rows and columns
762 
763    Synopsis:
764    PetscErrorCode MatPreallocateSet(PetscInt nrows, PetscInt *rows,PetscInt ncols, PetscInt *cols,PetscInt *dnz, PetscInt *onz)
765 
766    Not Collective
767 
768    Input Parameters:
769 +  row - the row
770 .  ncols - the number of columns in the matrix
771 -  cols - the columns indicated
772 
773    Output Parameters:
774 +  dnz - the array that will be passed to the matrix preallocation routines
775 -  ozn - the other array passed to the matrix preallocation routines
776 
777 
778    Level: intermediate
779 
780    Notes:
781     See the <A href="../../docs/manual.pdf#nameddest=ch_performance">Hints for Performance Improvment</A> chapter in the users manual for more details.
782 
783    Do not malloc or free dnz and onz that is handled internally by these routines
784 
785    This is a MACRO not a function because it uses variables declared in MatPreallocateInitialize().
786 
787   Concepts: preallocation^Matrix
788 
789 .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateInitialize(),
790           MatPreallocateInitialize(), MatPreallocateSymmetricSetLocal(), MatPreallocateSetLocal()
791 M*/
792 #define MatPreallocateSet(row,nc,cols,dnz,onz) 0;\
793 { PetscInt __i; \
794   if (row < __rstart) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Trying to set preallocation for row %D less than first local row %D",row,__rstart);\
795   if (row >= __rstart+__nrows) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Trying to set preallocation for row %D greater than last local row %D",row,__rstart+__nrows-1);\
796   for (__i=0; __i<nc; __i++) {\
797     if ((cols)[__i] < __start || (cols)[__i] >= __end) onz[row - __rstart]++; \
798     else dnz[row - __rstart]++;\
799   }\
800 }
801 
802 /*MC
803    MatPreallocateSymmetricSet - Indicates the locations (rows and columns) in the matrix where nonzeros will be
804        inserted using a local number of the rows and columns
805 
806    Synopsis:
807    PetscErrorCode MatPreallocateSymmetricSet(PetscInt nrows, PetscInt *rows,PetscInt ncols, PetscInt *cols,PetscInt *dnz, PetscInt *onz)
808 
809    Not Collective
810 
811    Input Parameters:
812 +  nrows - the number of rows indicated
813 .  rows - the indices of the rows
814 .  ncols - the number of columns in the matrix
815 .  cols - the columns indicated
816 .  dnz - the array that will be passed to the matrix preallocation routines
817 -  ozn - the other array passed to the matrix preallocation routines
818 
819 
820    Level: intermediate
821 
822    Notes:
823     See the <A href="../../docs/manual.pdf#nameddest=ch_performance">Hints for Performance Improvment</A> chapter in the users manual for more details.
824 
825    Do not malloc or free dnz and onz that is handled internally by these routines
826 
827    This is a MACRO not a function because it uses variables declared in MatPreallocateInitialize().
828 
829   Concepts: preallocation^Matrix
830 
831 .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateInitialize(),
832           MatPreallocateInitialize(), MatPreallocateSymmetricSetLocal(), MatPreallocateSetLocal()
833 M*/
834 #define MatPreallocateSymmetricSet(row,nc,cols,dnz,onz) 0;\
835 { PetscInt __i; \
836   for (__i=0; __i<nc; __i++) {\
837     if (cols[__i] >= __end) onz[row - __rstart]++; \
838     else if (cols[__i] >= row) dnz[row - __rstart]++;\
839   }\
840 }
841 
842 /*MC
843    MatPreallocateLocation -  An alternative to MatPreallocationSet() that puts the nonzero locations into the matrix if it exists
844 
845    Synopsis:
846    PetscErrorCode MatPreallocateLocations(Mat A,PetscInt row,PetscInt ncols,PetscInt *cols,PetscInt *dnz,PetscInt *onz)
847 
848    Not Collective
849 
850    Input Parameters:
851 .  A - matrix
852 .  row - row where values exist (must be local to this process)
853 .  ncols - number of columns
854 .  cols - columns with nonzeros
855 .  dnz - the array that will be passed to the matrix preallocation routines
856 -  ozn - the other array passed to the matrix preallocation routines
857 
858 
859    Level: intermediate
860 
861    Notes:
862     See the <A href="../../docs/manual.pdf#nameddest=ch_performance">Hints for Performance Improvment</A> chapter in the users manual for more details.
863 
864    Do not malloc or free dnz and onz that is handled internally by these routines
865 
866    This is a MACRO not a function because it uses a bunch of variables private to the MatPreallocation.... routines.
867 
868   Concepts: preallocation^Matrix
869 
870 .seealso: MatPreallocateInitialize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateSetLocal(),
871           MatPreallocateSymmetricSetLocal()
872 M*/
873 #define MatPreallocateLocation(A,row,ncols,cols,dnz,onz) 0;if (A) {ierr = MatSetValues(A,1,&row,ncols,cols,PETSC_NULL,INSERT_VALUES);CHKERRQ(ierr);} else {ierr =  MatPreallocateSet(row,ncols,cols,dnz,onz);CHKERRQ(ierr);}
874 
875 
876 /*MC
877    MatPreallocateFinalize - Ends the block of code that will count the number of nonzeros per
878        row in a matrix providing the data that one can use to correctly preallocate the matrix.
879 
880    Synopsis:
881    PetscErrorCode MatPreallocateFinalize(PetscInt *dnz, PetscInt *onz)
882 
883    Collective on MPI_Comm
884 
885    Input Parameters:
886 +  dnz - the array that was be passed to the matrix preallocation routines
887 -  ozn - the other array passed to the matrix preallocation routines
888 
889 
890    Level: intermediate
891 
892    Notes:
893     See the <A href="../../docs/manual.pdf#nameddest=ch_performance">Hints for Performance Improvment</A> chapter in the users manual for more details.
894 
895    Do not malloc or free dnz and onz that is handled internally by these routines
896 
897    This is a MACRO not a function because it closes the { started in MatPreallocateInitialize().
898 
899   Concepts: preallocation^Matrix
900 
901 .seealso: MatPreallocateInitialize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateSetLocal(),
902           MatPreallocateSymmetricSetLocal()
903 M*/
904 #define MatPreallocateFinalize(dnz,onz) 0;_4_ierr = PetscFree2(dnz,onz);CHKERRQ(_4_ierr);}
905 
906 
907 
908 /* Routines unique to particular data structures */
909 PETSC_EXTERN PetscErrorCode MatShellGetContext(Mat,void *);
910 
911 PETSC_EXTERN PetscErrorCode MatInodeAdjustForInodes(Mat,IS*,IS*);
912 PETSC_EXTERN PetscErrorCode MatInodeGetInodeSizes(Mat,PetscInt *,PetscInt *[],PetscInt *);
913 
914 PETSC_EXTERN PetscErrorCode MatSeqAIJSetColumnIndices(Mat,PetscInt[]);
915 PETSC_EXTERN PetscErrorCode MatSeqBAIJSetColumnIndices(Mat,PetscInt[]);
916 PETSC_EXTERN PetscErrorCode MatCreateSeqAIJWithArrays(MPI_Comm,PetscInt,PetscInt,PetscInt[],PetscInt[],PetscScalar[],Mat*);
917 PETSC_EXTERN PetscErrorCode MatCreateSeqBAIJWithArrays(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt[],PetscInt[],PetscScalar[],Mat*);
918 PETSC_EXTERN PetscErrorCode MatCreateSeqSBAIJWithArrays(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt[],PetscInt[],PetscScalar[],Mat*);
919 PETSC_EXTERN PetscErrorCode MatCreateSeqAIJFromTriple(MPI_Comm,PetscInt,PetscInt,PetscInt[],PetscInt[],PetscScalar[],Mat*,PetscInt,PetscBool);
920 
921 #define MAT_SKIP_ALLOCATION -4
922 
923 PETSC_EXTERN PetscErrorCode MatSeqBAIJSetPreallocation(Mat,PetscInt,PetscInt,const PetscInt[]);
924 PETSC_EXTERN PetscErrorCode MatSeqSBAIJSetPreallocation(Mat,PetscInt,PetscInt,const PetscInt[]);
925 PETSC_EXTERN PetscErrorCode MatSeqAIJSetPreallocation(Mat,PetscInt,const PetscInt[]);
926 
927 PETSC_EXTERN PetscErrorCode MatMPIBAIJSetPreallocation(Mat,PetscInt,PetscInt,const PetscInt[],PetscInt,const PetscInt[]);
928 PETSC_EXTERN PetscErrorCode MatMPISBAIJSetPreallocation(Mat,PetscInt,PetscInt,const PetscInt[],PetscInt,const PetscInt[]);
929 PETSC_EXTERN PetscErrorCode MatMPIAIJSetPreallocation(Mat,PetscInt,const PetscInt[],PetscInt,const PetscInt[]);
930 PETSC_EXTERN PetscErrorCode MatSeqAIJSetPreallocationCSR(Mat,const PetscInt [],const PetscInt [],const PetscScalar []);
931 PETSC_EXTERN PetscErrorCode MatSeqBAIJSetPreallocationCSR(Mat,PetscInt,const PetscInt[],const PetscInt[],const PetscScalar[]);
932 PETSC_EXTERN PetscErrorCode MatMPIAIJSetPreallocationCSR(Mat,const PetscInt[],const PetscInt[],const PetscScalar[]);
933 PETSC_EXTERN PetscErrorCode MatMPIBAIJSetPreallocationCSR(Mat,PetscInt,const PetscInt[],const PetscInt[],const PetscScalar[]);
934 PETSC_EXTERN PetscErrorCode MatMPIAdjSetPreallocation(Mat,PetscInt[],PetscInt[],PetscInt[]);
935 PETSC_EXTERN PetscErrorCode MatMPIDenseSetPreallocation(Mat,PetscScalar[]);
936 PETSC_EXTERN PetscErrorCode MatSeqDenseSetPreallocation(Mat,PetscScalar[]);
937 PETSC_EXTERN PetscErrorCode MatMPIAIJGetSeqAIJ(Mat,Mat*,Mat*,const PetscInt*[]);
938 PETSC_EXTERN PetscErrorCode MatMPIBAIJGetSeqBAIJ(Mat,Mat*,Mat*,const PetscInt*[]);
939 PETSC_EXTERN PetscErrorCode MatMPIAdjCreateNonemptySubcommMat(Mat,Mat*);
940 
941 PETSC_EXTERN PetscErrorCode MatSeqDenseSetLDA(Mat,PetscInt);
942 PETSC_EXTERN PetscErrorCode MatDenseGetLocalMatrix(Mat,Mat*);
943 
944 PETSC_EXTERN PetscErrorCode MatStoreValues(Mat);
945 PETSC_EXTERN PetscErrorCode MatRetrieveValues(Mat);
946 
947 PETSC_EXTERN PetscErrorCode MatDAADSetCtx(Mat,void*);
948 
949 PETSC_EXTERN PetscErrorCode MatFindNonzeroRows(Mat,IS*);
950 /*
951   These routines are not usually accessed directly, rather solving is
952   done through the KSP and PC interfaces.
953 */
954 
955 /*J
956     MatOrderingType - String with the name of a PETSc matrix ordering or the creation function
957        with an optional dynamic library name, for example
958        http://www.mcs.anl.gov/petsc/lib.a:orderingcreate()
959 
960    Level: beginner
961 
962    Cannot use const because the PC objects manipulate the string
963 
964 .seealso: MatGetOrdering()
965 J*/
966 typedef const char* MatOrderingType;
967 #define MATORDERINGNATURAL     "natural"
968 #define MATORDERINGND          "nd"
969 #define MATORDERING1WD         "1wd"
970 #define MATORDERINGRCM         "rcm"
971 #define MATORDERINGQMD         "qmd"
972 #define MATORDERINGROWLENGTH   "rowlength"
973 #define MATORDERINGAMD         "amd"            /* only works if UMFPACK is installed with PETSc */
974 
975 PETSC_EXTERN PetscErrorCode MatGetOrdering(Mat,MatOrderingType,IS*,IS*);
976 PETSC_EXTERN PetscErrorCode MatGetOrderingList(PetscFList *list);
977 PETSC_EXTERN PetscErrorCode MatOrderingRegister(const char[],const char[],const char[],PetscErrorCode(*)(Mat,MatOrderingType,IS*,IS*));
978 
979 /*MC
980    MatOrderingRegisterDynamic - Adds a new sparse matrix ordering to the matrix package.
981 
982    Synopsis:
983    PetscErrorCode MatOrderingRegisterDynamic(const char *name_ordering,const char *path,const char *name_create,PetscErrorCode (*routine_create)(MatOrdering))
984 
985    Not Collective
986 
987    Input Parameters:
988 +  sname - name of ordering (for example MATORDERINGND)
989 .  path - location of library where creation routine is
990 .  name - name of function that creates the ordering type,a string
991 -  function - function pointer that creates the ordering
992 
993    Level: developer
994 
995    If dynamic libraries are used, then the fourth input argument (function)
996    is ignored.
997 
998    Sample usage:
999 .vb
1000    MatOrderingRegisterDynamic("my_order",/home/username/my_lib/lib/libO/solaris/mylib.a,
1001                "MyOrder",MyOrder);
1002 .ve
1003 
1004    Then, your partitioner can be chosen with the procedural interface via
1005 $     MatOrderingSetType(part,"my_order)
1006    or at runtime via the option
1007 $     -pc_factor_mat_ordering_type my_order
1008 
1009    ${PETSC_ARCH} occuring in pathname will be replaced with appropriate values.
1010 
1011 .keywords: matrix, ordering, register
1012 
1013 .seealso: MatOrderingRegisterDestroy(), MatOrderingRegisterAll()
1014 M*/
1015 #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
1016 #define MatOrderingRegisterDynamic(a,b,c,d) MatOrderingRegister(a,b,c,0)
1017 #else
1018 #define MatOrderingRegisterDynamic(a,b,c,d) MatOrderingRegister(a,b,c,d)
1019 #endif
1020 
1021 PETSC_EXTERN PetscErrorCode MatOrderingRegisterDestroy(void);
1022 PETSC_EXTERN PetscErrorCode MatOrderingRegisterAll(const char[]);
1023 PETSC_EXTERN PetscBool MatOrderingRegisterAllCalled;
1024 PETSC_EXTERN PetscFList MatOrderingList;
1025 
1026 PETSC_EXTERN PetscErrorCode MatReorderForNonzeroDiagonal(Mat,PetscReal,IS,IS);
1027 
1028 /*S
1029     MatFactorShiftType - Numeric Shift.
1030 
1031    Level: beginner
1032 
1033 S*/
1034 typedef enum {MAT_SHIFT_NONE,MAT_SHIFT_NONZERO,MAT_SHIFT_POSITIVE_DEFINITE,MAT_SHIFT_INBLOCKS} MatFactorShiftType;
1035 PETSC_EXTERN const char *const MatFactorShiftTypes[];
1036 
1037 /*S
1038    MatFactorInfo - Data passed into the matrix factorization routines
1039 
1040    In Fortran these are simply double precision arrays of size MAT_FACTORINFO_SIZE, that is use
1041 $     MatFactorInfo  info(MAT_FACTORINFO_SIZE)
1042 
1043    Notes: These are not usually directly used by users, instead use PC type of LU, ILU, CHOLESKY or ICC.
1044 
1045       You can use MatFactorInfoInitialize() to set default values.
1046 
1047    Level: developer
1048 
1049 .seealso: MatLUFactorSymbolic(), MatILUFactorSymbolic(), MatCholeskyFactorSymbolic(), MatICCFactorSymbolic(), MatICCFactor(),
1050           MatFactorInfoInitialize()
1051 
1052 S*/
1053 typedef struct {
1054   PetscReal     diagonal_fill;  /* force diagonal to fill in if initially not filled */
1055   PetscReal     usedt;
1056   PetscReal     dt;             /* drop tolerance */
1057   PetscReal     dtcol;          /* tolerance for pivoting */
1058   PetscReal     dtcount;        /* maximum nonzeros to be allowed per row */
1059   PetscReal     fill;           /* expected fill, nonzeros in factored matrix/nonzeros in original matrix */
1060   PetscReal     levels;         /* ICC/ILU(levels) */
1061   PetscReal     pivotinblocks;  /* for BAIJ and SBAIJ matrices pivot in factorization on blocks, default 1.0
1062                                    factorization may be faster if do not pivot */
1063   PetscReal     zeropivot;      /* pivot is called zero if less than this */
1064   PetscReal     shifttype;      /* type of shift added to matrix factor to prevent zero pivots */
1065   PetscReal     shiftamount;     /* how large the shift is */
1066 } MatFactorInfo;
1067 
1068 PETSC_EXTERN PetscErrorCode MatFactorInfoInitialize(MatFactorInfo*);
1069 PETSC_EXTERN PetscErrorCode MatCholeskyFactor(Mat,IS,const MatFactorInfo*);
1070 PETSC_EXTERN PetscErrorCode MatCholeskyFactorSymbolic(Mat,Mat,IS,const MatFactorInfo*);
1071 PETSC_EXTERN PetscErrorCode MatCholeskyFactorNumeric(Mat,Mat,const MatFactorInfo*);
1072 PETSC_EXTERN PetscErrorCode MatLUFactor(Mat,IS,IS,const MatFactorInfo*);
1073 PETSC_EXTERN PetscErrorCode MatILUFactor(Mat,IS,IS,const MatFactorInfo*);
1074 PETSC_EXTERN PetscErrorCode MatLUFactorSymbolic(Mat,Mat,IS,IS,const MatFactorInfo*);
1075 PETSC_EXTERN PetscErrorCode MatILUFactorSymbolic(Mat,Mat,IS,IS,const MatFactorInfo*);
1076 PETSC_EXTERN PetscErrorCode MatICCFactorSymbolic(Mat,Mat,IS,const MatFactorInfo*);
1077 PETSC_EXTERN PetscErrorCode MatICCFactor(Mat,IS,const MatFactorInfo*);
1078 PETSC_EXTERN PetscErrorCode MatLUFactorNumeric(Mat,Mat,const MatFactorInfo*);
1079 PETSC_EXTERN PetscErrorCode MatGetInertia(Mat,PetscInt*,PetscInt*,PetscInt*);
1080 PETSC_EXTERN PetscErrorCode MatSolve(Mat,Vec,Vec);
1081 PETSC_EXTERN PetscErrorCode MatForwardSolve(Mat,Vec,Vec);
1082 PETSC_EXTERN PetscErrorCode MatBackwardSolve(Mat,Vec,Vec);
1083 PETSC_EXTERN PetscErrorCode MatSolveAdd(Mat,Vec,Vec,Vec);
1084 PETSC_EXTERN PetscErrorCode MatSolveTranspose(Mat,Vec,Vec);
1085 PETSC_EXTERN PetscErrorCode MatSolveTransposeAdd(Mat,Vec,Vec,Vec);
1086 PETSC_EXTERN PetscErrorCode MatSolves(Mat,Vecs,Vecs);
1087 
1088 PETSC_EXTERN PetscErrorCode MatSetUnfactored(Mat);
1089 
1090 /*E
1091     MatSORType - What type of (S)SOR to perform
1092 
1093     Level: beginner
1094 
1095    May be bitwise ORd together
1096 
1097    Any additions/changes here MUST also be made in include/finclude/petscmat.h
1098 
1099    MatSORType may be bitwise ORd together, so do not change the numbers
1100 
1101 .seealso: MatSOR()
1102 E*/
1103 typedef enum {SOR_FORWARD_SWEEP=1,SOR_BACKWARD_SWEEP=2,SOR_SYMMETRIC_SWEEP=3,
1104               SOR_LOCAL_FORWARD_SWEEP=4,SOR_LOCAL_BACKWARD_SWEEP=8,
1105               SOR_LOCAL_SYMMETRIC_SWEEP=12,SOR_ZERO_INITIAL_GUESS=16,
1106               SOR_EISENSTAT=32,SOR_APPLY_UPPER=64,SOR_APPLY_LOWER=128} MatSORType;
1107 PETSC_EXTERN PetscErrorCode MatSOR(Mat,Vec,PetscReal,MatSORType,PetscReal,PetscInt,PetscInt,Vec);
1108 
1109 /*
1110     These routines are for efficiently computing Jacobians via finite differences.
1111 */
1112 
1113 /*J
1114     MatColoringType - String with the name of a PETSc matrix coloring or the creation function
1115        with an optional dynamic library name, for example
1116        http://www.mcs.anl.gov/petsc/lib.a:coloringcreate()
1117 
1118    Level: beginner
1119 
1120 .seealso: MatGetColoring()
1121 J*/
1122 typedef const char* MatColoringType;
1123 #define MATCOLORINGNATURAL "natural"
1124 #define MATCOLORINGSL      "sl"
1125 #define MATCOLORINGLF      "lf"
1126 #define MATCOLORINGID      "id"
1127 
1128 PETSC_EXTERN PetscErrorCode MatGetColoring(Mat,MatColoringType,ISColoring*);
1129 PETSC_EXTERN PetscErrorCode MatColoringRegister(const char[],const char[],const char[],PetscErrorCode(*)(Mat,MatColoringType,ISColoring *));
1130 
1131 /*MC
1132    MatColoringRegisterDynamic - Adds a new sparse matrix coloring to the
1133                                matrix package.
1134 
1135    Synopsis:
1136    PetscErrorCode MatColoringRegisterDynamic(const char *name_coloring,const char *path,const char *name_create,PetscErrorCode (*routine_create)(MatColoring))
1137 
1138    Not Collective
1139 
1140    Input Parameters:
1141 +  sname - name of Coloring (for example MATCOLORINGSL)
1142 .  path - location of library where creation routine is
1143 .  name - name of function that creates the Coloring type, a string
1144 -  function - function pointer that creates the coloring
1145 
1146    Level: developer
1147 
1148    If dynamic libraries are used, then the fourth input argument (function)
1149    is ignored.
1150 
1151    Sample usage:
1152 .vb
1153    MatColoringRegisterDynamic("my_color",/home/username/my_lib/lib/libO/solaris/mylib.a,
1154                "MyColor",MyColor);
1155 .ve
1156 
1157    Then, your partitioner can be chosen with the procedural interface via
1158 $     MatColoringSetType(part,"my_color")
1159    or at runtime via the option
1160 $     -mat_coloring_type my_color
1161 
1162    $PETSC_ARCH occuring in pathname will be replaced with appropriate values.
1163 
1164 .keywords: matrix, Coloring, register
1165 
1166 .seealso: MatColoringRegisterDestroy(), MatColoringRegisterAll()
1167 M*/
1168 #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
1169 #define MatColoringRegisterDynamic(a,b,c,d) MatColoringRegister(a,b,c,0)
1170 #else
1171 #define MatColoringRegisterDynamic(a,b,c,d) MatColoringRegister(a,b,c,d)
1172 #endif
1173 
1174 PETSC_EXTERN PetscBool MatColoringRegisterAllCalled;
1175 
1176 PETSC_EXTERN PetscErrorCode MatColoringRegisterAll(const char[]);
1177 PETSC_EXTERN PetscErrorCode MatColoringRegisterDestroy(void);
1178 PETSC_EXTERN PetscErrorCode MatColoringPatch(Mat,PetscInt,PetscInt,ISColoringValue[],ISColoring*);
1179 
1180 /*S
1181      MatFDColoring - Object for computing a sparse Jacobian via finite differences
1182         and coloring
1183 
1184    Level: beginner
1185 
1186   Concepts: coloring, sparse Jacobian, finite differences
1187 
1188 .seealso:  MatFDColoringCreate()
1189 S*/
1190 typedef struct _p_MatFDColoring* MatFDColoring;
1191 
1192 PETSC_EXTERN PetscErrorCode MatFDColoringCreate(Mat,ISColoring,MatFDColoring *);
1193 PETSC_EXTERN PetscErrorCode MatFDColoringDestroy(MatFDColoring*);
1194 PETSC_EXTERN PetscErrorCode MatFDColoringView(MatFDColoring,PetscViewer);
1195 PETSC_EXTERN PetscErrorCode MatFDColoringSetFunction(MatFDColoring,PetscErrorCode (*)(void),void*);
1196 PETSC_EXTERN PetscErrorCode MatFDColoringGetFunction(MatFDColoring,PetscErrorCode (**)(void),void**);
1197 PETSC_EXTERN PetscErrorCode MatFDColoringSetParameters(MatFDColoring,PetscReal,PetscReal);
1198 PETSC_EXTERN PetscErrorCode MatFDColoringSetFromOptions(MatFDColoring);
1199 PETSC_EXTERN PetscErrorCode MatFDColoringApply(Mat,MatFDColoring,Vec,MatStructure*,void *);
1200 PETSC_EXTERN PetscErrorCode MatFDColoringSetF(MatFDColoring,Vec);
1201 PETSC_EXTERN PetscErrorCode MatFDColoringGetPerturbedColumns(MatFDColoring,PetscInt*,PetscInt*[]);
1202 
1203 /*S
1204      MatTransposeColoring - Object for computing a sparse matrix product C=A*B^T via coloring
1205 
1206    Level: beginner
1207 
1208   Concepts: coloring, sparse matrix product
1209 
1210 .seealso:  MatTransposeColoringCreate()
1211 S*/
1212 typedef struct _p_MatTransposeColoring* MatTransposeColoring;
1213 
1214 PETSC_EXTERN PetscErrorCode MatTransposeColoringCreate(Mat,ISColoring,MatTransposeColoring *);
1215 PETSC_EXTERN PetscErrorCode MatTransColoringApplySpToDen(MatTransposeColoring,Mat,Mat);
1216 PETSC_EXTERN PetscErrorCode MatTransColoringApplyDenToSp(MatTransposeColoring,Mat,Mat);
1217 PETSC_EXTERN PetscErrorCode MatTransposeColoringDestroy(MatTransposeColoring*);
1218 
1219 /*
1220     These routines are for partitioning matrices: currently used only
1221   for adjacency matrix, MatCreateMPIAdj().
1222 */
1223 
1224 /*S
1225      MatPartitioning - Object for managing the partitioning of a matrix or graph
1226 
1227    Level: beginner
1228 
1229   Concepts: partitioning
1230 
1231 .seealso:  MatPartitioningCreate(), MatPartitioningType
1232 S*/
1233 typedef struct _p_MatPartitioning* MatPartitioning;
1234 
1235 /*J
1236     MatPartitioningType - String with the name of a PETSc matrix partitioning or the creation function
1237        with an optional dynamic library name, for example
1238        http://www.mcs.anl.gov/petsc/lib.a:partitioningcreate()
1239 
1240    Level: beginner
1241 dm
1242 .seealso: MatPartitioningCreate(), MatPartitioning
1243 J*/
1244 typedef const char* MatPartitioningType;
1245 #define MATPARTITIONINGCURRENT  "current"
1246 #define MATPARTITIONINGSQUARE   "square"
1247 #define MATPARTITIONINGPARMETIS "parmetis"
1248 #define MATPARTITIONINGCHACO    "chaco"
1249 #define MATPARTITIONINGPARTY    "party"
1250 #define MATPARTITIONINGPTSCOTCH "ptscotch"
1251 
1252 
1253 PETSC_EXTERN PetscErrorCode MatPartitioningCreate(MPI_Comm,MatPartitioning*);
1254 PETSC_EXTERN PetscErrorCode MatPartitioningSetType(MatPartitioning,MatPartitioningType);
1255 PETSC_EXTERN PetscErrorCode MatPartitioningSetNParts(MatPartitioning,PetscInt);
1256 PETSC_EXTERN PetscErrorCode MatPartitioningSetAdjacency(MatPartitioning,Mat);
1257 PETSC_EXTERN PetscErrorCode MatPartitioningSetVertexWeights(MatPartitioning,const PetscInt[]);
1258 PETSC_EXTERN PetscErrorCode MatPartitioningSetPartitionWeights(MatPartitioning,const PetscReal []);
1259 PETSC_EXTERN PetscErrorCode MatPartitioningApply(MatPartitioning,IS*);
1260 PETSC_EXTERN PetscErrorCode MatPartitioningDestroy(MatPartitioning*);
1261 
1262 PETSC_EXTERN PetscErrorCode MatPartitioningRegister(const char[],const char[],const char[],PetscErrorCode (*)(MatPartitioning));
1263 
1264 /*MC
1265    MatPartitioningRegisterDynamic - Adds a new sparse matrix partitioning to the
1266    matrix package.
1267 
1268    Synopsis:
1269    PetscErrorCode MatPartitioningRegisterDynamic(const char *name_partitioning,const char *path,const char *name_create,PetscErrorCode (*routine_create)(MatPartitioning))
1270 
1271    Not Collective
1272 
1273    Input Parameters:
1274 +  sname - name of partitioning (for example MATPARTITIONINGCURRENT) or parmetis
1275 .  path - location of library where creation routine is
1276 .  name - name of function that creates the partitioning type, a string
1277 -  function - function pointer that creates the partitioning type
1278 
1279    Level: developer
1280 
1281    If dynamic libraries are used, then the fourth input argument (function)
1282    is ignored.
1283 
1284    Sample usage:
1285 .vb
1286    MatPartitioningRegisterDynamic("my_part",/home/username/my_lib/lib/libO/solaris/mylib.a,
1287                "MyPartCreate",MyPartCreate);
1288 .ve
1289 
1290    Then, your partitioner can be chosen with the procedural interface via
1291 $     MatPartitioningSetType(part,"my_part")
1292    or at runtime via the option
1293 $     -mat_partitioning_type my_part
1294 
1295    $PETSC_ARCH occuring in pathname will be replaced with appropriate values.
1296 
1297 .keywords: matrix, partitioning, register
1298 
1299 .seealso: MatPartitioningRegisterDestroy(), MatPartitioningRegisterAll()
1300 M*/
1301 #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
1302 #define MatPartitioningRegisterDynamic(a,b,c,d) MatPartitioningRegister(a,b,c,0)
1303 #else
1304 #define MatPartitioningRegisterDynamic(a,b,c,d) MatPartitioningRegister(a,b,c,d)
1305 #endif
1306 
1307 PETSC_EXTERN PetscBool MatPartitioningRegisterAllCalled;
1308 
1309 PETSC_EXTERN PetscErrorCode MatPartitioningRegisterAll(const char[]);
1310 PETSC_EXTERN PetscErrorCode MatPartitioningRegisterDestroy(void);
1311 
1312 PETSC_EXTERN PetscErrorCode MatPartitioningView(MatPartitioning,PetscViewer);
1313 PETSC_EXTERN PetscErrorCode MatPartitioningSetFromOptions(MatPartitioning);
1314 PETSC_EXTERN PetscErrorCode MatPartitioningGetType(MatPartitioning,MatPartitioningType*);
1315 
1316 PETSC_EXTERN PetscErrorCode MatPartitioningParmetisSetCoarseSequential(MatPartitioning);
1317 PETSC_EXTERN PetscErrorCode MatPartitioningParmetisGetEdgeCut(MatPartitioning, PetscInt *);
1318 
1319 typedef enum { MP_CHACO_MULTILEVEL=1,MP_CHACO_SPECTRAL=2,MP_CHACO_LINEAR=4,MP_CHACO_RANDOM=5,MP_CHACO_SCATTERED=6 } MPChacoGlobalType;
1320 PETSC_EXTERN const char *const MPChacoGlobalTypes[];
1321 typedef enum { MP_CHACO_KERNIGHAN=1,MP_CHACO_NONE=2 } MPChacoLocalType;
1322 PETSC_EXTERN const char *const MPChacoLocalTypes[];
1323 typedef enum { MP_CHACO_LANCZOS=0,MP_CHACO_RQI=1 } MPChacoEigenType;
1324 PETSC_EXTERN const char *const MPChacoEigenTypes[];
1325 
1326 PETSC_EXTERN PetscErrorCode MatPartitioningChacoSetGlobal(MatPartitioning,MPChacoGlobalType);
1327 PETSC_EXTERN PetscErrorCode MatPartitioningChacoGetGlobal(MatPartitioning,MPChacoGlobalType*);
1328 PETSC_EXTERN PetscErrorCode MatPartitioningChacoSetLocal(MatPartitioning,MPChacoLocalType);
1329 PETSC_EXTERN PetscErrorCode MatPartitioningChacoGetLocal(MatPartitioning,MPChacoLocalType*);
1330 PETSC_EXTERN PetscErrorCode MatPartitioningChacoSetCoarseLevel(MatPartitioning,PetscReal);
1331 PETSC_EXTERN PetscErrorCode MatPartitioningChacoSetEigenSolver(MatPartitioning,MPChacoEigenType);
1332 PETSC_EXTERN PetscErrorCode MatPartitioningChacoGetEigenSolver(MatPartitioning,MPChacoEigenType*);
1333 PETSC_EXTERN PetscErrorCode MatPartitioningChacoSetEigenTol(MatPartitioning,PetscReal);
1334 PETSC_EXTERN PetscErrorCode MatPartitioningChacoGetEigenTol(MatPartitioning,PetscReal*);
1335 PETSC_EXTERN PetscErrorCode MatPartitioningChacoSetEigenNumber(MatPartitioning,PetscInt);
1336 PETSC_EXTERN PetscErrorCode MatPartitioningChacoGetEigenNumber(MatPartitioning,PetscInt*);
1337 
1338 #define MP_PARTY_OPT "opt"
1339 #define MP_PARTY_LIN "lin"
1340 #define MP_PARTY_SCA "sca"
1341 #define MP_PARTY_RAN "ran"
1342 #define MP_PARTY_GBF "gbf"
1343 #define MP_PARTY_GCF "gcf"
1344 #define MP_PARTY_BUB "bub"
1345 #define MP_PARTY_DEF "def"
1346 PETSC_EXTERN PetscErrorCode MatPartitioningPartySetGlobal(MatPartitioning,const char*);
1347 #define MP_PARTY_HELPFUL_SETS "hs"
1348 #define MP_PARTY_KERNIGHAN_LIN "kl"
1349 #define MP_PARTY_NONE "no"
1350 PETSC_EXTERN PetscErrorCode MatPartitioningPartySetLocal(MatPartitioning,const char*);
1351 PETSC_EXTERN PetscErrorCode MatPartitioningPartySetCoarseLevel(MatPartitioning,PetscReal);
1352 PETSC_EXTERN PetscErrorCode MatPartitioningPartySetBipart(MatPartitioning,PetscBool);
1353 PETSC_EXTERN PetscErrorCode MatPartitioningPartySetMatchOptimization(MatPartitioning,PetscBool);
1354 
1355 typedef enum { MP_PTSCOTCH_QUALITY,MP_PTSCOTCH_SPEED,MP_PTSCOTCH_BALANCE,MP_PTSCOTCH_SAFETY,MP_PTSCOTCH_SCALABILITY } MPPTScotchStrategyType;
1356 PETSC_EXTERN const char *const MPPTScotchStrategyTypes[];
1357 
1358 PETSC_EXTERN PetscErrorCode MatPartitioningPTScotchSetImbalance(MatPartitioning,PetscReal);
1359 PETSC_EXTERN PetscErrorCode MatPartitioningPTScotchGetImbalance(MatPartitioning,PetscReal*);
1360 PETSC_EXTERN PetscErrorCode MatPartitioningPTScotchSetStrategy(MatPartitioning,MPPTScotchStrategyType);
1361 PETSC_EXTERN PetscErrorCode MatPartitioningPTScotchGetStrategy(MatPartitioning,MPPTScotchStrategyType*);
1362 
1363 /*
1364     These routines are for coarsening matrices:
1365 */
1366 
1367 /*S
1368      MatCoarsen - Object for managing the coarsening of a graph (symmetric matrix)
1369 
1370    Level: beginner
1371 
1372   Concepts: coarsen
1373 
1374 .seealso:  MatCoarsenCreate), MatCoarsenType
1375 S*/
1376 typedef struct _p_MatCoarsen* MatCoarsen;
1377 
1378 /*J
1379     MatCoarsenType - String with the name of a PETSc matrix coarsen or the creation function
1380        with an optional dynamic library name, for example
1381        http://www.mcs.anl.gov/petsc/lib.a:coarsencreate()
1382 
1383    Level: beginner
1384 dm
1385 .seealso: MatCoarsenCreate(), MatCoarsen
1386 J*/
1387 typedef const char* MatCoarsenType;
1388 #define MATCOARSENMIS  "mis"
1389 #define MATCOARSENHEM  "hem"
1390 
1391 /* linked list for aggregates */
1392 typedef struct _PetscCDIntNd{
1393   struct _PetscCDIntNd *next;
1394   PetscInt   gid;
1395 }PetscCDIntNd;
1396 
1397 /* only used by node pool */
1398 typedef struct _PetscCDArrNd{
1399   struct _PetscCDArrNd *next;
1400   struct _PetscCDIntNd *array;
1401 }PetscCDArrNd;
1402 
1403 typedef struct _PetscCoarsenData{
1404   /* node pool */
1405   PetscCDArrNd  pool_list;
1406   PetscCDIntNd *new_node;
1407   PetscInt   new_left;
1408   PetscInt   chk_sz;
1409   PetscCDIntNd *extra_nodes;
1410   /* Array of lists */
1411   PetscCDIntNd **array;
1412   PetscInt size;
1413   /* cache a Mat for communication data */
1414   Mat mat;
1415   /* cache IS of removed equations */
1416   /* IS removedIS; */
1417 }PetscCoarsenData;
1418 
1419 PETSC_EXTERN PetscErrorCode MatCoarsenCreate(MPI_Comm,MatCoarsen*);
1420 PETSC_EXTERN PetscErrorCode MatCoarsenSetType(MatCoarsen,MatCoarsenType);
1421 PETSC_EXTERN PetscErrorCode MatCoarsenSetAdjacency(MatCoarsen,Mat);
1422 PETSC_EXTERN PetscErrorCode MatCoarsenSetGreedyOrdering(MatCoarsen,const IS);
1423 PETSC_EXTERN PetscErrorCode MatCoarsenSetStrictAggs(MatCoarsen,PetscBool);
1424 PETSC_EXTERN PetscErrorCode MatCoarsenSetVerbose(MatCoarsen,PetscInt);
1425 PETSC_EXTERN PetscErrorCode MatCoarsenGetData( MatCoarsen, PetscCoarsenData ** );
1426 PETSC_EXTERN PetscErrorCode MatCoarsenApply(MatCoarsen);
1427 PETSC_EXTERN PetscErrorCode MatCoarsenDestroy(MatCoarsen*);
1428 
1429 PETSC_EXTERN PetscErrorCode MatCoarsenRegister(const char[],const char[],const char[],PetscErrorCode (*)(MatCoarsen));
1430 
1431 /*MC
1432    MatCoarsenRegisterDynamic - Adds a new sparse matrix coarsen to the
1433    matrix package.
1434 
1435    Synopsis:
1436    PetscErrorCode MatCoarsenRegisterDynamic(const char *name_coarsen,const char *path,const char *name_create,PetscErrorCode (*routine_create)(MatCoarsen))
1437 
1438    Not Collective
1439 
1440    Input Parameters:
1441 +  sname - name of coarsen (for example MATCOARSENMIS)
1442 .  path - location of library where creation routine is
1443 .  name - name of function that creates the coarsen type, a string
1444 -  function - function pointer that creates the coarsen type
1445 
1446    Level: developer
1447 
1448    If dynamic libraries are used, then the fourth input argument (function)
1449    is ignored.
1450 
1451    Sample usage:
1452 .vb
1453    MatCoarsenRegisterDynamic("my_agg",/home/username/my_lib/lib/libO/solaris/mylib.a,
1454                "MyAggCreate",MyAggCreate);
1455 .ve
1456 
1457    Then, your aggregator can be chosen with the procedural interface via
1458 $     MatCoarsenSetType(agg,"my_agg")
1459    or at runtime via the option
1460 $     -mat_coarsen_type my_agg
1461 
1462    $PETSC_ARCH occuring in pathname will be replaced with appropriate values.
1463 
1464 .keywords: matrix, coarsen, register
1465 
1466 .seealso: MatCoarsenRegisterDestroy(), MatCoarsenRegisterAll()
1467 M*/
1468 #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
1469 #define MatCoarsenRegisterDynamic(a,b,c,d) MatCoarsenRegister(a,b,c,0)
1470 #else
1471 #define MatCoarsenRegisterDynamic(a,b,c,d) MatCoarsenRegister(a,b,c,d)
1472 #endif
1473 
1474 PETSC_EXTERN PetscBool MatCoarsenRegisterAllCalled;
1475 
1476 PETSC_EXTERN PetscErrorCode MatCoarsenRegisterAll(const char[]);
1477 PETSC_EXTERN PetscErrorCode MatCoarsenRegisterDestroy(void);
1478 
1479 PETSC_EXTERN PetscErrorCode MatCoarsenView(MatCoarsen,PetscViewer);
1480 PETSC_EXTERN PetscErrorCode MatCoarsenSetFromOptions(MatCoarsen);
1481 PETSC_EXTERN PetscErrorCode MatCoarsenGetType(MatCoarsen,MatCoarsenType*);
1482 
1483 
1484 PETSC_EXTERN PetscErrorCode MatMeshToVertexGraph(Mat,PetscInt,Mat*);
1485 PETSC_EXTERN PetscErrorCode MatMeshToCellGraph(Mat,PetscInt,Mat*);
1486 
1487 /*
1488     If you add entries here you must also add them to finclude/petscmat.h
1489 */
1490 typedef enum { MATOP_SET_VALUES=0,
1491                MATOP_GET_ROW=1,
1492                MATOP_RESTORE_ROW=2,
1493                MATOP_MULT=3,
1494                MATOP_MULT_ADD=4,
1495                MATOP_MULT_TRANSPOSE=5,
1496                MATOP_MULT_TRANSPOSE_ADD=6,
1497                MATOP_SOLVE=7,
1498                MATOP_SOLVE_ADD=8,
1499                MATOP_SOLVE_TRANSPOSE=9,
1500                MATOP_SOLVE_TRANSPOSE_ADD=10,
1501                MATOP_LUFACTOR=11,
1502                MATOP_CHOLESKYFACTOR=12,
1503                MATOP_SOR=13,
1504                MATOP_TRANSPOSE=14,
1505                MATOP_GETINFO=15,
1506                MATOP_EQUAL=16,
1507                MATOP_GET_DIAGONAL=17,
1508                MATOP_DIAGONAL_SCALE=18,
1509                MATOP_NORM=19,
1510                MATOP_ASSEMBLY_BEGIN=20,
1511                MATOP_ASSEMBLY_END=21,
1512                MATOP_SET_OPTION=22,
1513                MATOP_ZERO_ENTRIES=23,
1514                MATOP_ZERO_ROWS=24,
1515                MATOP_LUFACTOR_SYMBOLIC=25,
1516                MATOP_LUFACTOR_NUMERIC=26,
1517                MATOP_CHOLESKY_FACTOR_SYMBOLIC=27,
1518                MATOP_CHOLESKY_FACTOR_NUMERIC=28,
1519                MATOP_SETUP_PREALLOCATION=29,
1520                MATOP_ILUFACTOR_SYMBOLIC=30,
1521                MATOP_ICCFACTOR_SYMBOLIC=31,
1522                MATOP_GET_ARRAY=32,
1523                MATOP_RESTORE_ARRAY=33,
1524                MATOP_DUPLICATE=34,
1525                MATOP_FORWARD_SOLVE=35,
1526                MATOP_BACKWARD_SOLVE=36,
1527                MATOP_ILUFACTOR=37,
1528                MATOP_ICCFACTOR=38,
1529                MATOP_AXPY=39,
1530                MATOP_GET_SUBMATRICES=40,
1531                MATOP_INCREASE_OVERLAP=41,
1532                MATOP_GET_VALUES=42,
1533                MATOP_COPY=43,
1534                MATOP_GET_ROW_MAX=44,
1535                MATOP_SCALE=45,
1536                MATOP_SHIFT=46,
1537                MATOP_DIAGONAL_SET=47,
1538                MATOP_ILUDT_FACTOR=48,
1539                MATOP_SET_BLOCK_SIZE=49,
1540                MATOP_GET_ROW_IJ=50,
1541                MATOP_RESTORE_ROW_IJ=51,
1542                MATOP_GET_COLUMN_IJ=52,
1543                MATOP_RESTORE_COLUMN_IJ=53,
1544                MATOP_FDCOLORING_CREATE=54,
1545                MATOP_COLORING_PATCH=55,
1546                MATOP_SET_UNFACTORED=56,
1547                MATOP_PERMUTE=57,
1548                MATOP_SET_VALUES_BLOCKED=58,
1549                MATOP_GET_SUBMATRIX=59,
1550                MATOP_DESTROY=60,
1551                MATOP_VIEW=61,
1552                MATOP_CONVERT_FROM=62,
1553                MATOP_MATMAT_MULT=63,
1554                MATOP_MATMAT_MULT_SYMBOLIC=64,
1555                MATOP_MATMAT_MULT_NUMERIC=65,
1556                MATOP_SET_LOCAL_TO_GLOBAL_MAP=66,
1557                MATOP_SET_VALUES_LOCAL=67,
1558                MATOP_ZERO_ROWS_LOCAL=68,
1559                MATOP_GET_ROW_MAX_ABS=69,
1560                MATOP_GET_ROW_MIN_ABS=70,
1561                MATOP_CONVERT=71,
1562                MATOP_SET_COLORING=72,
1563                MATOP_SET_VALUES_ADIC=73,
1564                MATOP_SET_VALUES_ADIFOR=74,
1565                MATOP_FD_COLORING_APPLY=75,
1566                MATOP_SET_FROM_OPTIONS=76,
1567                MATOP_MULT_CONSTRAINED=77,
1568                MATOP_MULT_TRANSPOSE_CONSTRAIN=78,
1569                MATOP_PERMUTE_SPARSIFY=79,
1570                MATOP_MULT_MULTIPLE=80,
1571                MATOP_SOLVE_MULTIPLE=81,
1572                MATOP_GET_INERTIA=82,
1573                MATOP_LOAD=83,
1574                MATOP_IS_SYMMETRIC=84,
1575                MATOP_IS_HERMITIAN=85,
1576                MATOP_IS_STRUCTURALLY_SYMMETRIC=86,
1577                MATOP_SET_VALUES_BLOCKEDLOCAL=87,
1578                MATOP_GET_VECS=88,
1579                MATOP_MAT_MULT=89,
1580                MATOP_MAT_MULT_SYMBOLIC=90,
1581                MATOP_MAT_MULT_NUMERIC=91,
1582                MATOP_PTAP=92,
1583                MATOP_PTAP_SYMBOLIC=93,
1584                MATOP_PTAP_NUMERIC=94,
1585                MATOP_MAT_TRANSPOSE_MULT=95,
1586                MATOP_MAT_TRANSPOSE_MULT_SYMBO=96,
1587                MATOP_MAT_TRANSPOSE_MULT_NUMER=97,
1588                MATOP_DUMMY98=98,
1589                MATOP_DUMMY99=99,
1590                MATOP_DUMMY100=100,
1591                MATOP_DUMMY101=101,
1592                MATOP_CONJUGATE=102,
1593                MATOP_SET_SIZES=103,
1594                MATOP_SET_VALUES_ROW=104,
1595                MATOP_REAL_PART=105,
1596                MATOP_IMAGINARY_PART=106,
1597                MATOP_GET_ROW_UPPER_TRIANGULAR=107,
1598                MATOP_RESTORE_ROW_UPPER_TRIANG=108,
1599                MATOP_MAT_SOLVE=109,
1600                MATOP_GET_REDUNDANT_MATRIX=110,
1601                MATOP_GET_ROW_MIN=111,
1602                MATOP_GET_COLUMN_VECTOR=112,
1603                MATOP_MISSING_DIAGONAL=113,
1604                MATOP_GET_SEQ_NONZERO_STRUCTUR=114,
1605                MATOP_CREATE=115,
1606                MATOP_GET_GHOSTS=116,
1607                MATOP_GET_LOCAL_SUB_MATRIX=117,
1608                MATOP_RESTORE_LOCALSUB_MATRIX=118,
1609                MATOP_MULT_DIAGONAL_BLOCK=119,
1610                MATOP_HERMITIAN_TRANSPOSE=120,
1611                MATOP_MULT_HERMITIAN_TRANSPOSE=121,
1612                MATOP_MULT_HERMITIAN_TRANS_ADD=122,
1613                MATOP_GET_MULTI_PROC_BLOCK=123,
1614                MATOP_GET_COLUMN_NORMS=125,
1615 	       MATOP_GET_SUB_MATRICES_PARALLE=128,
1616                MATOP_SET_VALUES_BATCH=129,
1617                MATOP_TRANSPOSE_MAT_MULT=130,
1618                MATOP_TRANSPOSE_MAT_MULT_SYMBO=131,
1619                MATOP_TRANSPOSE_MAT_MULT_NUMER=132,
1620                MATOP_TRANSPOSE_COLORING_CREAT=133,
1621                MATOP_TRANS_COLORING_APPLY_SPT=134,
1622                MATOP_TRANS_COLORING_APPLY_DEN=135,
1623                MATOP_RART=136,
1624                MATOP_RART_SYMBOLIC=137,
1625                MATOP_RART_NUMERIC=138,
1626                MATOP_SET_BLOCK_SIZES=139,
1627                MATOP_AYPX=140
1628              } MatOperation;
1629 PETSC_EXTERN PetscErrorCode MatHasOperation(Mat,MatOperation,PetscBool *);
1630 PETSC_EXTERN PetscErrorCode MatShellSetOperation(Mat,MatOperation,void(*)(void));
1631 PETSC_EXTERN PetscErrorCode MatShellGetOperation(Mat,MatOperation,void(**)(void));
1632 PETSC_EXTERN PetscErrorCode MatShellSetContext(Mat,void*);
1633 
1634 /*
1635    Codes for matrices stored on disk. By default they are
1636    stored in a universal format. By changing the format with
1637    PetscViewerSetFormat(viewer,PETSC_VIEWER_NATIVE); the matrices will
1638    be stored in a way natural for the matrix, for example dense matrices
1639    would be stored as dense. Matrices stored this way may only be
1640    read into matrices of the same type.
1641 */
1642 #define MATRIX_BINARY_FORMAT_DENSE -1
1643 
1644 PETSC_EXTERN PetscErrorCode MatMPIBAIJSetHashTableFactor(Mat,PetscReal);
1645 PETSC_EXTERN PetscErrorCode MatISGetLocalMat(Mat,Mat*);
1646 PETSC_EXTERN PetscErrorCode MatISSetLocalMat(Mat,Mat);
1647 
1648 /*S
1649      MatNullSpace - Object that removes a null space from a vector, i.e.
1650          orthogonalizes the vector to a subsapce
1651 
1652    Level: advanced
1653 
1654   Concepts: matrix; linear operator, null space
1655 
1656   Users manual sections:
1657 .   sec_singular
1658 
1659 .seealso:  MatNullSpaceCreate()
1660 S*/
1661 typedef struct _p_MatNullSpace* MatNullSpace;
1662 
1663 PETSC_EXTERN PetscErrorCode MatNullSpaceCreate(MPI_Comm,PetscBool ,PetscInt,const Vec[],MatNullSpace*);
1664 PETSC_EXTERN PetscErrorCode MatNullSpaceSetFunction(MatNullSpace,PetscErrorCode (*)(MatNullSpace,Vec,void*),void*);
1665 PETSC_EXTERN PetscErrorCode MatNullSpaceDestroy(MatNullSpace*);
1666 PETSC_EXTERN PetscErrorCode MatNullSpaceRemove(MatNullSpace,Vec,Vec*);
1667 PETSC_EXTERN PetscErrorCode MatGetNullSpace(Mat, MatNullSpace *);
1668 PETSC_EXTERN PetscErrorCode MatSetNullSpace(Mat,MatNullSpace);
1669 PETSC_EXTERN PetscErrorCode MatSetNearNullSpace(Mat,MatNullSpace);
1670 PETSC_EXTERN PetscErrorCode MatGetNearNullSpace(Mat,MatNullSpace*);
1671 PETSC_EXTERN PetscErrorCode MatNullSpaceTest(MatNullSpace,Mat,PetscBool  *);
1672 PETSC_EXTERN PetscErrorCode MatNullSpaceView(MatNullSpace,PetscViewer);
1673 PETSC_EXTERN PetscErrorCode MatNullSpaceGetVecs(MatNullSpace,PetscBool*,PetscInt*,const Vec**);
1674 PETSC_EXTERN PetscErrorCode MatNullSpaceCreateRigidBody(Vec,MatNullSpace*);
1675 
1676 PETSC_EXTERN PetscErrorCode MatReorderingSeqSBAIJ(Mat,IS);
1677 PETSC_EXTERN PetscErrorCode MatMPISBAIJSetHashTableFactor(Mat,PetscReal);
1678 PETSC_EXTERN PetscErrorCode MatSeqSBAIJSetColumnIndices(Mat,PetscInt *);
1679 PETSC_EXTERN PetscErrorCode MatSeqBAIJInvertBlockDiagonal(Mat);
1680 
1681 PETSC_EXTERN PetscErrorCode MatCreateMAIJ(Mat,PetscInt,Mat*);
1682 PETSC_EXTERN PetscErrorCode MatMAIJRedimension(Mat,PetscInt,Mat*);
1683 PETSC_EXTERN PetscErrorCode MatMAIJGetAIJ(Mat,Mat*);
1684 
1685 PETSC_EXTERN PetscErrorCode MatComputeExplicitOperator(Mat,Mat*);
1686 
1687 PETSC_EXTERN PetscErrorCode MatDiagonalScaleLocal(Mat,Vec);
1688 
1689 PETSC_EXTERN PetscErrorCode MatCreateMFFD(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,Mat*);
1690 PETSC_EXTERN PetscErrorCode MatMFFDSetBase(Mat,Vec,Vec);
1691 PETSC_EXTERN PetscErrorCode MatMFFDSetFunction(Mat,PetscErrorCode(*)(void*,Vec,Vec),void*);
1692 PETSC_EXTERN PetscErrorCode MatMFFDSetFunctioni(Mat,PetscErrorCode (*)(void*,PetscInt,Vec,PetscScalar*));
1693 PETSC_EXTERN PetscErrorCode MatMFFDSetFunctioniBase(Mat,PetscErrorCode (*)(void*,Vec));
1694 PETSC_EXTERN PetscErrorCode MatMFFDAddNullSpace(Mat,MatNullSpace);
1695 PETSC_EXTERN PetscErrorCode MatMFFDSetHHistory(Mat,PetscScalar[],PetscInt);
1696 PETSC_EXTERN PetscErrorCode MatMFFDResetHHistory(Mat);
1697 PETSC_EXTERN PetscErrorCode MatMFFDSetFunctionError(Mat,PetscReal);
1698 PETSC_EXTERN PetscErrorCode MatMFFDSetPeriod(Mat,PetscInt);
1699 PETSC_EXTERN PetscErrorCode MatMFFDGetH(Mat,PetscScalar *);
1700 PETSC_EXTERN PetscErrorCode MatMFFDSetOptionsPrefix(Mat,const char[]);
1701 PETSC_EXTERN PetscErrorCode MatMFFDCheckPositivity(void*,Vec,Vec,PetscScalar*);
1702 PETSC_EXTERN PetscErrorCode MatMFFDSetCheckh(Mat,PetscErrorCode (*)(void*,Vec,Vec,PetscScalar*),void*);
1703 
1704 /*S
1705     MatMFFD - A data structured used to manage the computation of the h differencing parameter for matrix-free
1706               Jacobian vector products
1707 
1708     Notes: MATMFFD is a specific MatType which uses the MatMFFD data structure
1709 
1710            MatMFFD*() methods actually take the Mat as their first argument. Not a MatMFFD data structure
1711 
1712     Level: developer
1713 
1714 .seealso: MATMFFD, MatCreateMFFD(), MatMFFDSetFuction(), MatMFFDSetType(), MatMFFDRegister()
1715 S*/
1716 typedef struct _p_MatMFFD* MatMFFD;
1717 
1718 /*J
1719     MatMFFDType - algorithm used to compute the h used in computing matrix-vector products via differencing of the function
1720 
1721    Level: beginner
1722 
1723 .seealso: MatMFFDSetType(), MatMFFDRegister()
1724 J*/
1725 typedef const char* MatMFFDType;
1726 #define MATMFFD_DS  "ds"
1727 #define MATMFFD_WP  "wp"
1728 
1729 PETSC_EXTERN PetscErrorCode MatMFFDSetType(Mat,MatMFFDType);
1730 PETSC_EXTERN PetscErrorCode MatMFFDRegister(const char[],const char[],const char[],PetscErrorCode (*)(MatMFFD));
1731 
1732 /*MC
1733    MatMFFDRegisterDynamic - Adds a method to the MatMFFD registry.
1734 
1735    Synopsis:
1736    PetscErrorCode MatMFFDRegisterDynamic(const char *name_solver,const char *path,const char *name_create,PetscErrorCode (*routine_create)(MatMFFD))
1737 
1738    Not Collective
1739 
1740    Input Parameters:
1741 +  name_solver - name of a new user-defined compute-h module
1742 .  path - path (either absolute or relative) the library containing this solver
1743 .  name_create - name of routine to create method context
1744 -  routine_create - routine to create method context
1745 
1746    Level: developer
1747 
1748    Notes:
1749    MatMFFDRegisterDynamic() may be called multiple times to add several user-defined solvers.
1750 
1751    If dynamic libraries are used, then the fourth input argument (routine_create)
1752    is ignored.
1753 
1754    Sample usage:
1755 .vb
1756    MatMFFDRegisterDynamic("my_h",/home/username/my_lib/lib/libO/solaris/mylib.a,
1757                "MyHCreate",MyHCreate);
1758 .ve
1759 
1760    Then, your solver can be chosen with the procedural interface via
1761 $     MatMFFDSetType(mfctx,"my_h")
1762    or at runtime via the option
1763 $     -snes_mf_type my_h
1764 
1765 .keywords: MatMFFD, register
1766 
1767 .seealso: MatMFFDRegisterAll(), MatMFFDRegisterDestroy()
1768 M*/
1769 #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
1770 #define MatMFFDRegisterDynamic(a,b,c,d) MatMFFDRegister(a,b,c,0)
1771 #else
1772 #define MatMFFDRegisterDynamic(a,b,c,d) MatMFFDRegister(a,b,c,d)
1773 #endif
1774 
1775 PETSC_EXTERN PetscErrorCode MatMFFDRegisterAll(const char[]);
1776 PETSC_EXTERN PetscErrorCode MatMFFDRegisterDestroy(void);
1777 PETSC_EXTERN PetscErrorCode MatMFFDDSSetUmin(Mat,PetscReal);
1778 PETSC_EXTERN PetscErrorCode MatMFFDWPSetComputeNormU(Mat,PetscBool );
1779 
1780 
1781 PETSC_EXTERN PetscErrorCode PetscViewerMathematicaPutMatrix(PetscViewer, PetscInt, PetscInt, PetscReal *);
1782 PETSC_EXTERN PetscErrorCode PetscViewerMathematicaPutCSRMatrix(PetscViewer, PetscInt, PetscInt, PetscInt *, PetscInt *, PetscReal *);
1783 
1784 /*
1785    PETSc interface to MUMPS
1786 */
1787 #ifdef PETSC_HAVE_MUMPS
1788 PETSC_EXTERN PetscErrorCode MatMumpsSetIcntl(Mat,PetscInt,PetscInt);
1789 #endif
1790 
1791 /*
1792    PETSc interface to SUPERLU
1793 */
1794 #ifdef PETSC_HAVE_SUPERLU
1795 PETSC_EXTERN PetscErrorCode MatSuperluSetILUDropTol(Mat,PetscReal);
1796 #endif
1797 
1798 #if defined PETSC_HAVE_TXPETSCGPU
1799 
1800 /*E
1801     MatCUSPARSEStorageFormat - indicates the storage format for CUSPARSE (GPU)
1802     matrices.
1803 
1804     Not Collective
1805 
1806 +   MAT_CUSPARSE_CSR : Compressed Sparse Row
1807 .   MAT_CUSPARSE_ELL : Ellpack
1808 -   MAT_CUSPARSE_HYB : Hybrid, a combination of Ellpack and Coordinate format.
1809 
1810     Level: intermediate
1811 
1812    Any additions/changes here MUST also be made in include/finclude/petscmat.h
1813 
1814 .seealso: MatCUSPARSESetFormat(), MatCUSPARSEFormatOperation
1815 E*/
1816 
1817 typedef enum {MAT_CUSPARSE_CSR, MAT_CUSPARSE_ELL, MAT_CUSPARSE_HYB} MatCUSPARSEStorageFormat;
1818 
1819 /* these will be strings associated with enumerated type defined above */
1820 PETSC_EXTERN const char *const MatCUSPARSEStorageFormats[];
1821 
1822 /*E
1823     MatCUSPARSEFormatOperation - indicates the operation of CUSPARSE (GPU)
1824     matrices whose operation should use a particular storage format.
1825 
1826     Not Collective
1827 
1828 +   MAT_CUSPARSE_MULT_DIAG : sets the storage format for the diagonal matrix in the parallel MatMult
1829 .   MAT_CUSPARSE_MULT_OFFDIAG : sets the storage format for the offdiagonal matrix in the parallel MatMult
1830 .   MAT_CUSPARSE_MULT : sets the storage format for the entire matrix in the serial (single GPU) MatMult
1831 .   MAT_CUSPARSE_SOLVE : sets the storage format for the triangular factors in the serial (single GPU) MatSolve
1832 -   MAT_CUSPARSE_ALL : sets the storage format for all CUSPARSE (GPU) matrices
1833 
1834     Level: intermediate
1835 
1836 .seealso: MatCUSPARSESetFormat(), MatCUSPARSEStorageFormat
1837 E*/
1838 typedef enum {MAT_CUSPARSE_MULT_DIAG, MAT_CUSPARSE_MULT_OFFDIAG, MAT_CUSPARSE_MULT, MAT_CUSPARSE_SOLVE, MAT_CUSPARSE_ALL} MatCUSPARSEFormatOperation;
1839 
1840 PETSC_EXTERN PetscErrorCode MatCreateSeqAIJCUSPARSE(MPI_Comm,PetscInt,PetscInt,PetscInt,const PetscInt[],Mat*);
1841 PETSC_EXTERN PetscErrorCode MatCreateAIJCUSPARSE(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],PetscInt,const PetscInt[],Mat*);
1842 PETSC_EXTERN PetscErrorCode MatCUSPARSESetFormat(Mat,MatCUSPARSEFormatOperation,MatCUSPARSEStorageFormat);
1843 
1844 #endif
1845 
1846 #if defined(PETSC_HAVE_CUSP)
1847 PETSC_EXTERN PetscErrorCode MatCreateSeqAIJCUSP(MPI_Comm,PetscInt,PetscInt,PetscInt,const PetscInt[],Mat*);
1848 PETSC_EXTERN PetscErrorCode MatCreateAIJCUSP(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],PetscInt,const PetscInt[],Mat*);
1849 
1850 /*E
1851     MatCUSPStorageFormat - indicates the storage format for CUSP (GPU)
1852     matrices.
1853 
1854     Not Collective
1855 
1856 +   MAT_CUSP_CSR : Compressed Sparse Row
1857 .   MAT_CUSP_DIA : Diagonal
1858 -   MAT_CUSP_ELL : Ellpack
1859 
1860     Level: intermediate
1861 
1862    Any additions/changes here MUST also be made in include/finclude/petscmat.h
1863 
1864 .seealso: MatCUSPSetFormat(), MatCUSPFormatOperation
1865 E*/
1866 typedef enum {MAT_CUSP_CSR, MAT_CUSP_DIA, MAT_CUSP_ELL} MatCUSPStorageFormat;
1867 
1868 /* these will be strings associated with enumerated type defined above */
1869 PETSC_EXTERN const char *const MatCUSPStorageFormats[];
1870 
1871 /*E
1872     MatCUSPFormatOperation - indicates the operation of CUSP (GPU)
1873     matrices whose operation should use a particular storage format.
1874 
1875     Not Collective
1876 
1877 +   MAT_CUSP_MULT_DIAG : sets the storage format for the diagonal matrix in the parallel MatMult
1878 .   MAT_CUSP_MULT_OFFDIAG : sets the storage format for the offdiagonal matrix in the parallel MatMult
1879 .   MAT_CUSP_MULT : sets the storage format for the entire matrix in the serial (single GPU) MatMult
1880 .   MAT_CUSP_SOLVE : sets the storage format for the triangular factors in the serial (single GPU) MatSolve
1881 -   MAT_CUSP_ALL : sets the storage format for all CUSP (GPU) matrices
1882 
1883     Level: intermediate
1884 
1885    Any additions/changes here MUST also be made in include/finclude/petscmat.h
1886 
1887 .seealso: MatCUSPSetFormat(), MatCUSPStorageFormat
1888 E*/
1889 typedef enum {MAT_CUSP_MULT_DIAG, MAT_CUSP_MULT_OFFDIAG, MAT_CUSP_MULT, MAT_CUSP_SOLVE, MAT_CUSP_ALL} MatCUSPFormatOperation;
1890 
1891 PETSC_EXTERN PetscErrorCode MatCUSPSetFormat(Mat,MatCUSPFormatOperation,MatCUSPStorageFormat);
1892 #endif
1893 
1894 /*
1895    PETSc interface to FFTW
1896 */
1897 #if defined(PETSC_HAVE_FFTW)
1898 PETSC_EXTERN PetscErrorCode VecScatterPetscToFFTW(Mat,Vec,Vec);
1899 PETSC_EXTERN PetscErrorCode VecScatterFFTWToPetsc(Mat,Vec,Vec);
1900 PETSC_EXTERN PetscErrorCode MatGetVecsFFTW(Mat,Vec*,Vec*,Vec*);
1901 #endif
1902 
1903 #if defined(PETSC_HAVE_ELEMENTAL)
1904 PETSC_EXTERN PetscErrorCode PetscElementalInitializePackage(const char*);
1905 PETSC_EXTERN PetscErrorCode PetscElementalFinalizePackage(void);
1906 #endif
1907 
1908 PETSC_EXTERN PetscErrorCode MatCreateNest(MPI_Comm,PetscInt,const IS[],PetscInt,const IS[],const Mat[],Mat*);
1909 PETSC_EXTERN PetscErrorCode MatNestGetSize(Mat,PetscInt*,PetscInt*);
1910 PETSC_EXTERN PetscErrorCode MatNestGetISs(Mat,IS[],IS[]);
1911 PETSC_EXTERN PetscErrorCode MatNestGetLocalISs(Mat,IS[],IS[]);
1912 PETSC_EXTERN PetscErrorCode MatNestGetSubMats(Mat,PetscInt*,PetscInt*,Mat***);
1913 PETSC_EXTERN PetscErrorCode MatNestGetSubMat(Mat,PetscInt,PetscInt,Mat*);
1914 PETSC_EXTERN PetscErrorCode MatNestSetVecType(Mat,VecType);
1915 PETSC_EXTERN PetscErrorCode MatNestSetSubMats(Mat,PetscInt,const IS[],PetscInt,const IS[],const Mat[]);
1916 PETSC_EXTERN PetscErrorCode MatNestSetSubMat(Mat,PetscInt,PetscInt,Mat);
1917 
1918 /*
1919  MatIJ:
1920  An unweighted directed pseudograph
1921  An interpretation of this matrix as a (pseudo)graph allows us to define additional operations on it:
1922  A MatIJ can act on sparse arrays: arrays of indices, or index arrays of integers, scalars, or integer-scalar pairs
1923  by mapping the indices to the indices connected to them by the (pseudo)graph ed
1924  */
1925 typedef enum {MATIJ_LOCAL, MATIJ_GLOBAL} MatIJIndexType;
1926 PETSC_EXTERN PetscErrorCode MatIJSetMultivalued(Mat, PetscBool);
1927 PETSC_EXTERN PetscErrorCode MatIJGetMultivalued(Mat, PetscBool*);
1928 PETSC_EXTERN PetscErrorCode MatIJSetEdges(Mat, PetscInt, const PetscInt*, const PetscInt*);
1929 PETSC_EXTERN PetscErrorCode MatIJGetEdges(Mat, PetscInt *, PetscInt **, PetscInt **);
1930 PETSC_EXTERN PetscErrorCode MatIJSetEdgesIS(Mat, IS, IS);
1931 PETSC_EXTERN PetscErrorCode MatIJGetEdgesIS(Mat, IS*, IS*);
1932 PETSC_EXTERN PetscErrorCode MatIJGetRowSizes(Mat, MatIJIndexType, PetscInt, const PetscInt *, PetscInt **);
1933 PETSC_EXTERN PetscErrorCode MatIJGetMinRowSize(Mat, PetscInt *);
1934 PETSC_EXTERN PetscErrorCode MatIJGetMaxRowSize(Mat, PetscInt *);
1935 PETSC_EXTERN PetscErrorCode MatIJGetSupport(Mat,  PetscInt *, PetscInt **);
1936 PETSC_EXTERN PetscErrorCode MatIJGetSupportIS(Mat, IS *);
1937 PETSC_EXTERN PetscErrorCode MatIJGetImage(Mat, PetscInt*, PetscInt**);
1938 PETSC_EXTERN PetscErrorCode MatIJGetImageIS(Mat, IS *);
1939 PETSC_EXTERN PetscErrorCode MatIJGetSupportSize(Mat, PetscInt *);
1940 PETSC_EXTERN PetscErrorCode MatIJGetImageSize(Mat, PetscInt *);
1941 
1942 PETSC_EXTERN PetscErrorCode MatIJBinRenumber(Mat, Mat*);
1943 
1944 PETSC_EXTERN PetscErrorCode MatIJMap(Mat, MatIJIndexType, PetscInt,const PetscInt*,const PetscInt*,const PetscScalar*, MatIJIndexType,PetscInt*,PetscInt**,PetscInt**,PetscScalar**,PetscInt**);
1945 PETSC_EXTERN PetscErrorCode MatIJBin(Mat, MatIJIndexType, PetscInt,const PetscInt*,const PetscInt*,const PetscScalar*,PetscInt*,PetscInt**,PetscInt**,PetscScalar**,PetscInt**);
1946 PETSC_EXTERN PetscErrorCode MatIJBinMap(Mat,Mat, MatIJIndexType,PetscInt,const PetscInt*,const PetscInt*,const PetscScalar*,MatIJIndexType,PetscInt*,PetscInt**,PetscInt**,PetscScalar**,PetscInt**);
1947 
1948 PETSC_EXTERN PetscErrorCode MatChop(Mat,PetscReal);
1949 
1950 #endif
1951