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