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 MatType const char*

 81: /* Logging support */
 82: #define    MAT_FILE_COOKIE 1211216    /* used to indicate matrices in binary files */

 88: /*E
 89:     MatReuse - Indicates if matrices obtained from a previous call to MatGetSubMatrices()
 90:      or MatGetSubMatrix() are to be reused to store the new matrix values.

 92:     Level: beginner

 94:    Any additions/changes here MUST also be made in include/finclude/petscmat.h

 96: .seealso: MatGetSubMatrices(), MatGetSubMatrix(), MatDestroyMatrices(), MatConvert()
 97: E*/
 98: typedef enum {MAT_INITIAL_MATRIX,MAT_REUSE_MATRIX} MatReuse;

100: EXTERN PetscErrorCode  MatInitializePackage(char *);

102: EXTERN PetscErrorCode  MatCreate(MPI_Comm,Mat*);
103: PetscPolymorphicFunction(MatCreate,(MPI_Comm comm),(comm,&A),Mat,A)
104: PetscPolymorphicFunction(MatCreate,(),(PETSC_COMM_WORLD,&A),Mat,A)
105: EXTERN PetscErrorCode  MatSetSizes(Mat,PetscInt,PetscInt,PetscInt,PetscInt);
106: EXTERN PetscErrorCode  MatSetType(Mat,MatType);
107: EXTERN PetscErrorCode  MatSetFromOptions(Mat);
108: EXTERN PetscErrorCode  MatSetUpPreallocation(Mat);
109: EXTERN PetscErrorCode  MatRegisterAll(const char[]);
110: EXTERN PetscErrorCode  MatRegister(const char[],const char[],const char[],PetscErrorCode(*)(Mat));

112: EXTERN PetscErrorCode  MatSetOptionsPrefix(Mat,const char[]);
113: EXTERN PetscErrorCode  MatAppendOptionsPrefix(Mat,const char[]);
114: EXTERN PetscErrorCode  MatGetOptionsPrefix(Mat,const char*[]);

116: /*MC
117:    MatRegisterDynamic - Adds a new matrix type

119:    Synopsis:
120:    PetscErrorCode MatRegisterDynamic(char *name,char *path,char *name_create,PetscErrorCode (*routine_create)(Mat))

122:    Not Collective

124:    Input Parameters:
125: +  name - name of a new user-defined matrix type
126: .  path - path (either absolute or relative) the library containing this solver
127: .  name_create - name of routine to create method context
128: -  routine_create - routine to create method context

130:    Notes:
131:    MatRegisterDynamic() may be called multiple times to add several user-defined solvers.

133:    If dynamic libraries are used, then the fourth input argument (routine_create)
134:    is ignored.

136:    Sample usage:
137: .vb
138:    MatRegisterDynamic("my_mat",/home/username/my_lib/lib/libO/solaris/mylib.a,
139:                "MyMatCreate",MyMatCreate);
140: .ve

142:    Then, your solver can be chosen with the procedural interface via
143: $     MatSetType(Mat,"my_mat")
144:    or at runtime via the option
145: $     -mat_type my_mat

147:    Level: advanced

149:    Notes: ${PETSC_ARCH} occuring in pathname will be replaced with appropriate values.
150:          If your function is not being put into a shared library then use VecRegister() instead

152: .keywords: Mat, register

154: .seealso: MatRegisterAll(), MatRegisterDestroy()

156: M*/
157: #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
158: #define MatRegisterDynamic(a,b,c,d) MatRegister(a,b,c,0)
159: #else
160: #define MatRegisterDynamic(a,b,c,d) MatRegister(a,b,c,d)
161: #endif


166: EXTERN PetscErrorCode  MatCreateSeqDense(MPI_Comm,PetscInt,PetscInt,PetscScalar[],Mat*);
167: EXTERN PetscErrorCode  MatCreateMPIDense(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,PetscScalar[],Mat*);
168: EXTERN PetscErrorCode  MatCreateSeqAIJ(MPI_Comm,PetscInt,PetscInt,PetscInt,const PetscInt[],Mat*);
169: PetscPolymorphicFunction(MatCreateSeqAIJ,(PetscInt m,PetscInt n,PetscInt nz,const PetscInt nnz[]),(PETSC_COMM_SELF,m,n,nz,nnz,&A),Mat,A)
170: PetscPolymorphicFunction(MatCreateSeqAIJ,(PetscInt m,PetscInt n,PetscInt nz),(PETSC_COMM_SELF,m,n,nz,PETSC_NULL,&A),Mat,A)
171: PetscPolymorphicFunction(MatCreateSeqAIJ,(PetscInt m,PetscInt n,const PetscInt nnz[]),(PETSC_COMM_SELF,m,n,0,nnz,&A),Mat,A)
172: PetscPolymorphicFunction(MatCreateSeqAIJ,(PetscInt m,PetscInt n),(PETSC_COMM_SELF,m,n,0,PETSC_NULL,&A),Mat,A)
173: PetscPolymorphicSubroutine(MatCreateSeqAIJ,(PetscInt m,PetscInt n,PetscInt nz,Mat *A),(PETSC_COMM_SELF,m,n,nz,PETSC_NULL,A))
174: PetscPolymorphicSubroutine(MatCreateSeqAIJ,(PetscInt m,PetscInt n,const PetscInt nnz[],Mat *A),(PETSC_COMM_SELF,m,n,0,nnz,A))
175: PetscPolymorphicSubroutine(MatCreateSeqAIJ,(PetscInt m,PetscInt n,Mat *A),(PETSC_COMM_SELF,m,n,0,PETSC_NULL,A))
176: EXTERN PetscErrorCode  MatCreateMPIAIJ(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],PetscInt,const PetscInt[],Mat*);
177: 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)
178: 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)
179: 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)
180: 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)
181: 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))
182: 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))
183: 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))
184: 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)
185: 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)
186: 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)
187: 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)
188: 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))
189: 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))
190: 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))
191: EXTERN PetscErrorCode  MatCreateMPIIJWithArrays(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],const PetscInt[],const PetscScalar[],Mat *);
192: EXTERN PetscErrorCode  MatCreateMPIRowbs(MPI_Comm,PetscInt,PetscInt,PetscInt,const PetscInt[],Mat*);
193: EXTERN PetscErrorCode  MatCreateSeqBDiag(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],PetscScalar*[],Mat*);
194: EXTERN PetscErrorCode  MatCreateMPIBDiag(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],PetscScalar*[],Mat*);
195: EXTERN PetscErrorCode  MatCreateSeqBAIJ(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],Mat*);
196: PetscPolymorphicFunction(MatCreateSeqBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt nz,const PetscInt nnz[]),(PETSC_COMM_SELF,bs,m,n,nz,nnz,&A),Mat,A)
197: PetscPolymorphicFunction(MatCreateSeqBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt nz),(PETSC_COMM_SELF,bs,m,n,nz,PETSC_NULL,&A),Mat,A)
198: PetscPolymorphicFunction(MatCreateSeqBAIJ,(PetscInt bs,PetscInt m,PetscInt n,const PetscInt nnz[]),(PETSC_COMM_SELF,bs,m,n,0,nnz,&A),Mat,A)
199: PetscPolymorphicFunction(MatCreateSeqBAIJ,(PetscInt bs,PetscInt m,PetscInt n),(PETSC_COMM_SELF,bs,m,n,0,PETSC_NULL,&A),Mat,A)
200: PetscPolymorphicSubroutine(MatCreateSeqBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt nz,Mat *A),(PETSC_COMM_SELF,bs,m,n,nz,PETSC_NULL,A))
201: PetscPolymorphicSubroutine(MatCreateSeqBAIJ,(PetscInt bs,PetscInt m,PetscInt n,const PetscInt nnz[],Mat *A),(PETSC_COMM_SELF,bs,m,n,0,nnz,A))
202: PetscPolymorphicSubroutine(MatCreateSeqBAIJ,(PetscInt bs,PetscInt m,PetscInt n,Mat *A),(PETSC_COMM_SELF,bs,m,n,0,PETSC_NULL,A))
203: EXTERN PetscErrorCode  MatCreateMPIBAIJ(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],PetscInt,const PetscInt[],Mat*);
204: 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)
205: 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)
206: 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)
207: 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)
208: 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))
209: 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))
210: 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))
211: 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)
212: 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)
213: 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)
214: 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)
215: 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))
216: 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))
217: 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))
218: EXTERN PetscErrorCode  MatCreateMPIAdj(MPI_Comm,PetscInt,PetscInt,PetscInt[],PetscInt[],PetscInt[],Mat*);
219: EXTERN PetscErrorCode  MatCreateSeqSBAIJ(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],Mat*);
220: PetscPolymorphicFunction(MatCreateSeqSBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt nz,const PetscInt nnz[]),(PETSC_COMM_SELF,bs,m,n,nz,nnz,&A),Mat,A)
221: PetscPolymorphicFunction(MatCreateSeqSBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt nz),(PETSC_COMM_SELF,bs,m,n,nz,PETSC_NULL,&A),Mat,A)
222: PetscPolymorphicFunction(MatCreateSeqSBAIJ,(PetscInt bs,PetscInt m,PetscInt n,const PetscInt nnz[]),(PETSC_COMM_SELF,bs,m,n,0,nnz,&A),Mat,A)
223: PetscPolymorphicFunction(MatCreateSeqSBAIJ,(PetscInt bs,PetscInt m,PetscInt n),(PETSC_COMM_SELF,bs,m,n,0,PETSC_NULL,&A),Mat,A)
224: PetscPolymorphicSubroutine(MatCreateSeqSBAIJ,(PetscInt bs,PetscInt m,PetscInt n,PetscInt nz,Mat *A),(PETSC_COMM_SELF,bs,m,n,nz,PETSC_NULL,A))
225: PetscPolymorphicSubroutine(MatCreateSeqSBAIJ,(PetscInt bs,PetscInt m,PetscInt n,const PetscInt nnz[],Mat *A),(PETSC_COMM_SELF,bs,m,n,0,nnz,A))
226: PetscPolymorphicSubroutine(MatCreateSeqSBAIJ,(PetscInt bs,PetscInt m,PetscInt n,Mat *A),(PETSC_COMM_SELF,bs,m,n,0,PETSC_NULL,A))
227: EXTERN PetscErrorCode  MatCreateMPISBAIJ(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],PetscInt,const PetscInt[],Mat*);
228: 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)
229: 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)
230: 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)
231: 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)
232: 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))
233: 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))
234: 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))
235: 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)
236: 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)
237: 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)
238: 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)
239: 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))
240: 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))
241: 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))
242: EXTERN PetscErrorCode  MatCreateShell(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,void *,Mat*);
243: PetscPolymorphicFunction(MatCreateShell,(MPI_Comm comm,PetscInt m,PetscInt n,PetscInt M,PetscInt N,void *ctx),(comm,m,n,M,N,ctx,&A),Mat,A)
244: PetscPolymorphicFunction(MatCreateShell,(PetscInt m,PetscInt n,PetscInt M,PetscInt N,void *ctx),(PETSC_COMM_WORLD,m,n,M,N,ctx,&A),Mat,A)
245: EXTERN PetscErrorCode  MatCreateAdic(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,void (*)(void),Mat*);
246: EXTERN PetscErrorCode  MatCreateNormal(Mat,Mat*);
247: PetscPolymorphicFunction(MatCreateNormal,(Mat mat),(mat,&A),Mat,A)
248: EXTERN PetscErrorCode  MatCreateLRC(Mat,Mat,Mat,Mat*);
249: EXTERN PetscErrorCode  MatCreateIS(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,ISLocalToGlobalMapping,Mat*);
250: EXTERN PetscErrorCode  MatCreateSeqCRL(MPI_Comm,PetscInt,PetscInt,PetscInt,const PetscInt[],Mat*);
251: EXTERN PetscErrorCode  MatCreateMPICRL(MPI_Comm,PetscInt,PetscInt,PetscInt,const PetscInt[],PetscInt,const PetscInt[],Mat*);
252: EXTERN PetscErrorCode  MatCreateScatter(MPI_Comm,VecScatter,Mat*);
253: EXTERN PetscErrorCode  MatScatterSetVecScatter(Mat,VecScatter);
254: EXTERN PetscErrorCode  MatScatterGetVecScatter(Mat,VecScatter*);


