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