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