257: EXTERN PetscErrorCode  MatSetUp(Mat);
258: EXTERN PetscErrorCode  MatDestroy(Mat);

260: EXTERN PetscErrorCode  MatConjugate(Mat);
261: EXTERN PetscErrorCode  MatRealPart(Mat);
262: EXTERN PetscErrorCode  MatImaginaryPart(Mat);

264: /* ------------------------------------------------------------*/
265: EXTERN PetscErrorCode  MatSetValues(Mat,PetscInt,const PetscInt[],PetscInt,const PetscInt[],const PetscScalar[],InsertMode);
266: EXTERN PetscErrorCode  MatSetValuesBlocked(Mat,PetscInt,const PetscInt[],PetscInt,const PetscInt[],const PetscScalar[],InsertMode);
267: EXTERN PetscErrorCode  MatSetValuesRow(Mat,PetscInt,const PetscScalar[]);
268: EXTERN PetscErrorCode  MatSetValuesRowLocal(Mat,PetscInt,const PetscScalar[]);

270: /*S
271:      MatStencil - Data structure (C struct) for storing information about a single row or
272:         column of a matrix as index on an associated grid.

274:    Level: beginner

276:   Concepts: matrix; linear operator

278: .seealso:  MatSetValuesStencil(), MatSetStencil(), MatSetValuesBlockStencil()
279: S*/
280: typedef struct {
281:   PetscInt k,j,i,c;
282: } MatStencil;

284: EXTERN PetscErrorCode  MatSetValuesStencil(Mat,PetscInt,const MatStencil[],PetscInt,const MatStencil[],const PetscScalar[],InsertMode);
285: EXTERN PetscErrorCode  MatSetValuesBlockedStencil(Mat,PetscInt,const MatStencil[],PetscInt,const MatStencil[],const PetscScalar[],InsertMode);
286: EXTERN PetscErrorCode  MatSetStencil(Mat,PetscInt,const PetscInt[],const PetscInt[],PetscInt);

288: EXTERN PetscErrorCode  MatSetColoring(Mat,ISColoring);
289: EXTERN PetscErrorCode  MatSetValuesAdic(Mat,void*);
290: EXTERN PetscErrorCode  MatSetValuesAdifor(Mat,PetscInt,void*);

292: /*E
293:     MatAssemblyType - Indicates if the matrix is now to be used, or if you plan 
294:      to continue to add values to it

296:     Level: beginner

298: .seealso: MatAssemblyBegin(), MatAssemblyEnd()
299: E*/
300: typedef enum {MAT_FLUSH_ASSEMBLY=1,MAT_FINAL_ASSEMBLY=0} MatAssemblyType;
301: EXTERN PetscErrorCode  MatAssemblyBegin(Mat,MatAssemblyType);
302: EXTERN PetscErrorCode  MatAssemblyEnd(Mat,MatAssemblyType);
303: EXTERN PetscErrorCode  MatAssembled(Mat,PetscTruth*);


309: /*MC
310:    MatSetValue - Set a single entry into a matrix.

312:    Synopsis:
313:    PetscErrorCode MatSetValue(Mat m,PetscInt row,PetscInt col,PetscScalar value,InsertMode mode);

315:    Not collective

317:    Input Parameters:
318: +  m - the matrix
319: .  row - the row location of the entry
320: .  col - the column location of the entry
321: .  value - the value to insert
322: -  mode - either INSERT_VALUES or ADD_VALUES

324:    Notes: 
325:    For efficiency one should use MatSetValues() and set several or many
326:    values simultaneously if possible.

328:    Level: beginner

330: .seealso: MatSetValues(), MatSetValueLocal()
331: M*/
332: #define MatSetValue(v,i,j,va,mode) \
333:   ((MatSetValue_Row = i,MatSetValue_Column = j,MatSetValue_Value = va,0) || \
334:    MatSetValues(v,1,&MatSetValue_Row,1,&MatSetValue_Column,&MatSetValue_Value,mode))

336: #define MatGetValue(v,i,j,va) \
337:   ((MatSetValue_Row = i,MatSetValue_Column = j,0) || \
338:    MatGetValues(v,1,&MatSetValue_Row,1,&MatSetValue_Column,&va))

340: #define MatSetValueLocal(v,i,j,va,mode) \
341:   ((MatSetValue_Row = i,MatSetValue_Column = j,MatSetValue_Value = va,0) || \
342:    MatSetValuesLocal(v,1,&MatSetValue_Row,1,&MatSetValue_Column,&MatSetValue_Value,mode))

344: /*E
345:     MatOption - Options that may be set for a matrix and its behavior or storage

347:     Level: beginner

349:    Any additions/changes here MUST also be made in include/finclude/petscmat.h

351: .seealso: MatSetOption()
352: E*/
353: typedef enum {MAT_ROW_ORIENTED=1,MAT_COLUMN_ORIENTED=2,MAT_ROWS_SORTED=4,
354:               MAT_COLUMNS_SORTED=8,MAT_NO_NEW_NONZERO_LOCATIONS=16,
355:               MAT_YES_NEW_NONZERO_LOCATIONS=32,MAT_SYMMETRIC=64,
356:               MAT_STRUCTURALLY_SYMMETRIC=65,MAT_NO_NEW_DIAGONALS=66,
357:               MAT_YES_NEW_DIAGONALS=67,MAT_INODE_LIMIT_1=68,MAT_INODE_LIMIT_2=69,
358:               MAT_INODE_LIMIT_3=70,MAT_INODE_LIMIT_4=71,MAT_INODE_LIMIT_5=72,
359:               MAT_IGNORE_OFF_PROC_ENTRIES=73,MAT_ROWS_UNSORTED=74,
360:               MAT_COLUMNS_UNSORTED=75,MAT_NEW_NONZERO_LOCATION_ERR=76,
361:               MAT_NEW_NONZERO_ALLOCATION_ERR=77,MAT_USE_HASH_TABLE=78,
362:               MAT_KEEP_ZEROED_ROWS=79,MAT_IGNORE_ZERO_ENTRIES=80,MAT_USE_INODES=81,
363:               MAT_DO_NOT_USE_INODES=82,MAT_NOT_SYMMETRIC=83,MAT_HERMITIAN=84,
364:               MAT_NOT_STRUCTURALLY_SYMMETRIC=85,MAT_NOT_HERMITIAN=86,
365:               MAT_SYMMETRY_ETERNAL=87,MAT_NOT_SYMMETRY_ETERNAL=88,
366:               MAT_USE_COMPRESSEDROW=89,MAT_DO_NOT_USE_COMPRESSEDROW=90,
367:               MAT_IGNORE_LOWER_TRIANGULAR=91,MAT_ERROR_LOWER_TRIANGULAR=92,MAT_GETROW_UPPERTRIANGULAR=93} MatOption;
368: EXTERN PetscErrorCode  MatSetOption(Mat,MatOption);
369: EXTERN PetscErrorCode  MatGetType(Mat,MatType*);
370: PetscPolymorphicFunction(MatGetType,(Mat mat),(mat,&t),MatType,t)

372: EXTERN PetscErrorCode  MatGetValues(Mat,PetscInt,const PetscInt[],PetscInt,const PetscInt[],PetscScalar[]);
373: EXTERN PetscErrorCode  MatGetRow(Mat,PetscInt,PetscInt *,const PetscInt *[],const PetscScalar*[]);
374: EXTERN PetscErrorCode  MatRestoreRow(Mat,PetscInt,PetscInt *,const PetscInt *[],const PetscScalar*[]);
375: EXTERN PetscErrorCode  MatGetRowUpperTriangular(Mat);
376: EXTERN PetscErrorCode  MatRestoreRowUpperTriangular(Mat);
377: EXTERN PetscErrorCode  MatGetColumn(Mat,PetscInt,PetscInt *,const PetscInt *[],const PetscScalar*[]);
378: EXTERN PetscErrorCode  MatRestoreColumn(Mat,PetscInt,PetscInt *,const PetscInt *[],const PetscScalar*[]);
379: EXTERN PetscErrorCode  MatGetColumnVector(Mat,Vec,PetscInt);
380: EXTERN PetscErrorCode  MatGetArray(Mat,PetscScalar *[]);
381: PetscPolymorphicFunction(MatGetArray,(Mat mat),(mat,&a),PetscScalar*,a)
382: EXTERN PetscErrorCode  MatRestoreArray(Mat,PetscScalar *[]);
383: EXTERN PetscErrorCode  MatGetBlockSize(Mat,PetscInt *);
384: PetscPolymorphicFunction(MatGetBlockSize,(Mat mat),(mat,&a),PetscInt,a)
385: EXTERN PetscErrorCode  MatSetBlockSize(Mat,PetscInt);

