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