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