387: EXTERN PetscErrorCode  MatMult(Mat,Vec,Vec);
388: EXTERN PetscErrorCode  MatMultAdd(Mat,Vec,Vec,Vec);
389: PetscPolymorphicSubroutine(MatMultAdd,(Mat A,Vec x,Vec y),(A,x,y,y))
390: EXTERN PetscErrorCode  MatMultTranspose(Mat,Vec,Vec);
391: EXTERN PetscErrorCode  MatIsTranspose(Mat,Mat,PetscReal,PetscTruth*);
392: PetscPolymorphicFunction(MatIsTranspose,(Mat A,Mat B,PetscReal tol),(A,B,tol,&t),PetscTruth,t)
393: PetscPolymorphicFunction(MatIsTranspose,(Mat A,Mat B),(A,B,0,&t),PetscTruth,t)
394: EXTERN PetscErrorCode  MatMultTransposeAdd(Mat,Vec,Vec,Vec);
395: PetscPolymorphicSubroutine(MatMultTransposeAdd,(Mat A,Vec x,Vec y),(A,x,y,y))
396: EXTERN PetscErrorCode  MatMultConstrained(Mat,Vec,Vec);
397: EXTERN PetscErrorCode  MatMultTransposeConstrained(Mat,Vec,Vec);
398: EXTERN PetscErrorCode  MatMatSolve(Mat,Mat,Mat);

400: /*E
401:     MatDuplicateOption - Indicates if a duplicated sparse matrix should have
402:   its numerical values copied over or just its nonzero structure.

404:     Level: beginner

406:    Any additions/changes here MUST also be made in include/finclude/petscmat.h

408: .seealso: MatDuplicate()
409: E*/
410: typedef enum {MAT_DO_NOT_COPY_VALUES,MAT_COPY_VALUES} MatDuplicateOption;

412: EXTERN PetscErrorCode  MatConvert(Mat,MatType,MatReuse,Mat*);
413: PetscPolymorphicFunction(MatConvert,(Mat A,MatType t),(A,t,MAT_INITIAL_MATRIX,&a),Mat,a)
414: EXTERN PetscErrorCode  MatDuplicate(Mat,MatDuplicateOption,Mat*);
415: PetscPolymorphicFunction(MatDuplicate,(Mat A,MatDuplicateOption o),(A,o,&a),Mat,a)
416: PetscPolymorphicFunction(MatDuplicate,(Mat A),(A,MAT_COPY_VALUES,&a),Mat,a)

418: /*E
419:     MatStructure - Indicates if the matrix has the same nonzero structure

421:     Level: beginner

423:    Any additions/changes here MUST also be made in include/finclude/petscmat.h

425: .seealso: MatCopy(), KSPSetOperators(), PCSetOperators()
426: E*/
427: typedef enum {SAME_NONZERO_PATTERN,DIFFERENT_NONZERO_PATTERN,SAME_PRECONDITIONER,SUBSET_NONZERO_PATTERN} MatStructure;

429: EXTERN PetscErrorCode  MatCopy(Mat,Mat,MatStructure);
430: EXTERN PetscErrorCode  MatView(Mat,PetscViewer);
431: EXTERN PetscErrorCode  MatIsSymmetric(Mat,PetscReal,PetscTruth*);
432: PetscPolymorphicFunction(MatIsSymmetric,(Mat A,PetscReal tol),(A,tol,&t),PetscTruth,t)
433: PetscPolymorphicFunction(MatIsSymmetric,(Mat A),(A,0,&t),PetscTruth,t)
434: EXTERN PetscErrorCode  MatIsStructurallySymmetric(Mat,PetscTruth*);
435: PetscPolymorphicFunction(MatIsStructurallySymmetric,(Mat A),(A,&t),PetscTruth,t)
436: EXTERN PetscErrorCode  MatIsHermitian(Mat,PetscTruth*);
437: PetscPolymorphicFunction(MatIsHermitian,(Mat A),(A,&t),PetscTruth,t)
438: EXTERN PetscErrorCode  MatIsSymmetricKnown(Mat,PetscTruth*,PetscTruth*);
439: EXTERN PetscErrorCode  MatIsHermitianKnown(Mat,PetscTruth*,PetscTruth*);
440: EXTERN PetscErrorCode  MatLoad(PetscViewer,MatType,Mat*);
441: PetscPolymorphicFunction(MatLoad,(PetscViewer v,MatType t),(v,t,&a),Mat,a)

443: EXTERN PetscErrorCode  MatGetRowIJ(Mat,PetscInt,PetscTruth,PetscInt*,PetscInt *[],PetscInt *[],PetscTruth *);
444: EXTERN PetscErrorCode  MatRestoreRowIJ(Mat,PetscInt,PetscTruth,PetscInt *,PetscInt *[],PetscInt *[],PetscTruth *);
445: EXTERN PetscErrorCode  MatGetColumnIJ(Mat,PetscInt,PetscTruth,PetscInt*,PetscInt *[],PetscInt *[],PetscTruth *);
446: EXTERN PetscErrorCode  MatRestoreColumnIJ(Mat,PetscInt,PetscTruth,PetscInt *,PetscInt *[],PetscInt *[],PetscTruth *);

448: /*S
449:      MatInfo - Context of matrix information, used with MatGetInfo()

451:    In Fortran this is simply a double precision array of dimension MAT_INFO_SIZE

453:    Level: intermediate

455:   Concepts: matrix^nonzero information

457: .seealso:  MatGetInfo(), MatInfoType
458: S*/
459: typedef struct {
460:   PetscLogDouble rows_global,columns_global;         /* number of global rows and columns */
461:   PetscLogDouble rows_local,columns_local;           /* number of local rows and columns */
462:   PetscLogDouble block_size;                         /* block size */
463:   PetscLogDouble nz_allocated,nz_used,nz_unneeded;   /* number of nonzeros */
464:   PetscLogDouble memory;                             /* memory allocated */
465:   PetscLogDouble assemblies;                         /* number of matrix assemblies called */
466:   PetscLogDouble mallocs;                            /* number of mallocs during MatSetValues() */
467:   PetscLogDouble fill_ratio_given,fill_ratio_needed; /* fill ratio for LU/ILU */
468:   PetscLogDouble factor_mallocs;                     /* number of mallocs during factorization */
469: } MatInfo;

471: /*E
472:     MatInfoType - Indicates if you want information about the local part of the matrix,
473:      the entire parallel matrix or the maximum over all the local parts.

475:     Level: beginner

477:    Any additions/changes here MUST also be made in include/finclude/petscmat.h

479: .seealso: MatGetInfo(), MatInfo
480: E*/
481: typedef enum {MAT_LOCAL=1,MAT_GLOBAL_MAX=2,MAT_GLOBAL_SUM=3} MatInfoType;
482: EXTERN PetscErrorCode  MatGetInfo(Mat,MatInfoType,MatInfo*);
483: EXTERN PetscErrorCode  MatValid(Mat,PetscTruth*);
484: EXTERN PetscErrorCode  MatGetDiagonal(Mat,Vec);
485: EXTERN PetscErrorCode  MatGetRowMax(Mat,Vec);
486: EXTERN PetscErrorCode  MatTranspose(Mat,Mat*);
487: PetscPolymorphicFunction(MatTranspose,(Mat A),(A,&t),Mat,t)
488: EXTERN PetscErrorCode  MatPermute(Mat,IS,IS,Mat *);
489: PetscPolymorphicFunction(MatPermute,(Mat A,IS is1,IS is2),(A,is1,is2,&t),Mat,t)
490: EXTERN PetscErrorCode  MatPermuteSparsify(Mat,PetscInt,PetscReal,PetscReal,IS,IS,Mat *);
491: EXTERN PetscErrorCode  MatDiagonalScale(Mat,Vec,Vec);
492: EXTERN PetscErrorCode  MatDiagonalSet(Mat,Vec,InsertMode);
493: EXTERN PetscErrorCode  MatEqual(Mat,Mat,PetscTruth*);
494: PetscPolymorphicFunction(MatEqual,(Mat A,Mat B),(A,B,&t),PetscTruth,t)
495: EXTERN PetscErrorCode  MatMultEqual(Mat,Mat,PetscInt,PetscTruth*);
496: EXTERN PetscErrorCode  MatMultAddEqual(Mat,Mat,PetscInt,PetscTruth*);
497: EXTERN PetscErrorCode  MatMultTransposeEqual(Mat,Mat,PetscInt,PetscTruth*);
498: EXTERN PetscErrorCode  MatMultTransposeAddEqual(Mat,Mat,PetscInt,PetscTruth*);

500: EXTERN PetscErrorCode  MatNorm(Mat,NormType,PetscReal *);
501: PetscPolymorphicFunction(MatNorm,(Mat A,NormType t),(A,t,&n),PetscReal,n)
502: EXTERN PetscErrorCode  MatZeroEntries(Mat);
503: EXTERN PetscErrorCode  MatZeroRows(Mat,PetscInt,const PetscInt [],PetscScalar);
504: EXTERN PetscErrorCode  MatZeroRowsIS(Mat,IS,PetscScalar);
505: EXTERN PetscErrorCode  MatZeroColumns(Mat,PetscInt,const PetscInt [],const PetscScalar*);
506: EXTERN PetscErrorCode  MatZeroColumnsIS(Mat,IS,const PetscScalar*);

508: EXTERN PetscErrorCode  MatUseScaledForm(Mat,PetscTruth);
509: EXTERN PetscErrorCode  MatScaleSystem(Mat,Vec,Vec);
510: EXTERN PetscErrorCode  MatUnScaleSystem(Mat,Vec,Vec);

512: EXTERN PetscErrorCode  MatGetSize(Mat,PetscInt*,PetscInt*);
513: EXTERN PetscErrorCode  MatGetLocalSize(Mat,PetscInt*,PetscInt*);
514: EXTERN PetscErrorCode  MatGetOwnershipRange(Mat,PetscInt*,PetscInt*);

516: EXTERN PetscErrorCode  MatGetSubMatrices(Mat,PetscInt,const IS[],const IS[],MatReuse,Mat *[]);
517: EXTERN PetscErrorCode  MatDestroyMatrices(PetscInt,Mat *[]);
518: EXTERN PetscErrorCode  MatGetSubMatrix(Mat,IS,IS,PetscInt,MatReuse,Mat *);
519: EXTERN PetscErrorCode  MatGetSubMatrixRaw(Mat,PetscInt,const PetscInt[],PetscInt,const PetscInt[],PetscInt,MatReuse,Mat *);
520: EXTERN PetscErrorCode  MatMerge(MPI_Comm,Mat,PetscInt,MatReuse,Mat*);
521: EXTERN PetscErrorCode  MatMerge_SeqsToMPI(MPI_Comm,Mat,PetscInt,PetscInt,MatReuse,Mat*);
522: EXTERN PetscErrorCode  MatMerge_SeqsToMPISymbolic(MPI_Comm,Mat,PetscInt,PetscInt,Mat*);
523: EXTERN PetscErrorCode  MatMerge_SeqsToMPINumeric(Mat,Mat);
524: EXTERN PetscErrorCode  MatDestroy_MPIAIJ_SeqsToMPI(Mat);
525: EXTERN PetscErrorCode  MatGetLocalMat(Mat,MatReuse,Mat*);
526: EXTERN PetscErrorCode  MatGetLocalMatCondensed(Mat,MatReuse,IS*,IS*,Mat*);
527: EXTERN PetscErrorCode  MatGetBrowsOfAcols(Mat,Mat,MatReuse,IS*,IS*,PetscInt*,Mat*);
528: EXTERN PetscErrorCode  MatGetBrowsOfAoCols(Mat,Mat,MatReuse,PetscInt**,PetscScalar**,Mat*);
529: #if defined (PETSC_USE_CTABLE)
530:  #include petscctable.h
531: EXTERN PetscErrorCode  MatGetCommunicationStructs(Mat, Vec *, PetscTable *, VecScatter *);
532: #else
533: EXTERN PetscErrorCode  MatGetCommunicationStructs(Mat, Vec *, PetscInt *[], VecScatter *);
534: #endif

