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