xref: /petsc/include/petscmat.h (revision 37b5b9611b07231c0c9c8e7355d420c04053c2bc)
1 /* $Id: mat.h,v 1.185 2000/01/08 01:19:02 bsmith Exp bsmith $ */
2 /*
3      Include file for the matrix component of PETSc
4 */
5 #ifndef __MAT_H
6 #define __MAT_H
7 #include "vec.h"
8 
9 #define MAT_COOKIE         PETSC_COOKIE+5
10 
11 typedef struct _p_Mat*           Mat;
12 
13 #define MAX_MATRIX_TYPES 14
14 /*
15    The default matrix data storage formats and routines to create them.
16 
17    MATLASTTYPE is "end-of-list" marker that can be used to check that
18    MAX_MATRIX_TYPES is large enough.  The rule is
19    MAX_MATRIX_TYPES >= MATLASTTYPE .
20 
21    To do: add a test program that checks the consistency of these values.
22 */
23 typedef enum { MATSAME=-1,  MATSEQDENSE, MATSEQAIJ,   MATMPIAIJ,   MATSHELL,
24                MATMPIROWBS, MATSEQBDIAG, MATMPIBDIAG, MATMPIDENSE, MATSEQBAIJ,
25                MATMPIBAIJ,  MATMPICSN,   MATSEQCSN,   MATMPICSR, MATSEQSBAIJ,
26                MATLASTTYPE } MatType;
27 
28 extern int MatCreate(MPI_Comm,int,int,int,int,Mat*);
29 extern int MatCreateSeqDense(MPI_Comm,int,int,Scalar*,Mat*);
30 extern int MatCreateMPIDense(MPI_Comm,int,int,int,int,Scalar*,Mat*);
31 extern int MatCreateSeqAIJ(MPI_Comm,int,int,int,int*,Mat*);
32 extern int MatCreateMPIAIJ(MPI_Comm,int,int,int,int,int,int*,int,int*,Mat*);
33 extern int MatCreateMPIRowbs(MPI_Comm,int,int,int,int*,void*,Mat*);
34 extern int MatCreateSeqBDiag(MPI_Comm,int,int,int,int,int*,Scalar**,Mat*);
35 extern int MatCreateMPIBDiag(MPI_Comm,int,int,int,int,int,int*,Scalar**,Mat*);
36 extern int MatCreateSeqBAIJ(MPI_Comm,int,int,int,int,int*,Mat*);
37 extern int MatCreateMPIBAIJ(MPI_Comm,int,int,int,int,int,int,int*,int,int*,Mat*);
38 extern int MatCreateMPICSR(MPI_Comm,int,int,int*,int*,MatScalar *,Mat*);
39 
40 extern int MatDestroy(Mat);
41 
42 extern int MatCreateShell(MPI_Comm,int,int,int,int,void *,Mat*);
43 extern int MatShellGetContext(Mat,void **);
44 
45 extern int MatPrintHelp(Mat);
46 extern int MatGetMaps(Mat,Map*,Map*);
47 
48 /* ------------------------------------------------------------*/
49 extern int MatSetValues(Mat,int,int*,int,int*,Scalar*,InsertMode);
50 extern int MatSetValuesBlocked(Mat,int,int*,int,int*,Scalar*,InsertMode);
51 
52 typedef enum {MAT_FLUSH_ASSEMBLY=1,MAT_FINAL_ASSEMBLY=0} MatAssemblyType;
53 extern int MatAssemblyBegin(Mat,MatAssemblyType);
54 extern int MatAssemblyEnd(Mat,MatAssemblyType);
55 extern int MatAssembled(Mat,PetscTruth*);
56 
57 #define MatSetValue(v,i,j,va,mode) \
58 {int _ierr,_row = i,_col = j; Scalar _va = va; \
59   _ierr = MatSetValues(v,1,&_row,1,&_col,&_va,mode);CHKERRQ(_ierr); \
60 }
61 #define MatGetValue(v,i,j,va) \
62 {int _ierr,_row = i,_col = j; \
63   _ierr = MatGetValues(v,1,&_row,1,&_col,&va);CHKERRQ(_ierr); \
64 }
65 /*
66    Any additions/changes here MUST also be made in include/finclude/mat.h
67 */
68 typedef enum {MAT_ROW_ORIENTED=1,MAT_COLUMN_ORIENTED=2,MAT_ROWS_SORTED=4,
69               MAT_COLUMNS_SORTED=8,MAT_NO_NEW_NONZERO_LOCATIONS=16,
70               MAT_YES_NEW_NONZERO_LOCATIONS=32,MAT_SYMMETRIC=64,
71               MAT_STRUCTURALLY_SYMMETRIC=65,MAT_NO_NEW_DIAGONALS=66,
72               MAT_YES_NEW_DIAGONALS=67,MAT_INODE_LIMIT_1=68,MAT_INODE_LIMIT_2=69,
73               MAT_INODE_LIMIT_3=70,MAT_INODE_LIMIT_4=71,MAT_INODE_LIMIT_5=72,
74               MAT_IGNORE_OFF_PROC_ENTRIES=73,MAT_ROWS_UNSORTED=74,
75               MAT_COLUMNS_UNSORTED=75,MAT_NEW_NONZERO_LOCATION_ERR=76,
76               MAT_NEW_NONZERO_ALLOCATION_ERR=77,MAT_USE_HASH_TABLE=78,
77               MAT_KEEP_ZEROED_ROWS=79,MAT_IGNORE_ZERO_ENTRIES=80} MatOption;
78 extern int MatSetOption(Mat,MatOption);
79 extern int MatGetType(Mat,MatType*,char**);
80 extern int MatGetTypeFromOptions(MPI_Comm,char*,MatType*,PetscTruth*);
81 
82 extern int MatGetValues(Mat,int,int*,int,int*,Scalar*);
83 extern int MatGetRow(Mat,int,int *,int **,Scalar**);
84 extern int MatRestoreRow(Mat,int,int *,int **,Scalar**);
85 extern int MatGetColumn(Mat,int,int *,int **,Scalar**);
86 extern int MatRestoreColumn(Mat,int,int *,int **,Scalar**);
87 extern int MatGetColumnVector(Mat,Vec,int);
88 extern int MatGetArray(Mat,Scalar **);
89 extern int MatRestoreArray(Mat,Scalar **);
90 extern int MatGetBlockSize(Mat,int *);
91 
92 extern int MatMult(Mat,Vec,Vec);
93 extern int MatMultAdd(Mat,Vec,Vec,Vec);
94 extern int MatMultTranspose(Mat,Vec,Vec);
95 extern int MatMultTransposeAdd(Mat,Vec,Vec,Vec);
96 
97 typedef enum {MAT_DO_NOT_COPY_VALUES,MAT_COPY_VALUES} MatDuplicateOption;
98 
99 extern int MatConvert(Mat,MatType,Mat*);
100 extern int MatDuplicate(Mat,MatDuplicateOption,Mat*);
101 extern int MatConvertRegister(MatType,MatType,int (*)(Mat,MatType,Mat*));
102 extern int MatConvertRegisterAll(void);
103 
104 typedef enum {SAME_NONZERO_PATTERN,DIFFERENT_NONZERO_PATTERN,SAME_PRECONDITIONER} MatStructure;
105 
106 extern int MatCopy(Mat,Mat,MatStructure);
107 extern int MatView(Mat,Viewer);
108 extern int MatLoad(Viewer,MatType,Mat*);
109 extern int MatLoadRegister(MatType,int (*)(Viewer,MatType,Mat*));
110 extern int MatLoadRegisterAll(void);
111 
112 extern int MatGetRowIJ(Mat,int,PetscTruth,int*,int **,int **,PetscTruth *);
113 extern int MatRestoreRowIJ(Mat,int,PetscTruth,int *,int **,int **,PetscTruth *);
114 extern int MatGetColumnIJ(Mat,int,PetscTruth,int*,int **,int **,PetscTruth *);
115 extern int MatRestoreColumnIJ(Mat,int,PetscTruth,int *,int **,int **,PetscTruth *);
116 
117 /*
118    Context of matrix information, used with MatGetInfo()
119    Note: If any entries are added to this context, be sure
120          to adjust MAT_INFO_SIZE in finclude/mat.h
121  */
122 typedef struct {
123   PLogDouble rows_global,columns_global;         /* number of global rows and columns */
124   PLogDouble rows_local,columns_local;           /* number of local rows and columns */
125   PLogDouble block_size;                          /* block size */
126   PLogDouble nz_allocated,nz_used,nz_unneeded;  /* number of nonzeros */
127   PLogDouble memory;                              /* memory allocated */
128   PLogDouble assemblies;                          /* number of matrix assemblies */
129   PLogDouble mallocs;                             /* number of mallocs during MatSetValues() */
130   PLogDouble fill_ratio_given,fill_ratio_needed; /* fill ratio for LU/ILU */
131   PLogDouble factor_mallocs;                      /* number of mallocs during factorization */
132 } MatInfo;
133 
134 typedef enum {MAT_LOCAL=1,MAT_GLOBAL_MAX=2,MAT_GLOBAL_SUM=3} MatInfoType;
135 extern int MatGetInfo(Mat,MatInfoType,MatInfo*);
136 extern int MatValid(Mat,PetscTruth*);
137 extern int MatGetDiagonal(Mat,Vec);
138 extern int MatTranspose(Mat,Mat*);
139 extern int MatPermute(Mat,IS,IS,Mat *);
140 extern int MatDiagonalScale(Mat,Vec,Vec);
141 extern int MatDiagonalShift(Mat,Vec);
142 extern int MatEqual(Mat,Mat,PetscTruth*);
143 
144 extern int MatNorm(Mat,NormType,double *);
145 extern int MatZeroEntries(Mat);
146 extern int MatZeroRows(Mat,IS,Scalar*);
147 extern int MatZeroColumns(Mat,IS,Scalar*);
148 
149 extern int MatUseScaledForm(Mat,PetscTruth);
150 extern int MatScaleSystem(Mat,Vec,Vec);
151 extern int MatUnScaleSystem(Mat,Vec,Vec);
152 
153 extern int MatGetSize(Mat,int*,int*);
154 extern int MatGetLocalSize(Mat,int*,int*);
155 extern int MatGetOwnershipRange(Mat,int*,int*);
156 
157 typedef enum {MAT_INITIAL_MATRIX,MAT_REUSE_MATRIX} MatReuse;
158 extern int MatGetSubMatrices(Mat,int,IS *,IS *,MatReuse,Mat **);
159 extern int MatDestroyMatrices(int,Mat **);
160 extern int MatGetSubMatrix(Mat,IS,IS,int,MatReuse,Mat *);
161 
162 extern int MatIncreaseOverlap(Mat,int,IS *,int);
163 
164 extern int MatAXPY(Scalar *,Mat,Mat);
165 extern int MatAYPX(Scalar *,Mat,Mat);
166 extern int MatCompress(Mat);
167 
168 extern int MatScale(Scalar *,Mat);
169 extern int MatShift(Scalar *,Mat);
170 
171 extern int MatSetLocalToGlobalMapping(Mat,ISLocalToGlobalMapping);
172 extern int MatSetLocalToGlobalMappingBlock(Mat,ISLocalToGlobalMapping);
173 extern int MatZeroRowsLocal(Mat,IS,Scalar*);
174 extern int MatSetValuesLocal(Mat,int,int*,int,int*,Scalar*,InsertMode);
175 extern int MatSetValuesBlockedLocal(Mat,int,int*,int,int*,Scalar*,InsertMode);
176 
177 extern int MatSetStashInitialSize(Mat,int,int);
178 
179 extern int MatInterpolateAdd(Mat,Vec,Vec,Vec);
180 extern int MatInterpolate(Mat,Vec,Vec);
181 extern int MatRestrict(Mat,Vec,Vec);
182 
183 /*
184       These three macros MUST be used together. The third one closes the open { of the first one
185 */
186 #define MatPreallocateInitialize(comm,nrows,ncols,dnz,onz) \
187 { \
188   int __ierr,__tmp = (nrows),__ctmp = (ncols),__rstart,__start,__end; \
189   dnz = (int*)PetscMalloc(2*__tmp*sizeof(int));CHKPTRQ(dnz);onz = dnz + __tmp;\
190   __ierr = PetscMemzero(dnz,2*__tmp*sizeof(int));CHKERRQ(__ierr);\
191   __ierr = MPI_Scan(&__ctmp,&__end,1,MPI_INT,MPI_SUM,comm);CHKERRQ(__ierr); __start = __end - __ctmp;\
192   __ierr = MPI_Scan(&__tmp,&__rstart,1,MPI_INT,MPI_SUM,comm);CHKERRQ(__ierr); __rstart = __rstart - __tmp;
193 
194 #define MatPreallocateSet(row,nc,cols,dnz,onz)\
195 { int __i; \
196   for (__i=0; __i<nc; __i++) {\
197     if (cols[__i] < __start || cols[__i] >= __end) onz[row - __rstart]++; \
198   }\
199   dnz[row - __rstart] = nc - onz[row - __rstart];\
200 }
201 
202 #define MatPreallocateFinalize(dnz,onz) __ierr = PetscFree(dnz);CHKERRQ(__ierr);}
203 
204 /* Routines unique to particular data structures */
205 extern int MatBDiagGetData(Mat,int*,int*,int**,int**,Scalar***);
206 extern int MatSeqAIJSetColumnIndices(Mat,int *);
207 extern int MatSeqBAIJSetColumnIndices(Mat,int *);
208 extern int MatCreateSeqAIJWithArrays(MPI_Comm,int,int,int*,int*,Scalar *,Mat*);
209 
210 extern int MatStoreValues(Mat);
211 extern int MatRetrieveValues(Mat);
212 
213 /*
214   These routines are not usually accessed directly, rather solving is
215   done through the SLES, KSP and PC interfaces.
216 */
217 
218 typedef char* MatOrderingType;
219 #define MATORDERING_NATURAL   "natural"
220 #define MATORDERING_ND        "nd"
221 #define MATORDERING_1WD       "1wd"
222 #define MATORDERING_RCM       "rcm"
223 #define MATORDERING_QMD       "qmd"
224 #define MATORDERING_ROWLENGTH "rowlength"
225 
226 extern int MatGetOrdering(Mat,MatOrderingType,IS*,IS*);
227 extern int MatOrderingRegister(char*,char*,char*,int(*)(Mat,MatOrderingType,IS*,IS*));
228 #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
229 #define MatOrderingRegisterDynamic(a,b,c,d) MatOrderingRegister(a,b,c,0)
230 #else
231 #define MatOrderingRegisterDynamic(a,b,c,d) MatOrderingRegister(a,b,c,d)
232 #endif
233 extern int MatOrderingRegisterDestroy(void);
234 extern int MatOrderingRegisterAll(char*);
235 extern int MatOrderingRegisterAllCalled;
236 
237 extern int MatReorderForNonzeroDiagonal(Mat,double,IS,IS);
238 
239 extern int MatCholeskyFactor(Mat,IS,double);
240 extern int MatCholeskyFactorSymbolic(Mat,IS,double,Mat*);
241 extern int MatCholeskyFactorNumeric(Mat,Mat*);
242 
243 /*
244    Context of matrix information, used with MatILUFactor() and MatILUFactorSymbolic()
245    Note: If any entries are added to this context, be sure
246          to adjust MAT_ILUINFO_SIZE in finclude/mat.h
247 
248    Note: The integer values below are passed in double to allow easy use from
249          Fortran
250  */
251 typedef struct {
252   double     levels;  /* ILU(levels) */
253   double     fill;    /* expected fill; nonzeros in factored matrix/nonzeros in original matrix*/
254   double     diagonal_fill;  /* force diagonal to fill in if initially not filled */
255 
256   double     dt;             /* drop tolerance */
257   double     dtcol;          /* tolerance for pivoting */
258   double     dtcount;        /* maximum nonzeros to be allowed per row */
259 } MatILUInfo;
260 
261 extern int MatLUFactor(Mat,IS,IS,double);
262 extern int MatILUFactor(Mat,IS,IS,MatILUInfo*);
263 extern int MatLUFactorSymbolic(Mat,IS,IS,double,Mat*);
264 extern int MatILUFactorSymbolic(Mat,IS,IS,MatILUInfo*,Mat*);
265 extern int MatIncompleteCholeskyFactorSymbolic(Mat,IS,double,int,Mat*);
266 extern int MatLUFactorNumeric(Mat,Mat*);
267 extern int MatILUDTFactor(Mat,MatILUInfo*,IS,IS,Mat *);
268 
269 extern int MatSolve(Mat,Vec,Vec);
270 extern int MatForwardSolve(Mat,Vec,Vec);
271 extern int MatBackwardSolve(Mat,Vec,Vec);
272 extern int MatSolveAdd(Mat,Vec,Vec,Vec);
273 extern int MatSolveTranspose(Mat,Vec,Vec);
274 extern int MatSolveTransposeAdd(Mat,Vec,Vec,Vec);
275 
276 extern int MatSetUnfactored(Mat);
277 
278 /*  MatSORType may be bitwise ORd together, so do not change the numbers */
279 
280 typedef enum {SOR_FORWARD_SWEEP=1,SOR_BACKWARD_SWEEP=2,SOR_SYMMETRIC_SWEEP=3,
281               SOR_LOCAL_FORWARD_SWEEP=4,SOR_LOCAL_BACKWARD_SWEEP=8,
282               SOR_LOCAL_SYMMETRIC_SWEEP=12,SOR_ZERO_INITIAL_GUESS=16,
283               SOR_EISENSTAT=32,SOR_APPLY_UPPER=64,SOR_APPLY_LOWER=128} MatSORType;
284 extern int MatRelax(Mat,Vec,double,MatSORType,double,int,Vec);
285 
286 /*
287     These routines are for efficiently computing Jacobians via finite differences.
288 */
289 
290 typedef char* MatColoringType;
291 #define MATCOLORING_NATURAL "natural"
292 #define MATCOLORING_SL      "sl"
293 #define MATCOLORING_LF      "lf"
294 #define MATCOLORING_ID      "id"
295 
296 extern int MatGetColoring(Mat,MatColoringType,ISColoring*);
297 extern int MatColoringRegister(char*,char*,char*,int(*)(Mat,MatColoringType,ISColoring *));
298 #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
299 #define MatColoringRegisterDynamic(a,b,c,d) MatColoringRegister(a,b,c,0)
300 #else
301 #define MatColoringRegisterDynamic(a,b,c,d) MatColoringRegister(a,b,c,d)
302 #endif
303 extern int MatColoringRegisterAll(char *);
304 extern int MatColoringRegisterAllCalled;
305 extern int MatColoringRegisterDestroy(void);
306 extern int MatColoringPatch(Mat,int,int *,ISColoring*);
307 
308 /*
309     Data structures used to compute Jacobian vector products
310   efficiently using finite differences.
311 */
312 #define MAT_FDCOLORING_COOKIE PETSC_COOKIE + 23
313 
314 typedef struct _p_MatFDColoring *MatFDColoring;
315 
316 extern int MatFDColoringCreate(Mat,ISColoring,MatFDColoring *);
317 extern int MatFDColoringDestroy(MatFDColoring);
318 extern int MatFDColoringView(MatFDColoring,Viewer);
319 extern int MatFDColoringSetFunction(MatFDColoring,int (*)(void),void*);
320 extern int MatFDColoringSetParameters(MatFDColoring,double,double);
321 extern int MatFDColoringSetFrequency(MatFDColoring,int);
322 extern int MatFDColoringGetFrequency(MatFDColoring,int*);
323 extern int MatFDColoringSetFromOptions(MatFDColoring);
324 extern int MatFDColoringPrintHelp(MatFDColoring);
325 extern int MatFDColoringApply(Mat,MatFDColoring,Vec,MatStructure*,void *);
326 extern int MatFDColoringApplyTS(Mat,MatFDColoring,double,Vec,MatStructure*,void *);
327 
328 /*
329     These routines are for partitioning matrices: currently used only
330   for adjacency matrix, MatCreateMPICSR().
331 */
332 #define MATPARTITIONING_COOKIE PETSC_COOKIE + 25
333 
334 typedef struct _p_MatPartitioning *MatPartitioning;
335 typedef char* MatPartitioningType;
336 #define MATPARTITIONING_CURRENT  "current"
337 #define MATPARTITIONING_PARMETIS "parmetis"
338 
339 extern int MatPartitioningCreate(MPI_Comm,MatPartitioning*);
340 extern int MatPartitioningSetType(MatPartitioning,MatPartitioningType);
341 extern int MatPartitioningSetAdjacency(MatPartitioning,Mat);
342 extern int MatPartitioningSetVertexWeights(MatPartitioning,double*);
343 extern int MatPartitioningApply(MatPartitioning,IS*);
344 extern int MatPartitioningDestroy(MatPartitioning);
345 
346 extern int MatPartitioningRegister(char*,char*,char*,int(*)(MatPartitioning));
347 #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
348 #define MatPartitioningRegisterDynamic(a,b,c,d) MatPartitioningRegister(a,b,c,0)
349 #else
350 #define MatPartitioningRegisterDynamic(a,b,c,d) MatPartitioningRegister(a,b,c,d)
351 #endif
352 
353 extern int MatPartitioningRegisterAll(char *);
354 extern int MatPartitioningRegisterAllCalled;
355 extern int MatPartitioningRegisterDestroy(void);
356 extern int MatPartitioningView(MatPartitioning,Viewer);
357 extern int MatPartitioningSetFromOptions(MatPartitioning);
358 extern int MatPartitioningPrintHelp(MatPartitioning);
359 extern int MatPartitioningGetType(MatPartitioning,MatPartitioningType*);
360 
361 extern int MatPartitioningParmetisSetCoarseSequential(MatPartitioning);
362 
363 /*
364     If you add entries here you must also add them to finclude/mat.h
365 */
366 typedef enum { MATOP_SET_VALUES=0,
367                MATOP_GET_ROW=1,
368                MATOP_RESTORE_ROW=2,
369                MATOP_MULT=3,
370                MATOP_MULT_ADD=4,
371                MATOP_MULT_TRANSPOSE=5,
372                MATOP_MULT_TRANSPOSE_ADD=6,
373                MATOP_SOLVE=7,
374                MATOP_SOLVE_ADD=8,
375                MATOP_SOLVE_TRANSPOSE=9,
376                MATOP_SOLVE_TRANSPOSE_ADD=10,
377                MATOP_LUFACTOR=11,
378                MATOP_CHOLESKYFACTOR=12,
379                MATOP_RELAX=13,
380                MATOP_TRANSPOSE=14,
381                MATOP_GETINFO=15,
382                MATOP_EQUAL=16,
383                MATOP_GET_DIAGONAL=17,
384                MATOP_DIAGONAL_SCALE=18,
385                MATOP_NORM=19,
386                MATOP_ASSEMBLY_BEGIN=20,
387                MATOP_ASSEMBLY_END=21,
388                MATOP_COMPRESS=22,
389                MATOP_SET_OPTION=23,
390                MATOP_ZERO_ENTRIES=24,
391                MATOP_ZERO_ROWS=25,
392                MATOP_LUFACTOR_SYMBOLIC=26,
393                MATOP_LUFACTOR_NUMERIC=27,
394                MATOP_CHOLESKY_FACTOR_SYMBOLIC=28,
395                MATOP_CHOLESKY_FACTOR_NUMERIC=29,
396                MATOP_GET_SIZE=30,
397                MATOP_GET_LOCAL_SIZE=31,
398                MATOP_GET_OWNERSHIP_RANGE=32,
399                MATOP_ILUFACTOR_SYMBOLIC=33,
400                MATOP_INCOMPLETECHOLESKYFACTOR_SYMBOLIC=34,
401                MATOP_GET_ARRAY=35,
402                MATOP_RESTORE_ARRAY=36,
403 
404                MATOP_CONVERT_SAME_TYPE=37,
405                MATOP_FORWARD_SOLVE=38,
406                MATOP_BACKWARD_SOLVE=39,
407                MATOP_ILUFACTOR=40,
408                MATOP_INCOMPLETECHOLESKYFACTOR=41,
409                MATOP_AXPY=42,
410                MATOP_GET_SUBMATRICES=43,
411                MATOP_INCREASE_OVERLAP=44,
412                MATOP_GET_VALUES=45,
413                MATOP_COPY=46,
414                MATOP_PRINT_HELP=47,
415                MATOP_SCALE=48,
416                MATOP_SHIFT=49,
417                MATOP_DIAGONAL_SHIFT=50,
418                MATOP_ILUDT_FACTOR=51,
419                MATOP_GET_BLOCK_SIZE=52,
420                MATOP_GET_ROW_IJ=53,
421                MATOP_RESTORE_ROW_IJ=54,
422                MATOP_GET_COLUMN_IJ=55,
423                MATOP_RESTORE_COLUMN_IJ=56,
424                MATOP_FDCOLORING_CREATE=57,
425                MATOP_COLORING_PATCH=58,
426                MATOP_SET_UNFACTORED=59,
427                MATOP_PERMUTE=60,
428                MATOP_SET_VALUES_BLOCKED=61,
429                MATOP_DESTROY=250,
430                MATOP_VIEW=251
431              } MatOperation;
432 extern int MatHasOperation(Mat,MatOperation,PetscTruth*);
433 extern int MatShellSetOperation(Mat,MatOperation,void *);
434 extern int MatShellGetOperation(Mat,MatOperation,void **);
435 
436 /*
437    Codes for matrices stored on disk. By default they are
438  stored in a universal format. By changing the format with
439  ViewerSetFormat(viewer,VIEWER_FORMAT_BINARY_NATIVE); the matrices will
440  be stored in a way natural for the matrix, for example dense matrices
441  would be stored as dense. Matrices stored this way may only be
442  read into matrices of the same time.
443 */
444 #define MATRIX_BINARY_FORMAT_DENSE -1
445 
446 /*
447      New matrix classes not yet distributed
448 */
449 /*
450     MatAIJIndices is a data structure for storing the nonzero location information
451   for sparse matrices. Several matrices with identical nonzero structure can share
452   the same MatAIJIndices.
453 */
454 typedef struct _p_MatAIJIndices* MatAIJIndices;
455 
456 extern int MatCreateAIJIndices(int,int,int*,int*,PetscTruth,MatAIJIndices*);
457 extern int MatCreateAIJIndicesEmpty(int,int,int*,PetscTruth,MatAIJIndices*);
458 extern int MatAttachAIJIndices(MatAIJIndices,MatAIJIndices*);
459 extern int MatDestroyAIJIndices(MatAIJIndices);
460 extern int MatCopyAIJIndices(MatAIJIndices,MatAIJIndices*);
461 extern int MatValidateAIJIndices(int,MatAIJIndices);
462 extern int MatShiftAIJIndices(MatAIJIndices);
463 extern int MatShrinkAIJIndices(MatAIJIndices);
464 extern int MatTransposeAIJIndices(MatAIJIndices,MatAIJIndices*);
465 
466 extern int MatCreateSeqCSN(MPI_Comm,int,int,int*,int,Mat*);
467 extern int MatCreateSeqCSN_Single(MPI_Comm,int,int,int*,int,Mat*);
468 extern int MatCreateSeqCSNWithPrecision(MPI_Comm,int,int,int*,int,ScalarPrecision,Mat*);
469 
470 extern int MatCreateSeqCSNIndices(MPI_Comm,MatAIJIndices,int,Mat *);
471 extern int MatCreateSeqCSNIndices_Single(MPI_Comm,MatAIJIndices,int,Mat *);
472 extern int MatCreateSeqCSNIndicesWithPrecision(MPI_Comm,MatAIJIndices,int,ScalarPrecision,Mat *);
473 
474 extern int MatMPIBAIJSetHashTableFactor(Mat,double);
475 extern int MatSeqAIJGetInodeSizes(Mat,int *,int *[],int *);
476 
477 
478 #endif
479 
480 
481 
482