536: EXTERN PetscErrorCode  MatIncreaseOverlap(Mat,PetscInt,IS[],PetscInt);

538: EXTERN PetscErrorCode  MatMatMult(Mat,Mat,MatReuse,PetscReal,Mat*);
539: EXTERN PetscErrorCode  MatMatMultSymbolic(Mat,Mat,PetscReal,Mat*);
540: EXTERN PetscErrorCode  MatMatMultNumeric(Mat,Mat,Mat);

542: EXTERN PetscErrorCode  MatPtAP(Mat,Mat,MatReuse,PetscReal,Mat*);
543: EXTERN PetscErrorCode  MatPtAPSymbolic(Mat,Mat,PetscReal,Mat*);
544: EXTERN PetscErrorCode  MatPtAPNumeric(Mat,Mat,Mat);

546: EXTERN PetscErrorCode  MatMatMultTranspose(Mat,Mat,MatReuse,PetscReal,Mat*);
547: EXTERN PetscErrorCode  MatMatMultTransposeSymbolic(Mat,Mat,PetscReal,Mat*);
548: EXTERN PetscErrorCode  MatMatMultTransposeNumeric(Mat,Mat,Mat);

550: EXTERN PetscErrorCode  MatAXPY(Mat,PetscScalar,Mat,MatStructure);
551: EXTERN PetscErrorCode  MatAYPX(Mat,PetscScalar,Mat,MatStructure);
552: EXTERN PetscErrorCode  MatCompress(Mat);

554: EXTERN PetscErrorCode  MatScale(Mat,PetscScalar);
555: EXTERN PetscErrorCode  MatShift(Mat,PetscScalar);

557: EXTERN PetscErrorCode  MatSetLocalToGlobalMapping(Mat,ISLocalToGlobalMapping);
558: EXTERN PetscErrorCode  MatSetLocalToGlobalMappingBlock(Mat,ISLocalToGlobalMapping);
559: EXTERN PetscErrorCode  MatZeroRowsLocal(Mat,PetscInt,const PetscInt [],PetscScalar);
560: EXTERN PetscErrorCode  MatZeroRowsLocalIS(Mat,IS,PetscScalar);
561: EXTERN PetscErrorCode  MatSetValuesLocal(Mat,PetscInt,const PetscInt[],PetscInt,const PetscInt[],const PetscScalar[],InsertMode);
562: EXTERN PetscErrorCode  MatSetValuesBlockedLocal(Mat,PetscInt,const PetscInt[],PetscInt,const PetscInt[],const PetscScalar[],InsertMode);

564: EXTERN PetscErrorCode  MatStashSetInitialSize(Mat,PetscInt,PetscInt);
565: EXTERN PetscErrorCode  MatStashGetInfo(Mat,PetscInt*,PetscInt*,PetscInt*,PetscInt*);

567: EXTERN PetscErrorCode  MatInterpolate(Mat,Vec,Vec);
568: EXTERN PetscErrorCode  MatInterpolateAdd(Mat,Vec,Vec,Vec);
569: PetscPolymorphicSubroutine(MatInterpolateAdd,(Mat A,Vec x,Vec y),(A,x,y,y))
570: EXTERN PetscErrorCode  MatRestrict(Mat,Vec,Vec);
571: EXTERN PetscErrorCode  MatGetVecs(Mat,Vec*,Vec*);

