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