573: /*MC
574:    MatPreallocateInitialize - Begins the block of code that will count the number of nonzeros per
575:        row in a matrix providing the data that one can use to correctly preallocate the matrix.

577:    Synopsis:
578:    PetscErrorCode MatPreallocateInitialize(MPI_Comm comm, PetscInt nrows, PetscInt ncols, PetscInt *dnz, PetscInt *onz)

580:    Collective on MPI_Comm

582:    Input Parameters:
583: +  comm - the communicator that will share the eventually allocated matrix
584: .  nrows - the number of LOCAL rows in the matrix
585: -  ncols - the number of LOCAL columns in the matrix

587:    Output Parameters:
588: +  dnz - the array that will be passed to the matrix preallocation routines
589: -  ozn - the other array passed to the matrix preallocation routines


592:    Level: intermediate

594:    Notes:
595:    See the chapter in the users manual on performance for more details

597:    Do not malloc or free dnz and onz, that is handled internally by these routines

599:    Use MatPreallocateInitializeSymmetric() for symmetric matrices (MPISBAIJ matrices)

601:   Concepts: preallocation^Matrix

603: .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateSetLocal(),
604:           MatPreallocateInitializeSymmetric(), MatPreallocateSymmetricSetLocal()
605: M*/
606: #define MatPreallocateInitialize(comm,nrows,ncols,dnz,onz) 0; \
607: { \
608:   PetscErrorCode _4_ierr; PetscInt __tmp = (nrows),__ctmp = (ncols),__rstart,__start,__end; \
609:   _4_PetscMalloc(2*__tmp*sizeof(PetscInt),&dnz);CHKERRQ(_4_ierr);onz = dnz + __tmp;\
610:   _4_PetscMemzero(dnz,2*__tmp*sizeof(PetscInt));CHKERRQ(_4_ierr);\
611:   _4_MPI_Scan(&__ctmp,&__end,1,MPIU_INT,MPI_SUM,comm);CHKERRQ(_4_ierr); __start = __end - __ctmp;\
612:   _4_MPI_Scan(&__tmp,&__rstart,1,MPIU_INT,MPI_SUM,comm);CHKERRQ(_4_ierr); __rstart = __rstart - __tmp;

614: /*MC
615:    MatPreallocateSymmetricInitialize - Begins the block of code that will count the number of nonzeros per
616:        row in a matrix providing the data that one can use to correctly preallocate the matrix.

618:    Synopsis:
619:    PetscErrorCode MatPreallocateSymmetricInitialize(MPI_Comm comm, PetscInt nrows, PetscInt ncols, PetscInt *dnz, PetscInt *onz)

621:    Collective on MPI_Comm

623:    Input Parameters:
624: +  comm - the communicator that will share the eventually allocated matrix
625: .  nrows - the number of LOCAL rows in the matrix
626: -  ncols - the number of LOCAL columns in the matrix

628:    Output Parameters:
629: +  dnz - the array that will be passed to the matrix preallocation routines
630: -  ozn - the other array passed to the matrix preallocation routines


633:    Level: intermediate

635:    Notes:
636:    See the chapter in the users manual on performance for more details

638:    Do not malloc or free dnz and onz, that is handled internally by these routines

640:   Concepts: preallocation^Matrix

642: .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateSetLocal(),
643:           MatPreallocateInitialize(), MatPreallocateSymmetricSetLocal()
644: M*/
645: #define MatPreallocateSymmetricInitialize(comm,nrows,ncols,dnz,onz) 0; \
646: { \
647:   PetscErrorCode _4_ierr; PetscInt __tmp = (nrows),__ctmp = (ncols),__rstart,__end; \
648:   _4_PetscMalloc(2*__tmp*sizeof(PetscInt),&dnz);CHKERRQ(_4_ierr);onz = dnz + __tmp;\
649:   _4_PetscMemzero(dnz,2*__tmp*sizeof(PetscInt));CHKERRQ(_4_ierr);\
650:   _4_MPI_Scan(&__ctmp,&__end,1,MPIU_INT,MPI_SUM,comm);CHKERRQ(_4_ierr);\
651:   _4_MPI_Scan(&__tmp,&__rstart,1,MPIU_INT,MPI_SUM,comm);CHKERRQ(_4_ierr); __rstart = __rstart - __tmp;

653: /*MC
654:    MatPreallocateSetLocal - Indicates the locations (rows and columns) in the matrix where nonzeros will be
655:        inserted using a local number of the rows and columns

657:    Synopsis:
658:    PetscErrorCode MatPreallocateSetLocal(ISLocalToGlobalMappping map,PetscInt nrows, PetscInt *rows,PetscInt ncols, PetscInt *cols,PetscInt *dnz, PetscInt *onz)

660:    Not Collective

662:    Input Parameters:
663: +  map - the mapping between local numbering and global numbering
664: .  nrows - the number of rows indicated
665: .  rows - the indices of the rows 
666: .  ncols - the number of columns in the matrix
667: .  cols - the columns indicated
668: .  dnz - the array that will be passed to the matrix preallocation routines
669: -  ozn - the other array passed to the matrix preallocation routines


672:    Level: intermediate

674:    Notes:
675:    See the chapter in the users manual on performance for more details

677:    Do not malloc or free dnz and onz, that is handled internally by these routines

679:   Concepts: preallocation^Matrix

681: .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateInitialize(),
682:           MatPreallocateInitialize(), MatPreallocateSymmetricSetLocal()
683: M*/
684: #define MatPreallocateSetLocal(map,nrows,rows,ncols,cols,dnz,onz) 0;\
685: {\
686:   PetscInt __l;\
687:   _4_ISLocalToGlobalMappingApply(map,nrows,rows,rows);CHKERRQ(_4_ierr);\
688:   _4_ISLocalToGlobalMappingApply(map,ncols,cols,cols);CHKERRQ(_4_ierr);\
689:   for (__l=0;__l<nrows;__l++) {\
690:     _4_MatPreallocateSet((rows)[__l],ncols,cols,dnz,onz);CHKERRQ(_4_ierr);\
691:   }\
692: }
693: 
694: /*MC
695:    MatPreallocateSymmetricSetLocal - Indicates the locations (rows and columns) in the matrix where nonzeros will be
696:        inserted using a local number of the rows and columns

698:    Synopsis:
699:    PetscErrorCode MatPreallocateSymmetricSetLocal(ISLocalToGlobalMappping map,PetscInt nrows, PetscInt *rows,PetscInt ncols, PetscInt *cols,PetscInt *dnz, PetscInt *onz)

701:    Not Collective

703:    Input Parameters:
704: +  map - the mapping between local numbering and global numbering
705: .  nrows - the number of rows indicated
706: .  rows - the indices of the rows 
707: .  ncols - the number of columns in the matrix
708: .  cols - the columns indicated
709: .  dnz - the array that will be passed to the matrix preallocation routines
710: -  ozn - the other array passed to the matrix preallocation routines


713:    Level: intermediate

715:    Notes:
716:    See the chapter in the users manual on performance for more details

718:    Do not malloc or free dnz and onz that is handled internally by these routines

720:   Concepts: preallocation^Matrix

722: .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateInitialize(),
723:           MatPreallocateInitialize(), MatPreallocateSymmetricSetLocal(), MatPreallocateSetLocal()
724: M*/
725: #define MatPreallocateSymmetricSetLocal(map,nrows,rows,ncols,cols,dnz,onz) 0;\
726: {\
727:   PetscInt __l;\
728:   _4_ISLocalToGlobalMappingApply(map,nrows,rows,rows);CHKERRQ(_4_ierr);\
729:   _4_ISLocalToGlobalMappingApply(map,ncols,cols,cols);CHKERRQ(_4_ierr);\
730:   for (__l=0;__l<nrows;__l++) {\
731:     _4_MatPreallocateSymmetricSet((rows)[__l],ncols,cols,dnz,onz);CHKERRQ(_4_ierr);\
732:   }\
733: }

735: /*MC
736:    MatPreallocateSet - Indicates the locations (rows and columns) in the matrix where nonzeros will be
737:        inserted using a local number of the rows and columns

739:    Synopsis:
740:    PetscErrorCode MatPreallocateSet(PetscInt nrows, PetscInt *rows,PetscInt ncols, PetscInt *cols,PetscInt *dnz, PetscInt *onz)

742:    Not Collective

744:    Input Parameters:
745: +  nrows - the number of rows indicated
746: .  rows - the indices of the rows 
747: .  ncols - the number of columns in the matrix
748: -  cols - the columns indicated

750:    Output Parameters:
751: +  dnz - the array that will be passed to the matrix preallocation routines
752: -  ozn - the other array passed to the matrix preallocation routines


755:    Level: intermediate

757:    Notes:
758:    See the chapter in the users manual on performance for more details

760:    Do not malloc or free dnz and onz that is handled internally by these routines

762:   Concepts: preallocation^Matrix

764: .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateInitialize(),
765:           MatPreallocateInitialize(), MatPreallocateSymmetricSetLocal(), MatPreallocateSetLocal()
766: M*/
767: #define MatPreallocateSet(row,nc,cols,dnz,onz) 0;\
768: { PetscInt __i; \
769:   for (__i=0; __i<nc; __i++) {\
770:     if (cols[__i] < __start || cols[__i] >= __end) onz[row - __rstart]++; \
771:   }\
772:   dnz[row - __rstart] = nc - onz[row - __rstart];\
773: }

775: /*MC
776:    MatPreallocateSymmetricSet - Indicates the locations (rows and columns) in the matrix where nonzeros will be
777:        inserted using a local number of the rows and columns

779:    Synopsis:
780:    PetscErrorCode MatPreallocateSymmetricSet(PetscInt nrows, PetscInt *rows,PetscInt ncols, PetscInt *cols,PetscInt *dnz, PetscInt *onz)

782:    Not Collective

784:    Input Parameters:
785: +  nrows - the number of rows indicated
786: .  rows - the indices of the rows 
787: .  ncols - the number of columns in the matrix
788: .  cols - the columns indicated
789: .  dnz - the array that will be passed to the matrix preallocation routines
790: -  ozn - the other array passed to the matrix preallocation routines


793:    Level: intermediate

795:    Notes:
796:    See the chapter in the users manual on performance for more details

798:    Do not malloc or free dnz and onz that is handled internally by these routines

800:   Concepts: preallocation^Matrix

802: .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateInitialize(),
803:           MatPreallocateInitialize(), MatPreallocateSymmetricSetLocal(), MatPreallocateSetLocal()
804: M*/
805: #define MatPreallocateSymmetricSet(row,nc,cols,dnz,onz) 0;\
806: { PetscInt __i; \
807:   for (__i=0; __i<nc; __i++) {\
808:     if (cols[__i] >= __end) onz[row - __rstart]++; \
809:     else if (cols[__i] >= row) dnz[row - __rstart]++;\
810:   }\
811: }

813: /*MC
814:    MatPreallocateFinalize - Ends the block of code that will count the number of nonzeros per
815:        row in a matrix providing the data that one can use to correctly preallocate the matrix.

817:    Synopsis:
818:    PetscErrorCode MatPreallocateFinalize(PetscInt *dnz, PetscInt *onz)

820:    Collective on MPI_Comm

822:    Input Parameters:
823: +  dnz - the array that will be passed to the matrix preallocation routines
824: -  ozn - the other array passed to the matrix preallocation routines


827:    Level: intermediate

829:    Notes:
830:    See the chapter in the users manual on performance for more details

832:    Do not malloc or free dnz and onz that is handled internally by these routines

834:   Concepts: preallocation^Matrix

836: .seealso: MatPreallocateInitialize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateSetLocal(),
837:           MatPreallocateSymmetricInitialize(), MatPreallocateSymmetricSetLocal()
838: M*/
839: #define MatPreallocateFinalize(dnz,onz) 0;_4_PetscFree(dnz);CHKERRQ(_4_ierr);}



843: /* Routines unique to particular data structures */
844: EXTERN PetscErrorCode  MatShellGetContext(Mat,void **);
845: PetscPolymorphicFunction(MatShellGetContext,(Mat A),(A,&t),void*,t)
846: EXTERN PetscErrorCode  MatBDiagGetData(Mat,PetscInt*,PetscInt*,PetscInt*[],PetscInt*[],PetscScalar***);

848: EXTERN PetscErrorCode  MatInodeAdjustForInodes(Mat,IS*,IS*);
849: EXTERN PetscErrorCode  MatInodeGetInodeSizes(Mat,PetscInt *,PetscInt *[],PetscInt *);

851: EXTERN PetscErrorCode  MatSeqAIJSetColumnIndices(Mat,PetscInt[]);
852: EXTERN PetscErrorCode  MatSeqBAIJSetColumnIndices(Mat,PetscInt[]);
853: EXTERN PetscErrorCode  MatCreateSeqAIJWithArrays(MPI_Comm,PetscInt,PetscInt,PetscInt[],PetscInt[],PetscScalar[],Mat*);
854: EXTERN PetscErrorCode  MatCreateSeqBAIJWithArrays(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt[],PetscInt[],PetscScalar[],Mat*);
855: EXTERN PetscErrorCode  MatCreateSeqSBAIJWithArrays(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt[],PetscInt[],PetscScalar[],Mat*);

857: #define MAT_SKIP_ALLOCATION -4

859: EXTERN PetscErrorCode  MatSeqBAIJSetPreallocation(Mat,PetscInt,PetscInt,const PetscInt[]);
860: PetscPolymorphicSubroutine(MatSeqBAIJSetPreallocation,(Mat A,PetscInt bs,const PetscInt nnz[]),(A,bs,0,nnz))
861: EXTERN PetscErrorCode  MatSeqSBAIJSetPreallocation(Mat,PetscInt,PetscInt,const PetscInt[]);
862: PetscPolymorphicSubroutine(MatSeqSBAIJSetPreallocation,(Mat A,PetscInt bs,const PetscInt nnz[]),(A,bs,0,nnz))
863: EXTERN PetscErrorCode  MatSeqAIJSetPreallocation(Mat,PetscInt,const PetscInt[]);
864: PetscPolymorphicSubroutine(MatSeqAIJSetPreallocation,(Mat A,const PetscInt nnz[]),(A,0,nnz))
865: EXTERN PetscErrorCode  MatSeqDensePreallocation(Mat,PetscScalar[]);
866: EXTERN PetscErrorCode  MatSeqBDiagSetPreallocation(Mat,PetscInt,PetscInt,const PetscInt[],PetscScalar*[]);

868: EXTERN PetscErrorCode  MatMPIBAIJSetPreallocation(Mat,PetscInt,PetscInt,const PetscInt[],PetscInt,const PetscInt[]);
869: PetscPolymorphicSubroutine(MatMPIBAIJSetPreallocation,(Mat A,PetscInt bs,const PetscInt nnz[],const PetscInt onz[]),(A,bs,0,nnz,0,onz))
870: EXTERN PetscErrorCode  MatMPISBAIJSetPreallocation(Mat,PetscInt,PetscInt,const PetscInt[],PetscInt,const PetscInt[]);
871: EXTERN PetscErrorCode  MatMPIAIJSetPreallocation(Mat,PetscInt,const PetscInt[],PetscInt,const PetscInt[]);
872: EXTERN PetscErrorCode  MatSeqAIJSetPreallocationCSR(Mat,const PetscInt [],const PetscInt [],const PetscScalar []);
873: EXTERN PetscErrorCode  MatMPIAIJSetPreallocationCSR(Mat,const PetscInt[],const PetscInt[],const PetscScalar[]);
874: EXTERN PetscErrorCode  MatMPIBAIJSetPreallocationCSR(Mat,PetscInt,const PetscInt[],const PetscInt[],const PetscScalar[]);
875: EXTERN PetscErrorCode  MatMPIDensePreallocation(Mat,PetscScalar[]);
876: EXTERN PetscErrorCode  MatMPIBDiagSetPreallocation(Mat,PetscInt,PetscInt,const PetscInt[],PetscScalar*[]);
877: EXTERN PetscErrorCode  MatMPIAdjSetPreallocation(Mat,PetscInt[],PetscInt[],PetscInt[]);
878: EXTERN PetscErrorCode  MatMPIDenseSetPreallocation(Mat,PetscScalar[]);
879: EXTERN PetscErrorCode  MatSeqDenseSetPreallocation(Mat,PetscScalar[]);
880: EXTERN PetscErrorCode  MatMPIRowbsSetPreallocation(Mat,PetscInt,const PetscInt[]);
881: EXTERN PetscErrorCode  MatMPIAIJGetSeqAIJ(Mat,Mat*,Mat*,PetscInt*[]);
882: EXTERN PetscErrorCode  MatMPIBAIJGetSeqBAIJ(Mat,Mat*,Mat*,PetscInt*[]);
883: EXTERN PetscErrorCode  MatAdicSetLocalFunction(Mat,void (*)(void));

885: EXTERN PetscErrorCode  MatSeqDenseSetLDA(Mat,PetscInt);
886: EXTERN PetscErrorCode  MatDenseGetLocalMatrix(Mat,Mat*);

888: EXTERN PetscErrorCode  MatStoreValues(Mat);
889: EXTERN PetscErrorCode  MatRetrieveValues(Mat);

891: EXTERN PetscErrorCode  MatDAADSetCtx(Mat,void*);

893: /* 
894:   These routines are not usually accessed directly, rather solving is 
895:   done through the KSP and PC interfaces.
896: */

898: /*E
899:     MatOrderingType - String with the name of a PETSc matrix ordering or the creation function
900:        with an optional dynamic library name, for example 
901:        http://www.mcs.anl.gov/petsc/lib.a:orderingcreate()

903:    Level: beginner

905: .seealso: MatGetOrdering()
906: E*/
907: #define MatOrderingType char*
908: #define MATORDERING_NATURAL   "natural"
909: #define MATORDERING_ND        "nd"
910: #define MATORDERING_1WD       "1wd"
911: #define MATORDERING_RCM       "rcm"
912: #define MATORDERING_QMD       "qmd"
913: #define MATORDERING_ROWLENGTH "rowlength"
914: #define MATORDERING_DSC_ND    "dsc_nd"
915: #define MATORDERING_DSC_MMD   "dsc_mmd"
916: #define MATORDERING_DSC_MDF   "dsc_mdf"
917: #define MATORDERING_CONSTRAINED "constrained"
918: #define MATORDERING_IDENTITY  "identity"
919: #define MATORDERING_REVERSE   "reverse"

921: EXTERN PetscErrorCode  MatGetOrdering(Mat,const MatOrderingType,IS*,IS*);
922: EXTERN PetscErrorCode  MatGetOrderingList(PetscFList *list);
923: EXTERN PetscErrorCode  MatOrderingRegister(const char[],const char[],const char[],PetscErrorCode(*)(Mat,const MatOrderingType,IS*,IS*));

925: /*MC
926:    MatOrderingRegisterDynamic - Adds a new sparse matrix ordering to the 
927:                                matrix package. 

929:    Synopsis:
930:    PetscErrorCode MatOrderingRegisterDynamic(char *name_ordering,char *path,char *name_create,PetscErrorCode (*routine_create)(MatOrdering))

932:    Not Collective

934:    Input Parameters:
935: +  sname - name of ordering (for example MATORDERING_ND)
936: .  path - location of library where creation routine is 
937: .  name - name of function that creates the ordering type,a string
938: -  function - function pointer that creates the ordering

940:    Level: developer

942:    If dynamic libraries are used, then the fourth input argument (function)
943:    is ignored.

945:    Sample usage:
946: .vb
947:    MatOrderingRegisterDynamic("my_order",/home/username/my_lib/lib/libO/solaris/mylib.a,
948:                "MyOrder",MyOrder);
949: .ve

951:    Then, your partitioner can be chosen with the procedural interface via
952: $     MatOrderingSetType(part,"my_order)
953:    or at runtime via the option
954: $     -pc_factor_mat_ordering_type my_order

956:    ${PETSC_ARCH} occuring in pathname will be replaced with appropriate values.

958: .keywords: matrix, ordering, register

960: .seealso: MatOrderingRegisterDestroy(), MatOrderingRegisterAll()
961: M*/
962: #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
963: #define MatOrderingRegisterDynamic(a,b,c,d) MatOrderingRegister(a,b,c,0)
964: #else
965: #define MatOrderingRegisterDynamic(a,b,c,d) MatOrderingRegister(a,b,c,d)
966: #endif

968: EXTERN PetscErrorCode  MatOrderingRegisterDestroy(void);
969: EXTERN PetscErrorCode  MatOrderingRegisterAll(const char[]);

973: EXTERN PetscErrorCode  MatReorderForNonzeroDiagonal(Mat,PetscReal,IS,IS);

975: /*S 
976:    MatFactorInfo - Data passed into the matrix factorization routines

978:    In Fortran these are simply double precision arrays of size MAT_FACTORINFO_SIZE

980:    Notes: These are not usually directly used by users, instead use PC type of LU, ILU, CHOLESKY or ICC.

982:    Level: developer

984: .seealso: MatLUFactorSymbolic(), MatILUFactorSymbolic(), MatCholeskyFactorSymbolic(), MatICCFactorSymbolic(), MatICCFactor(), 
985:           MatFactorInfoInitialize()

987: S*/
988: typedef struct {
989:   PetscReal     shiftnz;        /* scaling of identity added to matrix to prevent zero pivots */
990:   PetscReal     shiftpd;        /* if true, shift until positive pivots */
991:   PetscReal     shift_fraction; /* record shift fraction taken */
992:   PetscReal     diagonal_fill;  /* force diagonal to fill in if initially not filled */
993:   PetscReal     dt;             /* drop tolerance */
994:   PetscReal     dtcol;          /* tolerance for pivoting */
995:   PetscReal     dtcount;        /* maximum nonzeros to be allowed per row */
996:   PetscReal     fill;           /* expected fill; nonzeros in factored matrix/nonzeros in original matrix*/
997:   PetscReal     levels;         /* ICC/ILU(levels) */
998:   PetscReal     pivotinblocks;  /* for BAIJ and SBAIJ matrices pivot in factorization on blocks, default 1.0 
999:                                    factorization may be faster if do not pivot */
1000:   PetscReal     zeropivot;      /* pivot is called zero if less than this */
1001: } MatFactorInfo;

1003: EXTERN PetscErrorCode  MatFactorInfoInitialize(MatFactorInfo*);
1004: EXTERN PetscErrorCode  MatCholeskyFactor(Mat,IS,MatFactorInfo*);
1005: EXTERN PetscErrorCode  MatCholeskyFactorSymbolic(Mat,IS,MatFactorInfo*,Mat*);
1006: EXTERN PetscErrorCode  MatCholeskyFactorNumeric(Mat,MatFactorInfo*,Mat*);
1007: EXTERN PetscErrorCode  MatLUFactor(Mat,IS,IS,MatFactorInfo*);
1008: EXTERN PetscErrorCode  MatILUFactor(Mat,IS,IS,MatFactorInfo*);
1009: EXTERN PetscErrorCode  MatLUFactorSymbolic(Mat,IS,IS,MatFactorInfo*,Mat*);
1010: EXTERN PetscErrorCode  MatILUFactorSymbolic(Mat,IS,IS,MatFactorInfo*,Mat*);
1011: EXTERN PetscErrorCode  MatICCFactorSymbolic(Mat,IS,MatFactorInfo*,Mat*);
1012: EXTERN PetscErrorCode  MatICCFactor(Mat,IS,MatFactorInfo*);
1013: EXTERN PetscErrorCode  MatLUFactorNumeric(Mat,MatFactorInfo*,Mat*);
1014: EXTERN PetscErrorCode  MatILUDTFactor(Mat,IS,IS,MatFactorInfo*,Mat *);
1015: EXTERN PetscErrorCode  MatGetInertia(Mat,PetscInt*,PetscInt*,PetscInt*);
1016: EXTERN PetscErrorCode  MatSolve(Mat,Vec,Vec);
1017: EXTERN PetscErrorCode  MatForwardSolve(Mat,Vec,Vec);
1018: EXTERN PetscErrorCode  MatBackwardSolve(Mat,Vec,Vec);
1019: EXTERN PetscErrorCode  MatSolveAdd(Mat,Vec,Vec,Vec);
1020: EXTERN PetscErrorCode  MatSolveTranspose(Mat,Vec,Vec);
1021: EXTERN PetscErrorCode  MatSolveTransposeAdd(Mat,Vec,Vec,Vec);
1022: EXTERN PetscErrorCode  MatSolves(Mat,Vecs,Vecs);

1024: EXTERN PetscErrorCode  MatSetUnfactored(Mat);

1026: /*E
1027:     MatSORType - What type of (S)SOR to perform

1029:     Level: beginner

1031:    May be bitwise ORd together

1033:    Any additions/changes here MUST also be made in include/finclude/petscmat.h

1035:    MatSORType may be bitwise ORd together, so do not change the numbers 

1037: .seealso: MatRelax(), MatPBRelax()
1038: E*/
1039: typedef enum {SOR_FORWARD_SWEEP=1,SOR_BACKWARD_SWEEP=2,SOR_SYMMETRIC_SWEEP=3,
1040:               SOR_LOCAL_FORWARD_SWEEP=4,SOR_LOCAL_BACKWARD_SWEEP=8,
1041:               SOR_LOCAL_SYMMETRIC_SWEEP=12,SOR_ZERO_INITIAL_GUESS=16,
1042:               SOR_EISENSTAT=32,SOR_APPLY_UPPER=64,SOR_APPLY_LOWER=128} MatSORType;
1043: EXTERN PetscErrorCode  MatRelax(Mat,Vec,PetscReal,MatSORType,PetscReal,PetscInt,PetscInt,Vec);
1044: EXTERN PetscErrorCode  MatPBRelax(Mat,Vec,PetscReal,MatSORType,PetscReal,PetscInt,PetscInt,Vec);

1046: /* 
1047:     These routines are for efficiently computing Jacobians via finite differences.
1048: */

1050: /*E
1051:     MatColoringType - String with the name of a PETSc matrix coloring or the creation function
1052:        with an optional dynamic library name, for example 
1053:        http://www.mcs.anl.gov/petsc/lib.a:coloringcreate()

1055:    Level: beginner

1057: .seealso: MatGetColoring()
1058: E*/
1059: #define MatColoringType char*
1060: #define MATCOLORING_NATURAL "natural"
1061: #define MATCOLORING_SL      "sl"
1062: #define MATCOLORING_LF      "lf"
1063: #define MATCOLORING_ID      "id"

1065: EXTERN PetscErrorCode  MatGetColoring(Mat,const MatColoringType,ISColoring*);
1066: EXTERN PetscErrorCode  MatColoringRegister(const char[],const char[],const char[],PetscErrorCode(*)(Mat,const MatColoringType,ISColoring *));

1068: /*MC
1069:    MatColoringRegisterDynamic - Adds a new sparse matrix coloring to the 
1070:                                matrix package. 

1072:    Synopsis:
1073:    PetscErrorCode MatColoringRegisterDynamic(char *name_coloring,char *path,char *name_create,PetscErrorCode (*routine_create)(MatColoring))

1075:    Not Collective

1077:    Input Parameters:
1078: +  sname - name of Coloring (for example MATCOLORING_SL)
1079: .  path - location of library where creation routine is 
1080: .  name - name of function that creates the Coloring type, a string
1081: -  function - function pointer that creates the coloring

1083:    Level: developer

1085:    If dynamic libraries are used, then the fourth input argument (function)
1086:    is ignored.

1088:    Sample usage:
1089: .vb
1090:    MatColoringRegisterDynamic("my_color",/home/username/my_lib/lib/libO/solaris/mylib.a,
1091:                "MyColor",MyColor);
1092: .ve

1094:    Then, your partitioner can be chosen with the procedural interface via
1095: $     MatColoringSetType(part,"my_color")
1096:    or at runtime via the option
1097: $     -mat_coloring_type my_color

1099:    $PETSC_ARCH occuring in pathname will be replaced with appropriate values.

1101: .keywords: matrix, Coloring, register

1103: .seealso: MatColoringRegisterDestroy(), MatColoringRegisterAll()
1104: M*/
1105: #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
1106: #define MatColoringRegisterDynamic(a,b,c,d) MatColoringRegister(a,b,c,0)
1107: #else
1108: #define MatColoringRegisterDynamic(a,b,c,d) MatColoringRegister(a,b,c,d)
1109: #endif


1113: EXTERN PetscErrorCode  MatColoringRegisterAll(const char[]);
1114: EXTERN PetscErrorCode  MatColoringRegisterDestroy(void);
1115: EXTERN PetscErrorCode  MatColoringPatch(Mat,PetscInt,PetscInt,ISColoringValue[],ISColoring*);

1117: /*S
1118:      MatFDColoring - Object for computing a sparse Jacobian via finite differences
1119:         and coloring

1121:    Level: beginner

1123:   Concepts: coloring, sparse Jacobian, finite differences

1125: .seealso:  MatFDColoringCreate()
1126: S*/
1127: typedef struct _p_MatFDColoring* MatFDColoring;

1129: EXTERN PetscErrorCode  MatFDColoringCreate(Mat,ISColoring,MatFDColoring *);
1130: EXTERN PetscErrorCode  MatFDColoringDestroy(MatFDColoring);
1131: EXTERN PetscErrorCode  MatFDColoringView(MatFDColoring,PetscViewer);
1132: EXTERN PetscErrorCode  MatFDColoringSetFunction(MatFDColoring,PetscErrorCode (*)(void),void*);
1133: EXTERN PetscErrorCode  MatFDColoringGetFunction(MatFDColoring,PetscErrorCode (**)(void),void**);
1134: EXTERN PetscErrorCode  MatFDColoringSetParameters(MatFDColoring,PetscReal,PetscReal);
1135: EXTERN PetscErrorCode  MatFDColoringSetFrequency(MatFDColoring,PetscInt);
1136: EXTERN PetscErrorCode  MatFDColoringGetFrequency(MatFDColoring,PetscInt*);
1137: EXTERN PetscErrorCode  MatFDColoringSetFromOptions(MatFDColoring);
1138: EXTERN PetscErrorCode  MatFDColoringApply(Mat,MatFDColoring,Vec,MatStructure*,void *);
1139: EXTERN PetscErrorCode  MatFDColoringApplyTS(Mat,MatFDColoring,PetscReal,Vec,MatStructure*,void *);
1140: EXTERN PetscErrorCode  MatFDColoringSetRecompute(MatFDColoring);
1141: EXTERN PetscErrorCode  MatFDColoringSetF(MatFDColoring,Vec);
1142: EXTERN PetscErrorCode  MatFDColoringGetPerturbedColumns(MatFDColoring,PetscInt*,PetscInt*[]);
1143: /* 
1144:     These routines are for partitioning matrices: currently used only 
1145:   for adjacency matrix, MatCreateMPIAdj().
1146: */

1148: /*S
1149:      MatPartitioning - Object for managing the partitioning of a matrix or graph

1151:    Level: beginner

1153:   Concepts: partitioning

1155: .seealso:  MatPartitioningCreate(), MatPartitioningType
1156: S*/
1157: typedef struct _p_MatPartitioning* MatPartitioning;

1159: /*E
1160:     MatPartitioningType - String with the name of a PETSc matrix partitioning or the creation function
1161:        with an optional dynamic library name, for example 
1162:        http://www.mcs.anl.gov/petsc/lib.a:partitioningcreate()

1164:    Level: beginner

1166: .seealso: MatPartitioningCreate(), MatPartitioning
1167: E*/
1168: #define MatPartitioningType char*
1169: #define MAT_PARTITIONING_CURRENT  "current"
1170: #define MAT_PARTITIONING_SQUARE   "square"
1171: #define MAT_PARTITIONING_PARMETIS "parmetis"
1172: #define MAT_PARTITIONING_CHACO    "chaco"
1173: #define MAT_PARTITIONING_JOSTLE   "jostle"
1174: #define MAT_PARTITIONING_PARTY    "party"
1175: #define MAT_PARTITIONING_SCOTCH   "scotch"


1178: EXTERN PetscErrorCode  MatPartitioningCreate(MPI_Comm,MatPartitioning*);
1179: EXTERN PetscErrorCode  MatPartitioningSetType(MatPartitioning,const MatPartitioningType);
1180: EXTERN PetscErrorCode  MatPartitioningSetNParts(MatPartitioning,PetscInt);
1181: EXTERN PetscErrorCode  MatPartitioningSetAdjacency(MatPartitioning,Mat);
1182: EXTERN PetscErrorCode  MatPartitioningSetVertexWeights(MatPartitioning,const PetscInt[]);
1183: EXTERN PetscErrorCode  MatPartitioningSetPartitionWeights(MatPartitioning,const PetscReal []);
1184: EXTERN PetscErrorCode  MatPartitioningApply(MatPartitioning,IS*);
1185: EXTERN PetscErrorCode  MatPartitioningDestroy(MatPartitioning);

1187: EXTERN PetscErrorCode  MatPartitioningRegister(const char[],const char[],const char[],PetscErrorCode (*)(MatPartitioning));

1189: /*MC
1190:    MatPartitioningRegisterDynamic - Adds a new sparse matrix partitioning to the 
1191:    matrix package. 

1193:    Synopsis:
1194:    PetscErrorCode MatPartitioningRegisterDynamic(char *name_partitioning,char *path,char *name_create,PetscErrorCode (*routine_create)(MatPartitioning))

1196:    Not Collective

1198:    Input Parameters:
1199: +  sname - name of partitioning (for example MAT_PARTITIONING_CURRENT) or parmetis
1200: .  path - location of library where creation routine is 
1201: .  name - name of function that creates the partitioning type, a string
1202: -  function - function pointer that creates the partitioning type

1204:    Level: developer

1206:    If dynamic libraries are used, then the fourth input argument (function)
1207:    is ignored.

1209:    Sample usage:
1210: .vb
1211:    MatPartitioningRegisterDynamic("my_part",/home/username/my_lib/lib/libO/solaris/mylib.a,
1212:                "MyPartCreate",MyPartCreate);
1213: .ve

1215:    Then, your partitioner can be chosen with the procedural interface via
1216: $     MatPartitioningSetType(part,"my_part")
1217:    or at runtime via the option
1218: $     -mat_partitioning_type my_part

1220:    $PETSC_ARCH occuring in pathname will be replaced with appropriate values.

1222: .keywords: matrix, partitioning, register

1224: .seealso: MatPartitioningRegisterDestroy(), MatPartitioningRegisterAll()
1225: M*/
1226: #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
1227: #define MatPartitioningRegisterDynamic(a,b,c,d) MatPartitioningRegister(a,b,c,0)
1228: #else
1229: #define MatPartitioningRegisterDynamic(a,b,c,d) MatPartitioningRegister(a,b,c,d)
1230: #endif


1234: EXTERN PetscErrorCode  MatPartitioningRegisterAll(const char[]);
1235: EXTERN PetscErrorCode  MatPartitioningRegisterDestroy(void);

1237: EXTERN PetscErrorCode  MatPartitioningView(MatPartitioning,PetscViewer);
1238: EXTERN PetscErrorCode  MatPartitioningSetFromOptions(MatPartitioning);
1239: EXTERN PetscErrorCode  MatPartitioningGetType(MatPartitioning,MatPartitioningType*);

1241: EXTERN PetscErrorCode  MatPartitioningParmetisSetCoarseSequential(MatPartitioning);

1243: EXTERN PetscErrorCode  MatPartitioningJostleSetCoarseLevel(MatPartitioning,PetscReal);
1244: EXTERN PetscErrorCode  MatPartitioningJostleSetCoarseSequential(MatPartitioning);

1246: typedef enum {MP_CHACO_MULTILEVEL_KL,MP_CHACO_SPECTRAL,MP_CHACO_LINEAR,MP_CHACO_RANDOM, MP_CHACO_SCATTERED} MPChacoGlobalType;
1247: EXTERN PetscErrorCode  MatPartitioningChacoSetGlobal(MatPartitioning, MPChacoGlobalType);
1248: typedef enum { MP_CHACO_KERNIGHAN_LIN, MP_CHACO_NONE } MPChacoLocalType;
1249: EXTERN PetscErrorCode  MatPartitioningChacoSetLocal(MatPartitioning, MPChacoLocalType);
1250: EXTERN PetscErrorCode  MatPartitioningChacoSetCoarseLevel(MatPartitioning,PetscReal);
1251: typedef enum { MP_CHACO_LANCZOS, MP_CHACO_RQI_SYMMLQ } MPChacoEigenType;
1252: EXTERN PetscErrorCode  MatPartitioningChacoSetEigenSolver(MatPartitioning,MPChacoEigenType);
1253: EXTERN PetscErrorCode  MatPartitioningChacoSetEigenTol(MatPartitioning, PetscReal);
1254: EXTERN PetscErrorCode  MatPartitioningChacoSetEigenNumber(MatPartitioning, PetscInt);

1256: #define MP_PARTY_OPT "opt"
1257: #define MP_PARTY_LIN "lin"
1258: #define MP_PARTY_SCA "sca"
1259: #define MP_PARTY_RAN "ran"
1260: #define MP_PARTY_GBF "gbf"
1261: #define MP_PARTY_GCF "gcf"
1262: #define MP_PARTY_BUB "bub"
1263: #define MP_PARTY_DEF "def"
1264: EXTERN PetscErrorCode  MatPartitioningPartySetGlobal(MatPartitioning, const char*);
1265: #define MP_PARTY_HELPFUL_SETS "hs"
1266: #define MP_PARTY_KERNIGHAN_LIN "kl"
1267: #define MP_PARTY_NONE "no"
1268: EXTERN PetscErrorCode  MatPartitioningPartySetLocal(MatPartitioning, const char*);
1269: EXTERN PetscErrorCode  MatPartitioningPartySetCoarseLevel(MatPartitioning,PetscReal);
1270: EXTERN PetscErrorCode  MatPartitioningPartySetBipart(MatPartitioning,PetscTruth);
1271: EXTERN PetscErrorCode  MatPartitioningPartySetMatchOptimization(MatPartitioning,PetscTruth);

1273: typedef enum { MP_SCOTCH_GREEDY, MP_SCOTCH_GPS, MP_SCOTCH_GR_GPS } MPScotchGlobalType;
1274: EXTERN PetscErrorCode  MatPartitioningScotchSetArch(MatPartitioning,const char*);
1275: EXTERN PetscErrorCode  MatPartitioningScotchSetMultilevel(MatPartitioning);
1276: EXTERN PetscErrorCode  MatPartitioningScotchSetGlobal(MatPartitioning,MPScotchGlobalType);
1277: EXTERN PetscErrorCode  MatPartitioningScotchSetCoarseLevel(MatPartitioning,PetscReal);
1278: EXTERN PetscErrorCode  MatPartitioningScotchSetHostList(MatPartitioning,const char*);
1279: typedef enum { MP_SCOTCH_KERNIGHAN_LIN, MP_SCOTCH_NONE } MPScotchLocalType;
1280: EXTERN PetscErrorCode  MatPartitioningScotchSetLocal(MatPartitioning,MPScotchLocalType);
1281: EXTERN PetscErrorCode  MatPartitioningScotchSetMapping(MatPartitioning);
1282: EXTERN PetscErrorCode  MatPartitioningScotchSetStrategy(MatPartitioning,char*);

1284: /*
1285:     If you add entries here you must also add them to finclude/petscmat.h
1286: */
1287: typedef enum { MATOP_SET_VALUES=0,
1288:                MATOP_GET_ROW=1,
1289:                MATOP_RESTORE_ROW=2,
1290:                MATOP_MULT=3,
1291:                MATOP_MULT_ADD=4,
1292:                MATOP_MULT_TRANSPOSE=5,
1293:                MATOP_MULT_TRANSPOSE_ADD=6,
1294:                MATOP_SOLVE=7,
1295:                MATOP_SOLVE_ADD=8,
1296:                MATOP_SOLVE_TRANSPOSE=9,
1297:                MATOP_SOLVE_TRANSPOSE_ADD=10,
1298:                MATOP_LUFACTOR=11,
1299:                MATOP_CHOLESKYFACTOR=12,
1300:                MATOP_RELAX=13,
1301:                MATOP_TRANSPOSE=14,
1302:                MATOP_GETINFO=15,
1303:                MATOP_EQUAL=16,
1304:                MATOP_GET_DIAGONAL=17,
1305:                MATOP_DIAGONAL_SCALE=18,
1306:                MATOP_NORM=19,
1307:                MATOP_ASSEMBLY_BEGIN=20,
1308:                MATOP_ASSEMBLY_END=21,
1309:                MATOP_COMPRESS=22,
1310:                MATOP_SET_OPTION=23,
1311:                MATOP_ZERO_ENTRIES=24,
1312:                MATOP_ZERO_ROWS=25,
1313:                MATOP_LUFACTOR_SYMBOLIC=26,
1314:                MATOP_LUFACTOR_NUMERIC=27,
1315:                MATOP_CHOLESKY_FACTOR_SYMBOLIC=28,
1316:                MATOP_CHOLESKY_FACTOR_NUMERIC=29,
1317:                MATOP_SETUP_PREALLOCATION=30,
1318:                MATOP_ILUFACTOR_SYMBOLIC=31,
1319:                MATOP_ICCFACTOR_SYMBOLIC=32,
1320:                MATOP_GET_ARRAY=33,
1321:                MATOP_RESTORE_ARRAY=34,
1322:                MATOP_DUPLICATE=35,
1323:                MATOP_FORWARD_SOLVE=36,
1324:                MATOP_BACKWARD_SOLVE=37,
1325:                MATOP_ILUFACTOR=38,
1326:                MATOP_ICCFACTOR=39,
1327:                MATOP_AXPY=40,
1328:                MATOP_GET_SUBMATRICES=41,
1329:                MATOP_INCREASE_OVERLAP=42,
1330:                MATOP_GET_VALUES=43,
1331:                MATOP_COPY=44,
1332:                MATOP_PRINT_HELP=45,
1333:                MATOP_SCALE=46,
1334:                MATOP_SHIFT=47,
1335:                MATOP_DIAGONAL_SHIFT=48,
1336:                MATOP_ILUDT_FACTOR=49,
1337:                MATOP_GET_BLOCK_SIZE=50,
1338:                MATOP_GET_ROW_IJ=51,
1339:                MATOP_RESTORE_ROW_IJ=52,
1340:                MATOP_GET_COLUMN_IJ=53,
1341:                MATOP_RESTORE_COLUMN_IJ=54,
1342:                MATOP_FDCOLORING_CREATE=55,
1343:                MATOP_COLORING_PATCH=56,
1344:                MATOP_SET_UNFACTORED=57,
1345:                MATOP_PERMUTE=58,
1346:                MATOP_SET_VALUES_BLOCKED=59,
1347:                MATOP_GET_SUBMATRIX=60,
1348:                MATOP_DESTROY=61,
1349:                MATOP_VIEW=62,
1350:                MATOP_GET_MAPS=63,
1351:                MATOP_USE_SCALED_FORM=64,
1352:                MATOP_SCALE_SYSTEM=65,
1353:                MATOP_UNSCALE_SYSTEM=66,
1354:                MATOP_SET_LOCAL_TO_GLOBAL_MAP=67,
1355:                MATOP_SET_VALUES_LOCAL=68,
1356:                MATOP_ZERO_ROWS_LOCAL=69,
1357:                MATOP_GET_ROW_MAX=70,
1358:                MATOP_CONVERT=71,
1359:                MATOP_SET_COLORING=72,
1360:                MATOP_SET_VALUES_ADIC=73,
1361:                MATOP_SET_VALUES_ADIFOR=74,
1362:                MATOP_FD_COLORING_APPLY=75,
1363:                MATOP_SET_FROM_OPTIONS=76,
1364:                MATOP_MULT_CON=77,
1365:                MATOP_MULT_TRANSPOSE_CON=78,
1366:                MATOP_ILU_FACTOR_SYMBOLIC_CON=79,
1367:                MATOP_PERMUTE_SPARSIFY=80,
1368:                MATOP_MULT_MULTIPLE=81,
1369:                MATOP_SOLVE_MULTIPLE=82,
1370:                MATOP_GET_INERTIA=83,
1371:                MATOP_LOAD=84,
1372:                MATOP_IS_SYMMETRIC=85,
1373:                MATOP_IS_HERMITIAN=86,
1374:                MATOP_IS_STRUCTURALLY_SYMMETRIC=87,
1375:                MATOP_PB_RELAX=88,
1376:                MATOP_GET_VECS=89,
1377:                MATOP_MAT_MULT=90,
1378:                MATOP_MAT_MULT_SYMBOLIC=91,
1379:                MATOP_MAT_MULT_NUMERIC=92,
1380:                MATOP_PTAP=93,
1381:                MATOP_PTAP_SYMBOLIC=94,
1382:                MATOP_PTAP_NUMERIC=95,
1383:                MATOP_MAT_MULTTRANSPOSE=96,
1384:                MATOP_MAT_MULTTRANSPOSE_SYMBOLIC=97,
1385:                MATOP_MAT_MULTTRANSPOSE_NUMERIC=98,
1386:                MATOP_PTAP_SYMBOLIC_SEQAIJ=99,
1387:                MATOP_PTAP_NUMERIC_SEQAIJ=100,
1388:                MATOP_PTAP_SYMBOLIC_MPIAIJ=101,
1389:                MATOP_PTAP_NUMERIC_MPIAIJ=102,
1390:                MATOP_SET_VALUES_ROW = 105,
1391:                MATOP_GET_ROW_UTRIANGULAR=108,
1392:                MATOP_RESTORE_ROW_UTRIANGULAR=109,
1393:                MATOP_MATSOLVE=110
1394:              } MatOperation;
1395: EXTERN PetscErrorCode  MatHasOperation(Mat,MatOperation,PetscTruth*);
1396: EXTERN PetscErrorCode  MatShellSetOperation(Mat,MatOperation,void(*)(void));
1397: EXTERN PetscErrorCode  MatShellGetOperation(Mat,MatOperation,void(**)(void));
1398: EXTERN PetscErrorCode  MatShellSetContext(Mat,void*);

1400: /*
1401:    Codes for matrices stored on disk. By default they are
1402:  stored in a universal format. By changing the format with 
1403:  PetscViewerSetFormat(viewer,PETSC_VIEWER_BINARY_NATIVE); the matrices will
1404:  be stored in a way natural for the matrix, for example dense matrices
1405:  would be stored as dense. Matrices stored this way may only be
1406:  read into matrices of the same time.
1407: */
1408: #define MATRIX_BINARY_FORMAT_DENSE -1

1410: EXTERN PetscErrorCode  MatMPIBAIJSetHashTableFactor(Mat,PetscReal);
1411: EXTERN PetscErrorCode  MatISGetLocalMat(Mat,Mat*);

1413: /*S
1414:      MatNullSpace - Object that removes a null space from a vector, i.e.
1415:          orthogonalizes the vector to a subsapce

1417:    Level: advanced

1419:   Concepts: matrix; linear operator, null space

1421:   Users manual sections:
1422: .   Section 4.15 Solving Singular Systems

1424: .seealso:  MatNullSpaceCreate()
1425: S*/
1426: typedef struct _p_MatNullSpace* MatNullSpace;

1428: EXTERN PetscErrorCode  MatNullSpaceCreate(MPI_Comm,PetscTruth,PetscInt,const Vec[],MatNullSpace*);
1429: EXTERN PetscErrorCode  MatNullSpaceSetFunction(MatNullSpace,PetscErrorCode (*)(Vec,void*),void*);
1430: EXTERN PetscErrorCode  MatNullSpaceDestroy(MatNullSpace);
1431: EXTERN PetscErrorCode  MatNullSpaceRemove(MatNullSpace,Vec,Vec*);
1432: EXTERN PetscErrorCode  MatNullSpaceAttach(Mat,MatNullSpace);
1433: EXTERN PetscErrorCode  MatNullSpaceTest(MatNullSpace,Mat);

1435: EXTERN PetscErrorCode  MatReorderingSeqSBAIJ(Mat,IS);
1436: EXTERN PetscErrorCode  MatMPISBAIJSetHashTableFactor(Mat,PetscReal);
1437: EXTERN PetscErrorCode  MatSeqSBAIJSetColumnIndices(Mat,PetscInt *);
1438: EXTERN PetscErrorCode  MatSeqBAIJInvertBlockDiagonal(Mat);

1440: EXTERN PetscErrorCode  MatCreateMAIJ(Mat,PetscInt,Mat*);
1441: EXTERN PetscErrorCode  MatMAIJRedimension(Mat,PetscInt,Mat*);
1442: EXTERN PetscErrorCode  MatMAIJGetAIJ(Mat,Mat*);

1444: EXTERN PetscErrorCode  MatComputeExplicitOperator(Mat,Mat*);

1446: EXTERN PetscErrorCode  MatDiagonalScaleLocal(Mat,Vec);

1448: EXTERN PetscErrorCode  PetscViewerMathematicaPutMatrix(PetscViewer, PetscInt, PetscInt, PetscReal *);
1449: EXTERN PetscErrorCode  PetscViewerMathematicaPutCSRMatrix(PetscViewer, PetscInt, PetscInt, PetscInt *, PetscInt *, PetscReal *);

1452: #endif