xref: /petsc/include/petscmat.h (revision 1677d0b88caff045fb399525ae6e8dad78c032c0)
173f4d377SMatthew Knepley /* $Id: petscmat.h,v 1.228 2001/09/07 20:09:08 bsmith Exp $ */
22eac72dbSBarry Smith /*
32eac72dbSBarry Smith      Include file for the matrix component of PETSc
42eac72dbSBarry Smith */
50a835dfdSSatish Balay #ifndef __PETSCMAT_H
60a835dfdSSatish Balay #define __PETSCMAT_H
70a835dfdSSatish Balay #include "petscvec.h"
82eac72dbSBarry Smith 
9d9274352SBarry Smith /*S
10d9274352SBarry Smith      Mat - Abstract PETSc matrix object
112eac72dbSBarry Smith 
12d91e6319SBarry Smith    Level: beginner
13d91e6319SBarry Smith 
14d9274352SBarry Smith   Concepts: matrix; linear operator
15d9274352SBarry Smith 
16d9274352SBarry Smith .seealso:  MatCreate(), MatType, MatSetType()
17d9274352SBarry Smith S*/
18d9274352SBarry Smith typedef struct _p_Mat*           Mat;
19d9274352SBarry Smith 
20d9274352SBarry Smith /*E
21d9274352SBarry Smith     MatType - String with the name of a PETSc matrix or the creation function
22d9274352SBarry Smith        with an optional dynamic library name, for example
23d9274352SBarry Smith        http://www.mcs.anl.gov/petsc/lib.a:mymatcreate()
24d9274352SBarry Smith 
25d9274352SBarry Smith    Level: beginner
26d9274352SBarry Smith 
27d9274352SBarry Smith .seealso: MatSetType(), Mat
28d91e6319SBarry Smith E*/
29273d9f13SBarry Smith #define MATSAME            "same"
30273d9f13SBarry Smith #define MATSEQMAIJ         "seqmaij"
31273d9f13SBarry Smith #define MATMPIMAIJ         "mpimaij"
32273d9f13SBarry Smith #define MATIS              "is"
33273d9f13SBarry Smith #define MATMPIROWBS        "mpirowbs"
34273d9f13SBarry Smith #define MATSEQDENSE        "seqdense"
35273d9f13SBarry Smith #define MATSEQAIJ          "seqaij"
36273d9f13SBarry Smith #define MATMPIAIJ          "mpiaij"
37273d9f13SBarry Smith #define MATSHELL           "shell"
38273d9f13SBarry Smith #define MATSEQBDIAG        "seqbdiag"
39273d9f13SBarry Smith #define MATMPIBDIAG        "mpibdiag"
40273d9f13SBarry Smith #define MATMPIDENSE        "mpidense"
41273d9f13SBarry Smith #define MATSEQBAIJ         "seqbaij"
42273d9f13SBarry Smith #define MATMPIBAIJ         "mpibaij"
43273d9f13SBarry Smith #define MATMPIADJ          "mpiadj"
44273d9f13SBarry Smith #define MATSEQSBAIJ        "seqsbaij"
45273d9f13SBarry Smith #define MATMPISBAIJ        "mpisbaij"
46cebc7f6cSBarry Smith #define MATDAAD            "daad"
47cebc7f6cSBarry Smith #define MATMFFD            "mffd"
486d88219bSBarry Smith #define MATESI             "esi"
496d88219bSBarry Smith #define MATPETSCESI        "petscesi"
50c8a8475eSBarry Smith #define MATNORMAL          "normal"
51b3a1e11cSKris Buschelman #define MATSEQAIJSPOOLES   "seqaijspooles"
52d10c748bSKris Buschelman #define MATMPIAIJSPOOLES   "mpiaijspooles"
539abb65ffSKris Buschelman #define MATSEQSBAIJSPOOLES "seqsbaijspooles"
5422191285SKris Buschelman #define MATMPISBAIJSPOOLES "mpisbaijspooles"
5514b396bbSKris Buschelman #define MATSUPERLU         "superlu"
56448de63eSKris Buschelman #define MATSUPERLUDIST     "superludist"
57*1677d0b8SKris Buschelman #define MATUMFPACK         "umfpack"
58273d9f13SBarry Smith typedef char* MatType;
59d91e6319SBarry Smith 
60c06d978dSMatthew Knepley #define MAT_SER_SEQAIJ_BINARY "seqaij_binary"
61c06d978dSMatthew Knepley #define MAT_SER_MPIAIJ_BINARY "mpiaij_binary"
62c06d978dSMatthew Knepley typedef char *MatSerializeType;
63c06d978dSMatthew Knepley 
64c06d978dSMatthew Knepley /* Logging support */
65552e946dSBarry Smith #define    MAT_FILE_COOKIE 1211216    /* used to indicate matrices in binary files */
66c06d978dSMatthew Knepley extern int MAT_COOKIE;
6771d41ebeSBarry Smith extern int MATSNESMFCTX_COOKIE;
68c06d978dSMatthew Knepley extern int MAT_FDCOLORING_COOKIE;
698ba1e511SMatthew Knepley extern int MAT_PARTITIONING_COOKIE;
708ba1e511SMatthew Knepley extern int MAT_NULLSPACE_COOKIE;
71d59c15a7SBarry Smith extern int MAT_Mult, MAT_MultMatrixFree, MAT_Mults, MAT_MultConstrained, MAT_MultAdd, MAT_MultTranspose;
72d59c15a7SBarry Smith extern int MAT_MultTransposeConstrained, MAT_MultTransposeAdd, MAT_Solve, MAT_Solves, MAT_SolveAdd, MAT_SolveTranspose;
73d5ba7fb7SMatthew Knepley extern int MAT_SolveTransposeAdd, MAT_Relax, MAT_ForwardSolve, MAT_BackwardSolve, MAT_LUFactor, MAT_LUFactorSymbolic;
74d5ba7fb7SMatthew Knepley extern int MAT_LUFactorNumeric, MAT_CholeskyFactor, MAT_CholeskyFactorSymbolic, MAT_CholeskyFactorNumeric, MAT_ILUFactor;
75d5ba7fb7SMatthew Knepley extern int MAT_ILUFactorSymbolic, MAT_ICCFactorSymbolic, MAT_Copy, MAT_Convert, MAT_Scale, MAT_AssemblyBegin;
76d5ba7fb7SMatthew Knepley extern int MAT_AssemblyEnd, MAT_SetValues, MAT_GetValues, MAT_GetRow, MAT_GetSubMatrices, MAT_GetColoring, MAT_GetOrdering;
77d5ba7fb7SMatthew Knepley extern int MAT_IncreaseOverlap, MAT_Partitioning, MAT_ZeroEntries, MAT_Load, MAT_View, MAT_AXPY, MAT_FDColoringCreate;
7866f9b7ceSBarry Smith extern int MAT_FDColoringApply, MAT_Transpose, MAT_FDColoringFunction;
79c06d978dSMatthew Knepley 
808ba1e511SMatthew Knepley EXTERN int MatInitializePackage(char *);
81c06d978dSMatthew Knepley 
82273d9f13SBarry Smith EXTERN int MatCreate(MPI_Comm,int,int,int,int,Mat*);
83273d9f13SBarry Smith EXTERN int MatSetType(Mat,MatType);
84273d9f13SBarry Smith EXTERN int MatSetFromOptions(Mat);
85273d9f13SBarry Smith EXTERN int MatSetUpPreallocation(Mat);
86273d9f13SBarry Smith EXTERN int MatRegisterAll(char*);
87273d9f13SBarry Smith EXTERN int MatRegister(char*,char*,char*,int(*)(Mat));
88c06d978dSMatthew Knepley EXTERN int MatSerializeRegister(const char [], const char [], const char [], int (*)(MPI_Comm, Mat *, PetscViewer, PetscTruth));
8930de9b25SBarry Smith 
9030de9b25SBarry Smith /*MC
9130de9b25SBarry Smith    MatRegisterDynamic - Adds a new matrix type
9230de9b25SBarry Smith 
9330de9b25SBarry Smith    Synopsis:
9430de9b25SBarry Smith    int MatRegisterDynamic(char *name,char *path,char *name_create,int (*routine_create)(Mat))
9530de9b25SBarry Smith 
9630de9b25SBarry Smith    Not Collective
9730de9b25SBarry Smith 
9830de9b25SBarry Smith    Input Parameters:
9930de9b25SBarry Smith +  name - name of a new user-defined matrix type
10030de9b25SBarry Smith .  path - path (either absolute or relative) the library containing this solver
10130de9b25SBarry Smith .  name_create - name of routine to create method context
10230de9b25SBarry Smith -  routine_create - routine to create method context
10330de9b25SBarry Smith 
10430de9b25SBarry Smith    Notes:
10530de9b25SBarry Smith    MatRegisterDynamic() may be called multiple times to add several user-defined solvers.
10630de9b25SBarry Smith 
10730de9b25SBarry Smith    If dynamic libraries are used, then the fourth input argument (routine_create)
10830de9b25SBarry Smith    is ignored.
10930de9b25SBarry Smith 
11030de9b25SBarry Smith    Sample usage:
11130de9b25SBarry Smith .vb
11230de9b25SBarry Smith    MatRegisterDynamic("my_mat",/home/username/my_lib/lib/libO/solaris/mylib.a,
11330de9b25SBarry Smith                "MyMatCreate",MyMatCreate);
11430de9b25SBarry Smith .ve
11530de9b25SBarry Smith 
11630de9b25SBarry Smith    Then, your solver can be chosen with the procedural interface via
11730de9b25SBarry Smith $     MatSetType(Mat,"my_mat")
11830de9b25SBarry Smith    or at runtime via the option
11930de9b25SBarry Smith $     -mat_type my_mat
12030de9b25SBarry Smith 
12130de9b25SBarry Smith    Level: advanced
12230de9b25SBarry Smith 
12330de9b25SBarry Smith    Notes: ${PETSC_ARCH} and ${BOPT} occuring in pathname will be replaced with appropriate values.
12430de9b25SBarry Smith          If your function is not being put into a shared library then use VecRegister() instead
12530de9b25SBarry Smith 
12630de9b25SBarry Smith .keywords: Mat, register
12730de9b25SBarry Smith 
12830de9b25SBarry Smith .seealso: MatRegisterAll(), MatRegisterDestroy()
12930de9b25SBarry Smith 
13030de9b25SBarry Smith M*/
131273d9f13SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
132273d9f13SBarry Smith #define MatRegisterDynamic(a,b,c,d) MatRegister(a,b,c,0)
133273d9f13SBarry Smith #else
134273d9f13SBarry Smith #define MatRegisterDynamic(a,b,c,d) MatRegister(a,b,c,d)
13530de9b25SBarry Smith #endif
13630de9b25SBarry Smith 
13730de9b25SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
13830de9b25SBarry Smith #define MatSerializeRegisterDynamic(a,b,c,d) MatSerializeRegister(a,b,c,0)
13930de9b25SBarry Smith #else
140c06d978dSMatthew Knepley #define MatSerializeRegisterDynamic(a,b,c,d) MatSerializeRegister(a,b,c,d)
141273d9f13SBarry Smith #endif
14230de9b25SBarry Smith 
143273d9f13SBarry Smith extern PetscTruth MatRegisterAllCalled;
144b0a32e0cSBarry Smith extern PetscFList MatList;
14528988994SBarry Smith 
146c06d978dSMatthew Knepley EXTERN PetscFList MatSerializeList;
147c06d978dSMatthew Knepley EXTERN int MatSerializeRegisterAll(const char []);
14865804fbbSSatish Balay EXTERN int MatSerializeRegisterDestroy(void);
149c06d978dSMatthew Knepley EXTERN int MatSerializeRegisterAllCalled;
150c06d978dSMatthew Knepley EXTERN int MatSerialize(MPI_Comm, Mat *, PetscViewer, PetscTruth);
151c06d978dSMatthew Knepley EXTERN int MatSetSerializeType(Mat, MatSerializeType);
152c06d978dSMatthew Knepley 
153ca01db9bSBarry Smith EXTERN int MatCreateSeqDense(MPI_Comm,int,int,PetscScalar[],Mat*);
154ca01db9bSBarry Smith EXTERN int MatCreateMPIDense(MPI_Comm,int,int,int,int,PetscScalar[],Mat*);
155ca01db9bSBarry Smith EXTERN int MatCreateSeqAIJ(MPI_Comm,int,int,int,const int[],Mat*);
156ca01db9bSBarry Smith EXTERN int MatCreateMPIAIJ(MPI_Comm,int,int,int,int,int,const int[],int,const int[],Mat*);
157ca01db9bSBarry Smith EXTERN int MatCreateMPIRowbs(MPI_Comm,int,int,int,const int[],Mat*);
158ca01db9bSBarry Smith EXTERN int MatCreateSeqBDiag(MPI_Comm,int,int,int,int,const int[],PetscScalar*[],Mat*);
159ca01db9bSBarry Smith EXTERN int MatCreateMPIBDiag(MPI_Comm,int,int,int,int,int,const int[],PetscScalar*[],Mat*);
160ca01db9bSBarry Smith EXTERN int MatCreateSeqBAIJ(MPI_Comm,int,int,int,int,const int[],Mat*);
161ca01db9bSBarry Smith EXTERN int MatCreateMPIBAIJ(MPI_Comm,int,int,int,int,int,int,const int[],int,const int[],Mat*);
162ca01db9bSBarry Smith EXTERN int MatCreateMPIAdj(MPI_Comm,int,int,int[],int[],int[],Mat*);
163ca01db9bSBarry Smith EXTERN int MatCreateSeqSBAIJ(MPI_Comm,int,int,int,int,const int[],Mat*);
164ca01db9bSBarry Smith EXTERN int MatCreateMPISBAIJ(MPI_Comm,int,int,int,int,int,int,const int[],int,const int[],Mat*);
165ca44d042SBarry Smith EXTERN int MatCreateShell(MPI_Comm,int,int,int,int,void *,Mat*);
1663a7fca6bSBarry Smith EXTERN int MatCreateAdic(MPI_Comm,int,int,int,int,int,void (*)(void),Mat*);
167c8a8475eSBarry Smith EXTERN int MatCreateNormal(Mat,Mat*);
168435da068SBarry Smith EXTERN int MatDestroy(Mat);
16921c89e3eSBarry Smith 
170ca44d042SBarry Smith EXTERN int MatPrintHelp(Mat);
1718a124369SBarry Smith EXTERN int MatGetPetscMaps(Mat,PetscMap*,PetscMap*);
172ec0117caSBarry Smith 
1738ed539a5SBarry Smith /* ------------------------------------------------------------*/
174f15d580aSBarry Smith EXTERN int MatSetValues(Mat,int,const int[],int,const int[],const PetscScalar[],InsertMode);
175f15d580aSBarry Smith EXTERN int MatSetValuesBlocked(Mat,int,const int[],int,const int[],const PetscScalar[],InsertMode);
17684cb2905SBarry Smith 
1772ef4de8bSBarry Smith /*S
1782ef4de8bSBarry Smith      MatStencil - Data structure (C struct) for storing information about a single row or
1792ef4de8bSBarry Smith         column of a matrix as index on an associated grid.
1802ef4de8bSBarry Smith 
1812ef4de8bSBarry Smith    Level: beginner
1822ef4de8bSBarry Smith 
1832ef4de8bSBarry Smith   Concepts: matrix; linear operator
1842ef4de8bSBarry Smith 
1852ef4de8bSBarry Smith .seealso:  MatSetValuesStencil(), MatSetStencil()
1862ef4de8bSBarry Smith S*/
187435da068SBarry Smith typedef struct {
188435da068SBarry Smith   int k,j,i,c;
189435da068SBarry Smith } MatStencil;
1902ef4de8bSBarry Smith 
191f15d580aSBarry Smith EXTERN int MatSetValuesStencil(Mat,int,const MatStencil[],int,const MatStencil[],const PetscScalar[],InsertMode);
192f15d580aSBarry Smith EXTERN int MatSetValuesBlockedStencil(Mat,int,const MatStencil[],int,const MatStencil[],const PetscScalar[],InsertMode);
193f15d580aSBarry Smith EXTERN int MatSetStencil(Mat,int,const int[],const int[],int);
194435da068SBarry Smith 
1953a7fca6bSBarry Smith EXTERN int MatSetColoring(Mat,ISColoring);
1963a7fca6bSBarry Smith EXTERN int MatSetValuesAdic(Mat,void*);
1973a7fca6bSBarry Smith EXTERN int MatSetValuesAdifor(Mat,int,void*);
1983a7fca6bSBarry Smith 
199d91e6319SBarry Smith /*E
200d91e6319SBarry Smith     MatAssemblyType - Indicates if the matrix is now to be used, or if you plan
201d91e6319SBarry Smith      to continue to add values to it
202d91e6319SBarry Smith 
203d91e6319SBarry Smith     Level: beginner
204d91e6319SBarry Smith 
205d91e6319SBarry Smith .seealso: MatAssemblyBegin(), MatAssemblyEnd()
206d91e6319SBarry Smith E*/
2076d4a8577SBarry Smith typedef enum {MAT_FLUSH_ASSEMBLY=1,MAT_FINAL_ASSEMBLY=0} MatAssemblyType;
208ca44d042SBarry Smith EXTERN int MatAssemblyBegin(Mat,MatAssemblyType);
209ca44d042SBarry Smith EXTERN int MatAssemblyEnd(Mat,MatAssemblyType);
210ca44d042SBarry Smith EXTERN int MatAssembled(Mat,PetscTruth*);
2114f9c727eSBarry Smith 
21230de9b25SBarry Smith /*MC
21330de9b25SBarry Smith    MatSetValue - Set a single entry into a matrix.
21430de9b25SBarry Smith 
21530de9b25SBarry Smith    Synopsis:
21630de9b25SBarry Smith    int MatSetValue(Mat m,int row,int col,PetscScalar value,InsertMode mode);
21730de9b25SBarry Smith 
21830de9b25SBarry Smith    Not collective
21930de9b25SBarry Smith 
22030de9b25SBarry Smith    Input Parameters:
22130de9b25SBarry Smith +  m - the matrix
22230de9b25SBarry Smith .  row - the row location of the entry
22330de9b25SBarry Smith .  col - the column location of the entry
22430de9b25SBarry Smith .  value - the value to insert
22530de9b25SBarry Smith -  mode - either INSERT_VALUES or ADD_VALUES
22630de9b25SBarry Smith 
22730de9b25SBarry Smith    Notes:
22830de9b25SBarry Smith    For efficiency one should use MatSetValues() and set several or many
22930de9b25SBarry Smith    values simultaneously if possible.
23030de9b25SBarry Smith 
23130de9b25SBarry Smith    Note that MatSetValue() does NOT return an error code (since this
23230de9b25SBarry Smith    is checked internally).
23330de9b25SBarry Smith 
23430de9b25SBarry Smith    Level: beginner
23530de9b25SBarry Smith 
23630de9b25SBarry Smith .seealso: MatSetValues(), MatSetValueLocal()
23730de9b25SBarry Smith M*/
238b951964fSBarry Smith #define MatSetValue(v,i,j,va,mode) \
239ea709b57SSatish Balay 0; {int _ierr,_row = i,_col = j; PetscScalar _va = va; \
240b951964fSBarry Smith   _ierr = MatSetValues(v,1,&_row,1,&_col,&_va,mode);CHKERRQ(_ierr); \
241b951964fSBarry Smith }
24230de9b25SBarry Smith 
243ea06a074SBarry Smith #define MatGetValue(v,i,j,va) \
244d91e6319SBarry Smith 0; {int _ierr,_row = i,_col = j; \
245ea06a074SBarry Smith   _ierr = MatGetValues(v,1,&_row,1,&_col,&va);CHKERRQ(_ierr); \
246ea06a074SBarry Smith }
24730de9b25SBarry Smith 
248d91e6319SBarry Smith #define MatSetValueLocal(v,i,j,va,mode) \
249ea709b57SSatish Balay 0; {int _ierr,_row = i,_col = j; PetscScalar _va = va; \
250d91e6319SBarry Smith   _ierr = MatSetValuesLocal(v,1,&_row,1,&_col,&_va,mode);CHKERRQ(_ierr); \
251d91e6319SBarry Smith }
25230de9b25SBarry Smith 
253d91e6319SBarry Smith /*E
254d91e6319SBarry Smith     MatOption - Options that may be set for a matrix and its behavior or storage
255d91e6319SBarry Smith 
256d91e6319SBarry Smith     Level: beginner
257d91e6319SBarry Smith 
2580a835dfdSSatish Balay    Any additions/changes here MUST also be made in include/finclude/petscmat.h
259d91e6319SBarry Smith 
260d91e6319SBarry Smith .seealso: MatSetOption()
261d91e6319SBarry Smith E*/
2626d4a8577SBarry Smith typedef enum {MAT_ROW_ORIENTED=1,MAT_COLUMN_ORIENTED=2,MAT_ROWS_SORTED=4,
2636d4a8577SBarry Smith               MAT_COLUMNS_SORTED=8,MAT_NO_NEW_NONZERO_LOCATIONS=16,
2646d4a8577SBarry Smith               MAT_YES_NEW_NONZERO_LOCATIONS=32,MAT_SYMMETRIC=64,
2656ca9ecd3SBarry Smith               MAT_STRUCTURALLY_SYMMETRIC=65,MAT_NO_NEW_DIAGONALS=66,
2666ca9ecd3SBarry Smith               MAT_YES_NEW_DIAGONALS=67,MAT_INODE_LIMIT_1=68,MAT_INODE_LIMIT_2=69,
2676ca9ecd3SBarry Smith               MAT_INODE_LIMIT_3=70,MAT_INODE_LIMIT_4=71,MAT_INODE_LIMIT_5=72,
2686ca9ecd3SBarry Smith               MAT_IGNORE_OFF_PROC_ENTRIES=73,MAT_ROWS_UNSORTED=74,
2694787f768SSatish Balay               MAT_COLUMNS_UNSORTED=75,MAT_NEW_NONZERO_LOCATION_ERR=76,
2707c922b88SBarry Smith               MAT_NEW_NONZERO_ALLOCATION_ERR=77,MAT_USE_HASH_TABLE=78,
2712bad1931SBarry Smith               MAT_KEEP_ZEROED_ROWS=79,MAT_IGNORE_ZERO_ENTRIES=80,MAT_USE_INODES=81,
272123145dfSKris Buschelman               MAT_DO_NOT_USE_INODES=82} MatOption;
273ca44d042SBarry Smith EXTERN int MatSetOption(Mat,MatOption);
274273d9f13SBarry Smith EXTERN int MatGetType(Mat,MatType*);
27584cb2905SBarry Smith 
276f15d580aSBarry Smith EXTERN int MatGetValues(Mat,int,const int[],int,const int[],PetscScalar[]);
277f15d580aSBarry Smith EXTERN int MatGetRow(Mat,int,int *,int *[],PetscScalar*[]);
278f15d580aSBarry Smith EXTERN int MatRestoreRow(Mat,int,int *,int *[],PetscScalar*[]);
2794e7234bfSBarry Smith EXTERN int MatGetColumn(Mat,int,int *,int *[],PetscScalar*[]);
2804e7234bfSBarry Smith EXTERN int MatRestoreColumn(Mat,int,int *,int *[],PetscScalar*[]);
281ca44d042SBarry Smith EXTERN int MatGetColumnVector(Mat,Vec,int);
2824e7234bfSBarry Smith EXTERN int MatGetArray(Mat,PetscScalar *[]);
2834e7234bfSBarry Smith EXTERN int MatRestoreArray(Mat,PetscScalar *[]);
284ca44d042SBarry Smith EXTERN int MatGetBlockSize(Mat,int *);
2857b80b807SBarry Smith 
286ca44d042SBarry Smith EXTERN int MatMult(Mat,Vec,Vec);
287ca44d042SBarry Smith EXTERN int MatMultAdd(Mat,Vec,Vec,Vec);
288ca44d042SBarry Smith EXTERN int MatMultTranspose(Mat,Vec,Vec);
289cd0d46ebSvictorle EXTERN int MatIsSymmetric(Mat,Mat,PetscTruth*);
290ca44d042SBarry Smith EXTERN int MatMultTransposeAdd(Mat,Vec,Vec,Vec);
291c06d978dSMatthew Knepley EXTERN int MatMultConstrained(Mat,Vec,Vec);
2926d0dc95fSMatthew Knepley EXTERN int MatMultTransposeConstrained(Mat,Vec,Vec);
2932eac72dbSBarry Smith 
294d91e6319SBarry Smith /*E
295d91e6319SBarry Smith     MatDuplicateOption - Indicates if a duplicated sparse matrix should have
296d91e6319SBarry Smith   its numerical values copied over or just its nonzero structure.
297d91e6319SBarry Smith 
298d91e6319SBarry Smith     Level: beginner
299d91e6319SBarry Smith 
300d91e6319SBarry Smith    Any additions/changes here MUST also be made in include/finclude/petscmat.h
301d91e6319SBarry Smith 
302d91e6319SBarry Smith .seealso: MatDuplicate()
303d91e6319SBarry Smith E*/
3042e8a6d31SBarry Smith typedef enum {MAT_DO_NOT_COPY_VALUES,MAT_COPY_VALUES} MatDuplicateOption;
3052e8a6d31SBarry Smith 
306273d9f13SBarry Smith EXTERN int MatConvertRegister(char*,char*,char*,int (*)(Mat,MatType,Mat*));
307273d9f13SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
308273d9f13SBarry Smith #define MatConvertRegisterDynamic(a,b,c,d) MatConvertRegister(a,b,c,0)
309273d9f13SBarry Smith #else
310273d9f13SBarry Smith #define MatConvertRegisterDynamic(a,b,c,d) MatConvertRegister(a,b,c,d)
311273d9f13SBarry Smith #endif
312273d9f13SBarry Smith EXTERN int        MatConvertRegisterAll(char*);
313273d9f13SBarry Smith EXTERN int        MatConvertRegisterDestroy(void);
314273d9f13SBarry Smith extern PetscTruth MatConvertRegisterAllCalled;
315b0a32e0cSBarry Smith extern PetscFList MatConvertList;
316ca44d042SBarry Smith EXTERN int        MatConvert(Mat,MatType,Mat*);
317ca44d042SBarry Smith EXTERN int        MatDuplicate(Mat,MatDuplicateOption,Mat*);
31894a9d846SBarry Smith 
319d91e6319SBarry Smith /*E
320d91e6319SBarry Smith     MatStructure - Indicates if the matrix has the same nonzero structure
321d91e6319SBarry Smith 
322d91e6319SBarry Smith     Level: beginner
323d91e6319SBarry Smith 
324d91e6319SBarry Smith    Any additions/changes here MUST also be made in include/finclude/petscmat.h
325d91e6319SBarry Smith 
326d91e6319SBarry Smith .seealso: MatCopy(), SLESSetOperators(), PCSetOperators()
327d91e6319SBarry Smith E*/
328c537a176SHong Zhang typedef enum {SAME_NONZERO_PATTERN,DIFFERENT_NONZERO_PATTERN,SAME_PRECONDITIONER,SUBSET_NONZERO_PATTERN} MatStructure;
329cb5b572fSBarry Smith 
330ca44d042SBarry Smith EXTERN int MatCopy(Mat,Mat,MatStructure);
331b0a32e0cSBarry Smith EXTERN int MatView(Mat,PetscViewer);
332273d9f13SBarry Smith 
333b0a32e0cSBarry Smith EXTERN int MatLoadRegister(char*,char*,char*,int (*)(PetscViewer,MatType,Mat*));
334273d9f13SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
335273d9f13SBarry Smith #define MatLoadRegisterDynamic(a,b,c,d) MatLoadRegister(a,b,c,0)
336273d9f13SBarry Smith #else
337273d9f13SBarry Smith #define MatLoadRegisterDynamic(a,b,c,d) MatLoadRegister(a,b,c,d)
338273d9f13SBarry Smith #endif
339273d9f13SBarry Smith EXTERN int        MatLoadRegisterAll(char*);
340273d9f13SBarry Smith EXTERN int        MatLoadRegisterDestroy(void);
341273d9f13SBarry Smith extern PetscTruth MatLoadRegisterAllCalled;
342b0a32e0cSBarry Smith extern PetscFList MatLoadList;
343b0a32e0cSBarry Smith EXTERN int        MatLoad(PetscViewer,MatType,Mat*);
34451dd7536SBarry Smith EXTERN int        MatMerge(MPI_Comm,Mat,Mat*);
3457b80b807SBarry Smith 
3464e7234bfSBarry Smith EXTERN int MatGetRowIJ(Mat,int,PetscTruth,int*,int *[],int *[],PetscTruth *);
3474e7234bfSBarry Smith EXTERN int MatRestoreRowIJ(Mat,int,PetscTruth,int *,int *[],int *[],PetscTruth *);
3484e7234bfSBarry Smith EXTERN int MatGetColumnIJ(Mat,int,PetscTruth,int*,int *[],int *[],PetscTruth *);
3494e7234bfSBarry Smith EXTERN int MatRestoreColumnIJ(Mat,int,PetscTruth,int *,int *[],int *[],PetscTruth *);
350d4fbbf0eSBarry Smith 
351d91e6319SBarry Smith /*S
352d91e6319SBarry Smith      MatInfo - Context of matrix information, used with MatGetInfo()
353d91e6319SBarry Smith 
354d91e6319SBarry Smith    In Fortran this is simply a double precision array of dimension MAT_INFO_SIZE
355d91e6319SBarry Smith 
356d91e6319SBarry Smith    Level: intermediate
357d91e6319SBarry Smith 
358d91e6319SBarry Smith   Concepts: matrix^nonzero information
359d91e6319SBarry Smith 
360d9274352SBarry Smith .seealso:  MatGetInfo(), MatInfoType
361d91e6319SBarry Smith S*/
3624e220ebcSLois Curfman McInnes typedef struct {
363b0a32e0cSBarry Smith   PetscLogDouble rows_global,columns_global;         /* number of global rows and columns */
364b0a32e0cSBarry Smith   PetscLogDouble rows_local,columns_local;           /* number of local rows and columns */
365b0a32e0cSBarry Smith   PetscLogDouble block_size;                         /* block size */
366b0a32e0cSBarry Smith   PetscLogDouble nz_allocated,nz_used,nz_unneeded;   /* number of nonzeros */
367b0a32e0cSBarry Smith   PetscLogDouble memory;                             /* memory allocated */
368b0a32e0cSBarry Smith   PetscLogDouble assemblies;                         /* number of matrix assemblies called */
369b0a32e0cSBarry Smith   PetscLogDouble mallocs;                            /* number of mallocs during MatSetValues() */
370b0a32e0cSBarry Smith   PetscLogDouble fill_ratio_given,fill_ratio_needed; /* fill ratio for LU/ILU */
371b0a32e0cSBarry Smith   PetscLogDouble factor_mallocs;                     /* number of mallocs during factorization */
3724e220ebcSLois Curfman McInnes } MatInfo;
3734e220ebcSLois Curfman McInnes 
374d9274352SBarry Smith /*E
375d9274352SBarry Smith     MatInfoType - Indicates if you want information about the local part of the matrix,
376d9274352SBarry Smith      the entire parallel matrix or the maximum over all the local parts.
377d9274352SBarry Smith 
378d9274352SBarry Smith     Level: beginner
379d9274352SBarry Smith 
380d9274352SBarry Smith    Any additions/changes here MUST also be made in include/finclude/petscmat.h
381d9274352SBarry Smith 
382d9274352SBarry Smith .seealso: MatGetInfo(), MatInfo
383d9274352SBarry Smith E*/
3847b80b807SBarry Smith typedef enum {MAT_LOCAL=1,MAT_GLOBAL_MAX=2,MAT_GLOBAL_SUM=3} MatInfoType;
385ca44d042SBarry Smith EXTERN int MatGetInfo(Mat,MatInfoType,MatInfo*);
386ca44d042SBarry Smith EXTERN int MatValid(Mat,PetscTruth*);
387ca44d042SBarry Smith EXTERN int MatGetDiagonal(Mat,Vec);
388273d9f13SBarry Smith EXTERN int MatGetRowMax(Mat,Vec);
389ca44d042SBarry Smith EXTERN int MatTranspose(Mat,Mat*);
390ca44d042SBarry Smith EXTERN int MatPermute(Mat,IS,IS,Mat *);
391bf1d55d4SSatish Balay EXTERN int MatPermuteSparsify(Mat,int,PetscReal,PetscReal,IS,IS,Mat *);
392ca44d042SBarry Smith EXTERN int MatDiagonalScale(Mat,Vec,Vec);
39306ef90c2SBarry Smith EXTERN int MatDiagonalSet(Mat,Vec,InsertMode);
394ca44d042SBarry Smith EXTERN int MatEqual(Mat,Mat,PetscTruth*);
3957b80b807SBarry Smith 
39687828ca2SBarry Smith EXTERN int MatNorm(Mat,NormType,PetscReal *);
397ca44d042SBarry Smith EXTERN int MatZeroEntries(Mat);
398268466fbSBarry Smith EXTERN int MatZeroRows(Mat,IS,const PetscScalar*);
399268466fbSBarry Smith EXTERN int MatZeroColumns(Mat,IS,const PetscScalar*);
4007b80b807SBarry Smith 
401ca44d042SBarry Smith EXTERN int MatUseScaledForm(Mat,PetscTruth);
402ca44d042SBarry Smith EXTERN int MatScaleSystem(Mat,Vec,Vec);
403ca44d042SBarry Smith EXTERN int MatUnScaleSystem(Mat,Vec,Vec);
4045ef9f2a5SBarry Smith 
405ca44d042SBarry Smith EXTERN int MatGetSize(Mat,int*,int*);
406ca44d042SBarry Smith EXTERN int MatGetLocalSize(Mat,int*,int*);
407ca44d042SBarry Smith EXTERN int MatGetOwnershipRange(Mat,int*,int*);
4087b80b807SBarry Smith 
409d91e6319SBarry Smith /*E
410d91e6319SBarry Smith     MatReuse - Indicates if matrices obtained from a previous call to MatGetSubMatrices()
411d91e6319SBarry Smith      or MatGetSubMatrix() are to be reused to store the new matrix values.
412d91e6319SBarry Smith 
413d91e6319SBarry Smith     Level: beginner
414d91e6319SBarry Smith 
415d91e6319SBarry Smith    Any additions/changes here MUST also be made in include/finclude/petscmat.h
416d91e6319SBarry Smith 
417d91e6319SBarry Smith .seealso: MatGetSubMatrices(), MatGetSubMatrix(), MatDestroyMatrices()
418d91e6319SBarry Smith E*/
4197b2a1423SBarry Smith typedef enum {MAT_INITIAL_MATRIX,MAT_REUSE_MATRIX} MatReuse;
420268466fbSBarry Smith EXTERN int MatGetSubMatrices(Mat,int,const IS[],const IS[],MatReuse,Mat *[]);
421268466fbSBarry Smith EXTERN int MatDestroyMatrices(int,Mat *[]);
422ca44d042SBarry Smith EXTERN int MatGetSubMatrix(Mat,IS,IS,int,MatReuse,Mat *);
4238efafbd8SBarry Smith 
424268466fbSBarry Smith EXTERN int MatIncreaseOverlap(Mat,int,IS[],int);
4257b80b807SBarry Smith 
426268466fbSBarry Smith EXTERN int MatAXPY(const PetscScalar *,Mat,Mat,MatStructure);
427268466fbSBarry Smith EXTERN int MatAYPX(const PetscScalar *,Mat,Mat);
428ca44d042SBarry Smith EXTERN int MatCompress(Mat);
4297b80b807SBarry Smith 
430268466fbSBarry Smith EXTERN int MatScale(const PetscScalar *,Mat);
431268466fbSBarry Smith EXTERN int MatShift(const PetscScalar *,Mat);
432052efed2SBarry Smith 
433ca44d042SBarry Smith EXTERN int MatSetLocalToGlobalMapping(Mat,ISLocalToGlobalMapping);
434ca44d042SBarry Smith EXTERN int MatSetLocalToGlobalMappingBlock(Mat,ISLocalToGlobalMapping);
435268466fbSBarry Smith EXTERN int MatZeroRowsLocal(Mat,IS,const PetscScalar*);
436f15d580aSBarry Smith EXTERN int MatSetValuesLocal(Mat,int,const int[],int,const int[],const PetscScalar[],InsertMode);
437f15d580aSBarry Smith EXTERN int MatSetValuesBlockedLocal(Mat,int,const int[],int,const int[],const PetscScalar[],InsertMode);
43890f02eecSBarry Smith 
439ca44d042SBarry Smith EXTERN int MatSetStashInitialSize(Mat,int,int);
440649db694SBarry Smith 
441ca44d042SBarry Smith EXTERN int MatInterpolateAdd(Mat,Vec,Vec,Vec);
442ca44d042SBarry Smith EXTERN int MatInterpolate(Mat,Vec,Vec);
443ca44d042SBarry Smith EXTERN int MatRestrict(Mat,Vec,Vec);
4447c922b88SBarry Smith 
445bd481603SBarry Smith 
446bd481603SBarry Smith /*MC
447bd481603SBarry Smith    MatPreallocInitialize - Begins the block of code that will count the number of nonzeros per
448bd481603SBarry Smith        row in a matrix providing the data that one can use to correctly preallocate the matrix.
449bd481603SBarry Smith 
450bd481603SBarry Smith    Synopsis:
451bd481603SBarry Smith    int MatPreallocateInitialize(MPI_Comm comm, int nrows, int ncols, int *dnz, int *onz)
452bd481603SBarry Smith 
453bd481603SBarry Smith    Collective on MPI_Comm
454bd481603SBarry Smith 
455bd481603SBarry Smith    Input Parameters:
456bd481603SBarry Smith +  comm - the communicator that will share the eventually allocated matrix
457bd481603SBarry Smith .  nrows - the number of rows in the matrix
458bd481603SBarry Smith -  ncols - the number of columns in the matrix
459bd481603SBarry Smith 
460bd481603SBarry Smith    Output Parameters:
461bd481603SBarry Smith +  dnz - the array that will be passed to the matrix preallocation routines
462bd481603SBarry Smith -  ozn - the other array passed to the matrix preallocation routines
463bd481603SBarry Smith 
464bd481603SBarry Smith 
465bd481603SBarry Smith    Level: intermediate
466bd481603SBarry Smith 
467bd481603SBarry Smith    Notes:
468bd481603SBarry Smith    See the chapter in the users manual on performance for more details
469bd481603SBarry Smith 
470bd481603SBarry Smith    Do not malloc or free dnz and onz that is handled internally by these routines
471bd481603SBarry Smith 
472bd481603SBarry Smith    Use MatPreallocateInitializeSymmetric() for symmetric matrices (MPISBAIJ matrices)
473bd481603SBarry Smith 
474bd481603SBarry Smith   Concepts: preallocation^Matrix
475bd481603SBarry Smith 
476bd481603SBarry Smith .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateSetLocal(),
477bd481603SBarry Smith           MatPreallocateInitializeSymmetric(), MatPreallocateSymmetricSetLocal()
478bd481603SBarry Smith M*/
479c4f061fbSSatish Balay #define MatPreallocateInitialize(comm,nrows,ncols,dnz,onz) 0; \
4807c922b88SBarry Smith { \
481ef66eb69SBarry Smith   int _4_ierr,__tmp = (nrows),__ctmp = (ncols),__rstart,__start,__end; \
482ef66eb69SBarry Smith   _4_ierr = PetscMalloc(2*__tmp*sizeof(int),&dnz);CHKERRQ(_4_ierr);onz = dnz + __tmp;\
483ef66eb69SBarry Smith   _4_ierr = PetscMemzero(dnz,2*__tmp*sizeof(int));CHKERRQ(_4_ierr);\
484ef66eb69SBarry Smith   _4_ierr = MPI_Scan(&__ctmp,&__end,1,MPI_INT,MPI_SUM,comm);CHKERRQ(_4_ierr); __start = __end - __ctmp;\
485ef66eb69SBarry Smith   _4_ierr = MPI_Scan(&__tmp,&__rstart,1,MPI_INT,MPI_SUM,comm);CHKERRQ(_4_ierr); __rstart = __rstart - __tmp;
4867c922b88SBarry Smith 
487bd481603SBarry Smith /*MC
488bd481603SBarry Smith    MatPreallocSymmetricInitialize - Begins the block of code that will count the number of nonzeros per
489bd481603SBarry Smith        row in a matrix providing the data that one can use to correctly preallocate the matrix.
490bd481603SBarry Smith 
491bd481603SBarry Smith    Synopsis:
492bd481603SBarry Smith    int MatPreallocateSymmetricInitialize(MPI_Comm comm, int nrows, int ncols, int *dnz, int *onz)
493bd481603SBarry Smith 
494bd481603SBarry Smith    Collective on MPI_Comm
495bd481603SBarry Smith 
496bd481603SBarry Smith    Input Parameters:
497bd481603SBarry Smith +  comm - the communicator that will share the eventually allocated matrix
498bd481603SBarry Smith .  nrows - the number of rows in the matrix
499bd481603SBarry Smith -  ncols - the number of columns in the matrix
500bd481603SBarry Smith 
501bd481603SBarry Smith    Output Parameters:
502bd481603SBarry Smith +  dnz - the array that will be passed to the matrix preallocation routines
503bd481603SBarry Smith -  ozn - the other array passed to the matrix preallocation routines
504bd481603SBarry Smith 
505bd481603SBarry Smith 
506bd481603SBarry Smith    Level: intermediate
507bd481603SBarry Smith 
508bd481603SBarry Smith    Notes:
509bd481603SBarry Smith    See the chapter in the users manual on performance for more details
510bd481603SBarry Smith 
511bd481603SBarry Smith    Do not malloc or free dnz and onz that is handled internally by these routines
512bd481603SBarry Smith 
513bd481603SBarry Smith   Concepts: preallocation^Matrix
514bd481603SBarry Smith 
515bd481603SBarry Smith .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateSetLocal(),
516bd481603SBarry Smith           MatPreallocateInitialize(), MatPreallocateSymmetricSetLocal()
517bd481603SBarry Smith M*/
518222b16d4SBarry Smith #define MatPreallocateSymmetricInitialize(comm,nrows,ncols,dnz,onz) 0; \
519222b16d4SBarry Smith { \
520222b16d4SBarry Smith   int _4_ierr,__tmp = (nrows),__ctmp = (ncols),__rstart,__end; \
521222b16d4SBarry Smith   _4_ierr = PetscMalloc(2*__tmp*sizeof(int),&dnz);CHKERRQ(_4_ierr);onz = dnz + __tmp;\
522222b16d4SBarry Smith   _4_ierr = PetscMemzero(dnz,2*__tmp*sizeof(int));CHKERRQ(_4_ierr);\
523222b16d4SBarry Smith   _4_ierr = MPI_Scan(&__ctmp,&__end,1,MPI_INT,MPI_SUM,comm);CHKERRQ(_4_ierr);\
524222b16d4SBarry Smith   _4_ierr = MPI_Scan(&__tmp,&__rstart,1,MPI_INT,MPI_SUM,comm);CHKERRQ(_4_ierr); __rstart = __rstart - __tmp;
525222b16d4SBarry Smith 
526bd481603SBarry Smith /*MC
527bd481603SBarry Smith    MatPreallocateSetLocal - Indicates the locations (rows and columns) in the matrix where nonzeros will be
528bd481603SBarry Smith        inserted using a local number of the rows and columns
529bd481603SBarry Smith 
530bd481603SBarry Smith    Synopsis:
531bd481603SBarry Smith    int MatPreallocateSetLocal(ISLocalToGlobalMappping map,int nrows, int *rows,int ncols, int *cols,int *dnz, int *onz)
532bd481603SBarry Smith 
533bd481603SBarry Smith    Not Collective
534bd481603SBarry Smith 
535bd481603SBarry Smith    Input Parameters:
536bd481603SBarry Smith +  map - the mapping between local numbering and global numbering
537bd481603SBarry Smith .  nrows - the number of rows indicated
538bd481603SBarry Smith .  rows - the indices of the rows (these will be mapped in the
539bd481603SBarry Smith .  ncols - the number of columns in the matrix
540bd481603SBarry Smith .  cols - the columns indicated
541bd481603SBarry Smith .  dnz - the array that will be passed to the matrix preallocation routines
542bd481603SBarry Smith -  ozn - the other array passed to the matrix preallocation routines
543bd481603SBarry Smith 
544bd481603SBarry Smith 
545bd481603SBarry Smith    Level: intermediate
546bd481603SBarry Smith 
547bd481603SBarry Smith    Notes:
548bd481603SBarry Smith    See the chapter in the users manual on performance for more details
549bd481603SBarry Smith 
550bd481603SBarry Smith    Do not malloc or free dnz and onz that is handled internally by these routines
551bd481603SBarry Smith 
552bd481603SBarry Smith   Concepts: preallocation^Matrix
553bd481603SBarry Smith 
554bd481603SBarry Smith .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateInitialize(),
555bd481603SBarry Smith           MatPreallocateInitialize(), MatPreallocateSymmetricSetLocal()
556bd481603SBarry Smith M*/
557c4f061fbSSatish Balay #define MatPreallocateSetLocal(map,nrows,rows,ncols,cols,dnz,onz) 0;\
558c4f061fbSSatish Balay {\
559c4f061fbSSatish Balay   int __l;\
560ef66eb69SBarry Smith   _4_ierr = ISLocalToGlobalMappingApply(map,nrows,rows,rows);CHKERRQ(_4_ierr);\
561ef66eb69SBarry Smith   _4_ierr = ISLocalToGlobalMappingApply(map,ncols,cols,cols);CHKERRQ(_4_ierr);\
562c4f061fbSSatish Balay   for (__l=0;__l<nrows;__l++) {\
563ef66eb69SBarry Smith     _4_ierr = MatPreallocateSet((rows)[__l],ncols,cols,dnz,onz);CHKERRQ(_4_ierr);\
564c4f061fbSSatish Balay   }\
565c4f061fbSSatish Balay }
566c4f061fbSSatish Balay 
567bd481603SBarry Smith /*MC
568bd481603SBarry Smith    MatPreallocateSymmetricSetLocal - Indicates the locations (rows and columns) in the matrix where nonzeros will be
569bd481603SBarry Smith        inserted using a local number of the rows and columns
570bd481603SBarry Smith 
571bd481603SBarry Smith    Synopsis:
572bd481603SBarry Smith    int MatPreallocateSymmetricSetLocal(ISLocalToGlobalMappping map,int nrows, int *rows,int ncols, int *cols,int *dnz, int *onz)
573bd481603SBarry Smith 
574bd481603SBarry Smith    Not Collective
575bd481603SBarry Smith 
576bd481603SBarry Smith    Input Parameters:
577bd481603SBarry Smith +  map - the mapping between local numbering and global numbering
578bd481603SBarry Smith .  nrows - the number of rows indicated
579bd481603SBarry Smith .  rows - the indices of the rows (these will be mapped in the
580bd481603SBarry Smith .  ncols - the number of columns in the matrix
581bd481603SBarry Smith .  cols - the columns indicated
582bd481603SBarry Smith .  dnz - the array that will be passed to the matrix preallocation routines
583bd481603SBarry Smith -  ozn - the other array passed to the matrix preallocation routines
584bd481603SBarry Smith 
585bd481603SBarry Smith 
586bd481603SBarry Smith    Level: intermediate
587bd481603SBarry Smith 
588bd481603SBarry Smith    Notes:
589bd481603SBarry Smith    See the chapter in the users manual on performance for more details
590bd481603SBarry Smith 
591bd481603SBarry Smith    Do not malloc or free dnz and onz that is handled internally by these routines
592bd481603SBarry Smith 
593bd481603SBarry Smith   Concepts: preallocation^Matrix
594bd481603SBarry Smith 
595bd481603SBarry Smith .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateInitialize(),
596bd481603SBarry Smith           MatPreallocateInitialize(), MatPreallocateSymmetricSetLocal(), MatPreallocateSetLocal()
597bd481603SBarry Smith M*/
598d3d32019SBarry Smith #define MatPreallocateSymmetricSetLocal(map,nrows,rows,ncols,cols,dnz,onz) 0;\
599d3d32019SBarry Smith {\
600d3d32019SBarry Smith   int __l;\
601d3d32019SBarry Smith   _4_ierr = ISLocalToGlobalMappingApply(map,nrows,rows,rows);CHKERRQ(_4_ierr);\
602d3d32019SBarry Smith   _4_ierr = ISLocalToGlobalMappingApply(map,ncols,cols,cols);CHKERRQ(_4_ierr);\
603d3d32019SBarry Smith   for (__l=0;__l<nrows;__l++) {\
604d3d32019SBarry Smith     _4_ierr = MatPreallocateSymmetricSet((rows)[__l],ncols,cols,dnz,onz);CHKERRQ(_4_ierr);\
605d3d32019SBarry Smith   }\
606d3d32019SBarry Smith }
607d3d32019SBarry Smith 
608bd481603SBarry Smith /*MC
609bd481603SBarry Smith    MatPreallocateSet - Indicates the locations (rows and columns) in the matrix where nonzeros will be
610bd481603SBarry Smith        inserted using a local number of the rows and columns
611bd481603SBarry Smith 
612bd481603SBarry Smith    Synopsis:
613bd481603SBarry Smith    int MatPreallocateSet(int nrows, int *rows,int ncols, int *cols,int *dnz, int *onz)
614bd481603SBarry Smith 
615bd481603SBarry Smith    Not Collective
616bd481603SBarry Smith 
617bd481603SBarry Smith    Input Parameters:
618bd481603SBarry Smith +  nrows - the number of rows indicated
619bd481603SBarry Smith .  rows - the indices of the rows (these will be mapped in the
620bd481603SBarry Smith .  ncols - the number of columns in the matrix
621bd481603SBarry Smith .  cols - the columns indicated
622bd481603SBarry Smith .  dnz - the array that will be passed to the matrix preallocation routines
623bd481603SBarry Smith -  ozn - the other array passed to the matrix preallocation routines
624bd481603SBarry Smith 
625bd481603SBarry Smith 
626bd481603SBarry Smith    Level: intermediate
627bd481603SBarry Smith 
628bd481603SBarry Smith    Notes:
629bd481603SBarry Smith    See the chapter in the users manual on performance for more details
630bd481603SBarry Smith 
631bd481603SBarry Smith    Do not malloc or free dnz and onz that is handled internally by these routines
632bd481603SBarry Smith 
633bd481603SBarry Smith   Concepts: preallocation^Matrix
634bd481603SBarry Smith 
635bd481603SBarry Smith .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateInitialize(),
636bd481603SBarry Smith           MatPreallocateInitialize(), MatPreallocateSymmetricSetLocal(), MatPreallocateSetLocal()
637bd481603SBarry Smith M*/
638c4f061fbSSatish Balay #define MatPreallocateSet(row,nc,cols,dnz,onz) 0;\
6397c922b88SBarry Smith { int __i; \
6407c922b88SBarry Smith   for (__i=0; __i<nc; __i++) {\
6417c922b88SBarry Smith     if (cols[__i] < __start || cols[__i] >= __end) onz[row - __rstart]++; \
6427c922b88SBarry Smith   }\
6437c922b88SBarry Smith   dnz[row - __rstart] = nc - onz[row - __rstart];\
6447c922b88SBarry Smith }
6457c922b88SBarry Smith 
646bd481603SBarry Smith /*MC
647bd481603SBarry Smith    MatPreallocateSymmetricSet - Indicates the locations (rows and columns) in the matrix where nonzeros will be
648bd481603SBarry Smith        inserted using a local number of the rows and columns
649bd481603SBarry Smith 
650bd481603SBarry Smith    Synopsis:
651bd481603SBarry Smith    int MatPreallocateSymmetricSet(int nrows, int *rows,int ncols, int *cols,int *dnz, int *onz)
652bd481603SBarry Smith 
653bd481603SBarry Smith    Not Collective
654bd481603SBarry Smith 
655bd481603SBarry Smith    Input Parameters:
656bd481603SBarry Smith +  nrows - the number of rows indicated
657bd481603SBarry Smith .  rows - the indices of the rows (these will be mapped in the
658bd481603SBarry Smith .  ncols - the number of columns in the matrix
659bd481603SBarry Smith .  cols - the columns indicated
660bd481603SBarry Smith .  dnz - the array that will be passed to the matrix preallocation routines
661bd481603SBarry Smith -  ozn - the other array passed to the matrix preallocation routines
662bd481603SBarry Smith 
663bd481603SBarry Smith 
664bd481603SBarry Smith    Level: intermediate
665bd481603SBarry Smith 
666bd481603SBarry Smith    Notes:
667bd481603SBarry Smith    See the chapter in the users manual on performance for more details
668bd481603SBarry Smith 
669bd481603SBarry Smith    Do not malloc or free dnz and onz that is handled internally by these routines
670bd481603SBarry Smith 
671bd481603SBarry Smith   Concepts: preallocation^Matrix
672bd481603SBarry Smith 
673bd481603SBarry Smith .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateInitialize(),
674bd481603SBarry Smith           MatPreallocateInitialize(), MatPreallocateSymmetricSetLocal(), MatPreallocateSetLocal()
675bd481603SBarry Smith M*/
676d3d32019SBarry Smith #define MatPreallocateSymmetricSet(row,nc,cols,dnz,onz) 0;\
677d3d32019SBarry Smith { int __i; \
678d3d32019SBarry Smith   for (__i=0; __i<nc; __i++) {\
679d3d32019SBarry Smith     if (cols[__i] >= __end) onz[row - __rstart]++; \
680d3d32019SBarry Smith     else if (cols[__i] >= row) dnz[row - __rstart]++;\
681d3d32019SBarry Smith   }\
682d3d32019SBarry Smith }
683d3d32019SBarry Smith 
684bd481603SBarry Smith /*MC
685bd481603SBarry Smith    MatPreallocFinalize - Ends the block of code that will count the number of nonzeros per
686bd481603SBarry Smith        row in a matrix providing the data that one can use to correctly preallocate the matrix.
687bd481603SBarry Smith 
688bd481603SBarry Smith    Synopsis:
689bd481603SBarry Smith    int MatPreallocateFinalize(int *dnz, int *onz)
690bd481603SBarry Smith 
691bd481603SBarry Smith    Collective on MPI_Comm
692bd481603SBarry Smith 
693bd481603SBarry Smith    Input Parameters:
694bd481603SBarry Smith +  dnz - the array that will be passed to the matrix preallocation routines
695bd481603SBarry Smith -  ozn - the other array passed to the matrix preallocation routines
696bd481603SBarry Smith 
697bd481603SBarry Smith 
698bd481603SBarry Smith    Level: intermediate
699bd481603SBarry Smith 
700bd481603SBarry Smith    Notes:
701bd481603SBarry Smith    See the chapter in the users manual on performance for more details
702bd481603SBarry Smith 
703bd481603SBarry Smith    Do not malloc or free dnz and onz that is handled internally by these routines
704bd481603SBarry Smith 
705bd481603SBarry Smith   Concepts: preallocation^Matrix
706bd481603SBarry Smith 
707bd481603SBarry Smith .seealso: MatPreallocateInitialize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateSetLocal(),
708bd481603SBarry Smith           MatPreallocateSymmetricInitialize(), MatPreallocateSymmetricSetLocal()
709bd481603SBarry Smith M*/
710ef66eb69SBarry Smith #define MatPreallocateFinalize(dnz,onz) 0;_4_ierr = PetscFree(dnz);CHKERRQ(_4_ierr);}
7117c922b88SBarry Smith 
712bd481603SBarry Smith 
713bd481603SBarry Smith 
7147b80b807SBarry Smith /* Routines unique to particular data structures */
715435da068SBarry Smith EXTERN int MatShellGetContext(Mat,void **);
716435da068SBarry Smith 
717268466fbSBarry Smith EXTERN int MatBDiagGetData(Mat,int*,int*,int*[],int*[],PetscScalar***);
718ca01db9bSBarry Smith EXTERN int MatSeqAIJSetColumnIndices(Mat,int[]);
719ca01db9bSBarry Smith EXTERN int MatSeqBAIJSetColumnIndices(Mat,int[]);
720ca01db9bSBarry Smith EXTERN int MatCreateSeqAIJWithArrays(MPI_Comm,int,int,int[],int[],PetscScalar[],Mat*);
7217b80b807SBarry Smith 
722ca01db9bSBarry Smith EXTERN int MatSeqBAIJSetPreallocation(Mat,int,int,const int[]);
723ca01db9bSBarry Smith EXTERN int MatSeqSBAIJSetPreallocation(Mat,int,int,const int[]);
724ca01db9bSBarry Smith EXTERN int MatSeqAIJSetPreallocation(Mat,int,const int[]);
725ca01db9bSBarry Smith EXTERN int MatSeqDensePreallocation(Mat,PetscScalar[]);
726ca01db9bSBarry Smith EXTERN int MatSeqBDiagSetPreallocation(Mat,int,int,const int[],PetscScalar*[]);
727ca01db9bSBarry Smith EXTERN int MatSeqDenseSetPreallocation(Mat,PetscScalar[]);
728273d9f13SBarry Smith 
729ca01db9bSBarry Smith EXTERN int MatMPIBAIJSetPreallocation(Mat,int,int,const int[],int,const int[]);
730ca01db9bSBarry Smith EXTERN int MatMPISBAIJSetPreallocation(Mat,int,int,const int[],int,const int[]);
731ca01db9bSBarry Smith EXTERN int MatMPIAIJSetPreallocation(Mat,int,const int[],int,const int[]);
732ca01db9bSBarry Smith EXTERN int MatMPIDensePreallocation(Mat,PetscScalar[]);
733ca01db9bSBarry Smith EXTERN int MatMPIBDiagSetPreallocation(Mat,int,int,const int[],PetscScalar*[]);
734ca01db9bSBarry Smith EXTERN int MatMPIAdjSetPreallocation(Mat,int[],int[],int[]);
735ca01db9bSBarry Smith EXTERN int MatMPIDenseSetPreallocation(Mat,PetscScalar[]);
736ca01db9bSBarry Smith EXTERN int MatMPIRowbsSetPreallocation(Mat,int,const int[]);
737268466fbSBarry Smith EXTERN int MatMPIAIJGetSeqAIJ(Mat,Mat*,Mat*,int*[]);
738268466fbSBarry Smith EXTERN int MatMPIBAIJGetSeqBAIJ(Mat,Mat*,Mat*,int*[]);
7393a7fca6bSBarry Smith EXTERN int MatAdicSetLocalFunction(Mat,void (*)(void));
740273d9f13SBarry Smith 
7411b807ce4Svictorle EXTERN int MatSeqDenseSetLDA(Mat,int);
7421b807ce4Svictorle 
743ca44d042SBarry Smith EXTERN int MatStoreValues(Mat);
744ca44d042SBarry Smith EXTERN int MatRetrieveValues(Mat);
7452e8a6d31SBarry Smith 
7463a7fca6bSBarry Smith EXTERN int MatDAADSetCtx(Mat,void*);
7473a7fca6bSBarry Smith 
7487b80b807SBarry Smith /*
7497b80b807SBarry Smith   These routines are not usually accessed directly, rather solving is
7507b80b807SBarry Smith   done through the SLES, KSP and PC interfaces.
7517b80b807SBarry Smith */
7527b80b807SBarry Smith 
753d9274352SBarry Smith /*E
754d9274352SBarry Smith     MatOrderingType - String with the name of a PETSc matrix ordering or the creation function
755d9274352SBarry Smith        with an optional dynamic library name, for example
756d9274352SBarry Smith        http://www.mcs.anl.gov/petsc/lib.a:orderingcreate()
757d9274352SBarry Smith 
758d9274352SBarry Smith    Level: beginner
759d9274352SBarry Smith 
760d9274352SBarry Smith .seealso: MatGetOrdering()
761d9274352SBarry Smith E*/
762b12f92e5SBarry Smith typedef char* MatOrderingType;
763b12f92e5SBarry Smith #define MATORDERING_NATURAL   "natural"
764b12f92e5SBarry Smith #define MATORDERING_ND        "nd"
765b12f92e5SBarry Smith #define MATORDERING_1WD       "1wd"
766b12f92e5SBarry Smith #define MATORDERING_RCM       "rcm"
767b12f92e5SBarry Smith #define MATORDERING_QMD       "qmd"
768b12f92e5SBarry Smith #define MATORDERING_ROWLENGTH "rowlength"
76962152c8bSBarry Smith #define MATORDERING_DSC_ND    "dsc_nd"
77062152c8bSBarry Smith #define MATORDERING_DSC_MMD   "dsc_mmd"
77162152c8bSBarry Smith #define MATORDERING_DSC_MDF   "dsc_mdf"
772c06d978dSMatthew Knepley #define MATORDERING_CONSTRAINED "constrained"
773c06d978dSMatthew Knepley #define MATORDERING_IDENTITY  "identity"
774c06d978dSMatthew Knepley #define MATORDERING_REVERSE   "reverse"
775b12f92e5SBarry Smith 
776ca44d042SBarry Smith EXTERN int MatGetOrdering(Mat,MatOrderingType,IS*,IS*);
777ca44d042SBarry Smith EXTERN int MatOrderingRegister(char*,char*,char*,int(*)(Mat,MatOrderingType,IS*,IS*));
77830de9b25SBarry Smith 
77930de9b25SBarry Smith /*MC
78030de9b25SBarry Smith    MatOrderingRegisterDynamic - Adds a new sparse matrix ordering to the
78130de9b25SBarry Smith                                matrix package.
78230de9b25SBarry Smith 
78330de9b25SBarry Smith    Synopsis:
78430de9b25SBarry Smith    int MatOrderingRegisterDynamic(char *name_ordering,char *path,char *name_create,int (*routine_create)(MatOrdering))
78530de9b25SBarry Smith 
78630de9b25SBarry Smith    Not Collective
78730de9b25SBarry Smith 
78830de9b25SBarry Smith    Input Parameters:
78930de9b25SBarry Smith +  sname - name of ordering (for example MATORDERING_ND)
79030de9b25SBarry Smith .  path - location of library where creation routine is
79130de9b25SBarry Smith .  name - name of function that creates the ordering type,a string
79230de9b25SBarry Smith -  function - function pointer that creates the ordering
79330de9b25SBarry Smith 
79430de9b25SBarry Smith    Level: developer
79530de9b25SBarry Smith 
79630de9b25SBarry Smith    If dynamic libraries are used, then the fourth input argument (function)
79730de9b25SBarry Smith    is ignored.
79830de9b25SBarry Smith 
79930de9b25SBarry Smith    Sample usage:
80030de9b25SBarry Smith .vb
80130de9b25SBarry Smith    MatOrderingRegisterDynamic("my_order",/home/username/my_lib/lib/libO/solaris/mylib.a,
80230de9b25SBarry Smith                "MyOrder",MyOrder);
80330de9b25SBarry Smith .ve
80430de9b25SBarry Smith 
80530de9b25SBarry Smith    Then, your partitioner can be chosen with the procedural interface via
80630de9b25SBarry Smith $     MatOrderingSetType(part,"my_order)
80730de9b25SBarry Smith    or at runtime via the option
80830de9b25SBarry Smith $     -pc_ilu_mat_ordering_type my_order
80930de9b25SBarry Smith $     -pc_lu_mat_ordering_type my_order
81030de9b25SBarry Smith 
81130de9b25SBarry Smith    ${PETSC_ARCH} and ${BOPT} occuring in pathname will be replaced with appropriate values.
81230de9b25SBarry Smith 
81330de9b25SBarry Smith .keywords: matrix, ordering, register
81430de9b25SBarry Smith 
81530de9b25SBarry Smith .seealso: MatOrderingRegisterDestroy(), MatOrderingRegisterAll()
81630de9b25SBarry Smith M*/
817aa482453SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
818f1af5d2fSBarry Smith #define MatOrderingRegisterDynamic(a,b,c,d) MatOrderingRegister(a,b,c,0)
819b12f92e5SBarry Smith #else
820f1af5d2fSBarry Smith #define MatOrderingRegisterDynamic(a,b,c,d) MatOrderingRegister(a,b,c,d)
821b12f92e5SBarry Smith #endif
82230de9b25SBarry Smith 
823ca44d042SBarry Smith EXTERN int        MatOrderingRegisterDestroy(void);
824ca44d042SBarry Smith EXTERN int        MatOrderingRegisterAll(char*);
8252bad1931SBarry Smith extern PetscTruth MatOrderingRegisterAllCalled;
826b0a32e0cSBarry Smith extern PetscFList MatOrderingList;
827d4fbbf0eSBarry Smith 
82887828ca2SBarry Smith EXTERN int MatReorderForNonzeroDiagonal(Mat,PetscReal,IS,IS);
829a2ce50c7SBarry Smith 
830d91e6319SBarry Smith /*S
83115e8a5b3SHong Zhang    MatFactorInfo - Data based into the matrix factorization routines
832b00f7748SHong Zhang 
83315e8a5b3SHong Zhang    In Fortran these are simply double precision arrays of size MAT_FACTORINFO_SIZE
834b00f7748SHong Zhang 
83515e8a5b3SHong Zhang    Notes: These are not usually directly used by users, instead use PC type of LU, ILU, CHOLESKY or ICC.
836b00f7748SHong Zhang 
837b00f7748SHong Zhang    Level: developer
838b00f7748SHong Zhang 
839b380c88cSHong Zhang .seealso: MatLUFactorSymbolic(), MatILUFactorSymbolic(), MatCholeskyFactorSymbolic(), MatICCFactorSymbolic(), MatICCFactor()
840b00f7748SHong Zhang 
841b00f7748SHong Zhang S*/
842b00f7748SHong Zhang typedef struct {
84315e8a5b3SHong Zhang   PetscReal     damping;        /* scaling of identity added to matrix to prevent zero pivots */
8442cea7109SBarry Smith   PetscReal     shift;          /* if true, shift until positive pivots */
8452cea7109SBarry Smith   PetscReal     shift_fraction; /* record shift fraction taken */
84615e8a5b3SHong Zhang   PetscReal     diagonal_fill;  /* force diagonal to fill in if initially not filled */
84715e8a5b3SHong Zhang   PetscReal     dt;             /* drop tolerance */
848b00f7748SHong Zhang   PetscReal     dtcol;          /* tolerance for pivoting */
84915e8a5b3SHong Zhang   PetscReal     dtcount;        /* maximum nonzeros to be allowed per row */
850f6275e2eSBarry Smith   PetscReal     fill;           /* expected fill; nonzeros in factored matrix/nonzeros in original matrix*/
851348344bbSBarry Smith   PetscReal     levels;         /* ICC/ILU(levels) */
852bcd9e38bSBarry Smith   PetscReal     pivotinblocks;  /* for BAIJ and SBAIJ matrices pivot in factorization on blocks, default 1.0
853bcd9e38bSBarry Smith                                    factorization may be faster if do not pivot */
85415e8a5b3SHong Zhang   PetscReal     zeropivot;      /* pivot is called zero if less than this */
85515e8a5b3SHong Zhang } MatFactorInfo;
856ffa6d0a5SLois Curfman McInnes 
85715e8a5b3SHong Zhang EXTERN int MatCholeskyFactor(Mat,IS,MatFactorInfo*);
85815e8a5b3SHong Zhang EXTERN int MatCholeskyFactorSymbolic(Mat,IS,MatFactorInfo*,Mat*);
85915e8a5b3SHong Zhang EXTERN int MatCholeskyFactorNumeric(Mat,Mat*);
860b380c88cSHong Zhang EXTERN int MatLUFactor(Mat,IS,IS,MatFactorInfo*);
861b380c88cSHong Zhang EXTERN int MatILUFactor(Mat,IS,IS,MatFactorInfo*);
862b380c88cSHong Zhang EXTERN int MatLUFactorSymbolic(Mat,IS,IS,MatFactorInfo*,Mat*);
863b380c88cSHong Zhang EXTERN int MatILUFactorSymbolic(Mat,IS,IS,MatFactorInfo*,Mat*);
86415e8a5b3SHong Zhang EXTERN int MatICCFactorSymbolic(Mat,IS,MatFactorInfo*,Mat*);
86515e8a5b3SHong Zhang EXTERN int MatICCFactor(Mat,IS,MatFactorInfo*);
866ca44d042SBarry Smith EXTERN int MatLUFactorNumeric(Mat,Mat*);
867b380c88cSHong Zhang EXTERN int MatILUDTFactor(Mat,MatFactorInfo*,IS,IS,Mat *);
8683e0d88b5SBarry Smith EXTERN int MatGetInertia(Mat,int*,int*,int*);
869ca44d042SBarry Smith EXTERN int MatSolve(Mat,Vec,Vec);
870ca44d042SBarry Smith EXTERN int MatForwardSolve(Mat,Vec,Vec);
871ca44d042SBarry Smith EXTERN int MatBackwardSolve(Mat,Vec,Vec);
872ca44d042SBarry Smith EXTERN int MatSolveAdd(Mat,Vec,Vec,Vec);
873ca44d042SBarry Smith EXTERN int MatSolveTranspose(Mat,Vec,Vec);
874ca44d042SBarry Smith EXTERN int MatSolveTransposeAdd(Mat,Vec,Vec,Vec);
875d59c15a7SBarry Smith EXTERN int MatSolves(Mat,Vecs,Vecs);
8768ed539a5SBarry Smith 
877ca44d042SBarry Smith EXTERN int MatSetUnfactored(Mat);
878bb5a7306SBarry Smith 
879d91e6319SBarry Smith /*E
880d91e6319SBarry Smith     MatSORType - What type of (S)SOR to perform
881bb1eb677SSatish Balay 
882d91e6319SBarry Smith     Level: beginner
883d91e6319SBarry Smith 
884d9274352SBarry Smith    May be bitwise ORd together
885d9274352SBarry Smith 
886d91e6319SBarry Smith    Any additions/changes here MUST also be made in include/finclude/petscmat.h
887d91e6319SBarry Smith 
8884e7234bfSBarry Smith    MatSORType may be bitwise ORd together, so do not change the numbers
8894e7234bfSBarry Smith 
890d91e6319SBarry Smith .seealso: MatRelax()
891d91e6319SBarry Smith E*/
892ee50ffe9SBarry Smith typedef enum {SOR_FORWARD_SWEEP=1,SOR_BACKWARD_SWEEP=2,SOR_SYMMETRIC_SWEEP=3,
893ee50ffe9SBarry Smith               SOR_LOCAL_FORWARD_SWEEP=4,SOR_LOCAL_BACKWARD_SWEEP=8,
894ee50ffe9SBarry Smith               SOR_LOCAL_SYMMETRIC_SWEEP=12,SOR_ZERO_INITIAL_GUESS=16,
89584cb2905SBarry Smith               SOR_EISENSTAT=32,SOR_APPLY_UPPER=64,SOR_APPLY_LOWER=128} MatSORType;
896c14dc6b6SHong Zhang EXTERN int MatRelax(Mat,Vec,PetscReal,MatSORType,PetscReal,int,int,Vec);
8978ed539a5SBarry Smith 
898d4fbbf0eSBarry Smith /*
899639f9d9dSBarry Smith     These routines are for efficiently computing Jacobians via finite differences.
900639f9d9dSBarry Smith */
901b12f92e5SBarry Smith 
902d9274352SBarry Smith /*E
903d9274352SBarry Smith     MatColoringType - String with the name of a PETSc matrix coloring or the creation function
904d9274352SBarry Smith        with an optional dynamic library name, for example
905d9274352SBarry Smith        http://www.mcs.anl.gov/petsc/lib.a:coloringcreate()
906d9274352SBarry Smith 
907d9274352SBarry Smith    Level: beginner
908d9274352SBarry Smith 
909d9274352SBarry Smith .seealso: MatGetColoring()
910d9274352SBarry Smith E*/
911b12f92e5SBarry Smith typedef char* MatColoringType;
912b12f92e5SBarry Smith #define MATCOLORING_NATURAL "natural"
913b12f92e5SBarry Smith #define MATCOLORING_SL      "sl"
914b12f92e5SBarry Smith #define MATCOLORING_LF      "lf"
915b12f92e5SBarry Smith #define MATCOLORING_ID      "id"
916b12f92e5SBarry Smith 
917ca44d042SBarry Smith EXTERN int MatGetColoring(Mat,MatColoringType,ISColoring*);
918ca44d042SBarry Smith EXTERN int MatColoringRegister(char*,char*,char*,int(*)(Mat,MatColoringType,ISColoring *));
91930de9b25SBarry Smith 
92030de9b25SBarry Smith /*MC
92130de9b25SBarry Smith    MatColoringRegisterDynamic - Adds a new sparse matrix coloring to the
92230de9b25SBarry Smith                                matrix package.
92330de9b25SBarry Smith 
92430de9b25SBarry Smith    Synopsis:
92530de9b25SBarry Smith    int MatColoringRegisterDynamic(char *name_coloring,char *path,char *name_create,int (*routine_create)(MatColoring))
92630de9b25SBarry Smith 
92730de9b25SBarry Smith    Not Collective
92830de9b25SBarry Smith 
92930de9b25SBarry Smith    Input Parameters:
93030de9b25SBarry Smith +  sname - name of Coloring (for example MATCOLORING_SL)
93130de9b25SBarry Smith .  path - location of library where creation routine is
93230de9b25SBarry Smith .  name - name of function that creates the Coloring type, a string
93330de9b25SBarry Smith -  function - function pointer that creates the coloring
93430de9b25SBarry Smith 
93530de9b25SBarry Smith    Level: developer
93630de9b25SBarry Smith 
93730de9b25SBarry Smith    If dynamic libraries are used, then the fourth input argument (function)
93830de9b25SBarry Smith    is ignored.
93930de9b25SBarry Smith 
94030de9b25SBarry Smith    Sample usage:
94130de9b25SBarry Smith .vb
94230de9b25SBarry Smith    MatColoringRegisterDynamic("my_color",/home/username/my_lib/lib/libO/solaris/mylib.a,
94330de9b25SBarry Smith                "MyColor",MyColor);
94430de9b25SBarry Smith .ve
94530de9b25SBarry Smith 
94630de9b25SBarry Smith    Then, your partitioner can be chosen with the procedural interface via
94730de9b25SBarry Smith $     MatColoringSetType(part,"my_color")
94830de9b25SBarry Smith    or at runtime via the option
94930de9b25SBarry Smith $     -mat_coloring_type my_color
95030de9b25SBarry Smith 
95130de9b25SBarry Smith    $PETSC_ARCH and $BOPT occuring in pathname will be replaced with appropriate values.
95230de9b25SBarry Smith 
95330de9b25SBarry Smith .keywords: matrix, Coloring, register
95430de9b25SBarry Smith 
95530de9b25SBarry Smith .seealso: MatColoringRegisterDestroy(), MatColoringRegisterAll()
95630de9b25SBarry Smith M*/
957aa482453SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
958f1af5d2fSBarry Smith #define MatColoringRegisterDynamic(a,b,c,d) MatColoringRegister(a,b,c,0)
959b12f92e5SBarry Smith #else
960f1af5d2fSBarry Smith #define MatColoringRegisterDynamic(a,b,c,d) MatColoringRegister(a,b,c,d)
961b12f92e5SBarry Smith #endif
96230de9b25SBarry Smith 
963ca44d042SBarry Smith EXTERN int        MatColoringRegisterAll(char *);
9642bad1931SBarry Smith extern PetscTruth MatColoringRegisterAllCalled;
965ca44d042SBarry Smith EXTERN int        MatColoringRegisterDestroy(void);
9664e7234bfSBarry Smith EXTERN int        MatColoringPatch(Mat,int,int,const ISColoringValue[],ISColoring*);
967639f9d9dSBarry Smith 
968d9274352SBarry Smith /*S
969d9274352SBarry Smith      MatFDColoring - Object for computing a sparse Jacobian via finite differences
970d9274352SBarry Smith         and coloring
971639f9d9dSBarry Smith 
972d9274352SBarry Smith    Level: beginner
973d9274352SBarry Smith 
974d9274352SBarry Smith   Concepts: coloring, sparse Jacobian, finite differences
975d9274352SBarry Smith 
976d9274352SBarry Smith .seealso:  MatFDColoringCreate()
977d9274352SBarry Smith S*/
978e2a1c21fSSatish Balay typedef struct _p_MatFDColoring *MatFDColoring;
979639f9d9dSBarry Smith 
980ca44d042SBarry Smith EXTERN int MatFDColoringCreate(Mat,ISColoring,MatFDColoring *);
981ca44d042SBarry Smith EXTERN int MatFDColoringDestroy(MatFDColoring);
982b0a32e0cSBarry Smith EXTERN int MatFDColoringView(MatFDColoring,PetscViewer);
983ca44d042SBarry Smith EXTERN int MatFDColoringSetFunction(MatFDColoring,int (*)(void),void*);
98487828ca2SBarry Smith EXTERN int MatFDColoringSetParameters(MatFDColoring,PetscReal,PetscReal);
985ca44d042SBarry Smith EXTERN int MatFDColoringSetFrequency(MatFDColoring,int);
986ca44d042SBarry Smith EXTERN int MatFDColoringGetFrequency(MatFDColoring,int*);
987ca44d042SBarry Smith EXTERN int MatFDColoringSetFromOptions(MatFDColoring);
988ca44d042SBarry Smith EXTERN int MatFDColoringApply(Mat,MatFDColoring,Vec,MatStructure*,void *);
98987828ca2SBarry Smith EXTERN int MatFDColoringApplyTS(Mat,MatFDColoring,PetscReal,Vec,MatStructure*,void *);
99062152c8bSBarry Smith EXTERN int MatFDColoringSetRecompute(MatFDColoring);
9913a7fca6bSBarry Smith EXTERN int MatFDColoringSetF(MatFDColoring,Vec);
9924e7234bfSBarry Smith EXTERN int MatFDColoringGetPerturbedColumns(MatFDColoring,int*,int*[]);
993639f9d9dSBarry Smith /*
9940752156aSBarry Smith     These routines are for partitioning matrices: currently used only
9953eda8832SBarry Smith   for adjacency matrix, MatCreateMPIAdj().
9960752156aSBarry Smith */
997ca161407SBarry Smith 
998d9274352SBarry Smith /*S
999d9274352SBarry Smith      MatPartitioning - Object for managing the partitioning of a matrix or graph
1000d9274352SBarry Smith 
1001d9274352SBarry Smith    Level: beginner
1002d9274352SBarry Smith 
1003d9274352SBarry Smith   Concepts: partitioning
1004d9274352SBarry Smith 
1005743a1026Svictorle .seealso:  MatPartitioningCreate(), MatPartitioningType
1006d9274352SBarry Smith S*/
100791e9ee9fSBarry Smith typedef struct _p_MatPartitioning *MatPartitioning;
1008d9274352SBarry Smith 
1009d9274352SBarry Smith /*E
10105bc6e7ccSvictorle     MatPartitioningType - String with the name of a PETSc matrix partitioning or the creation function
1011d9274352SBarry Smith        with an optional dynamic library name, for example
1012d9274352SBarry Smith        http://www.mcs.anl.gov/petsc/lib.a:partitioningcreate()
1013d9274352SBarry Smith 
1014d9274352SBarry Smith    Level: beginner
1015d9274352SBarry Smith 
1016b547a13bSvictorle .seealso: MatPartitioningCreate(), MatPartitioning
1017d9274352SBarry Smith E*/
10182aabb6bbSBarry Smith typedef char* MatPartitioningType;
10198ba1e511SMatthew Knepley #define MAT_PARTITIONING_CURRENT  "current"
10208ba1e511SMatthew Knepley #define MAT_PARTITIONING_PARMETIS "parmetis"
1021ca161407SBarry Smith 
1022ca44d042SBarry Smith EXTERN int MatPartitioningCreate(MPI_Comm,MatPartitioning*);
1023ca44d042SBarry Smith EXTERN int MatPartitioningSetType(MatPartitioning,MatPartitioningType);
10245bc6e7ccSvictorle EXTERN int MatPartitioningSetNParts(MatPartitioning,int);
1025ca44d042SBarry Smith EXTERN int MatPartitioningSetAdjacency(MatPartitioning,Mat);
10264e7234bfSBarry Smith EXTERN int MatPartitioningSetVertexWeights(MatPartitioning,const int[]);
10274e7234bfSBarry Smith EXTERN int MatPartitioningSetPartitionWeights(MatPartitioning,const PetscReal []);
1028ca44d042SBarry Smith EXTERN int MatPartitioningApply(MatPartitioning,IS*);
1029ca44d042SBarry Smith EXTERN int MatPartitioningDestroy(MatPartitioning);
10302aabb6bbSBarry Smith 
1031ca44d042SBarry Smith EXTERN int MatPartitioningRegister(char*,char*,char*,int(*)(MatPartitioning));
103230de9b25SBarry Smith 
103330de9b25SBarry Smith /*MC
103430de9b25SBarry Smith    MatPartitioningRegisterDynamic - Adds a new sparse matrix partitioning to the
103530de9b25SBarry Smith    matrix package.
103630de9b25SBarry Smith 
103730de9b25SBarry Smith    Synopsis:
103830de9b25SBarry Smith    int MatPartitioningRegisterDynamic(char *name_partitioning,char *path,char *name_create,int (*routine_create)(MatPartitioning))
103930de9b25SBarry Smith 
104030de9b25SBarry Smith    Not Collective
104130de9b25SBarry Smith 
104230de9b25SBarry Smith    Input Parameters:
104330de9b25SBarry Smith +  sname - name of partitioning (for example MAT_PARTITIONING_CURRENT) or parmetis
104430de9b25SBarry Smith .  path - location of library where creation routine is
104530de9b25SBarry Smith .  name - name of function that creates the partitioning type, a string
104630de9b25SBarry Smith -  function - function pointer that creates the partitioning type
104730de9b25SBarry Smith 
104830de9b25SBarry Smith    Level: developer
104930de9b25SBarry Smith 
105030de9b25SBarry Smith    If dynamic libraries are used, then the fourth input argument (function)
105130de9b25SBarry Smith    is ignored.
105230de9b25SBarry Smith 
105330de9b25SBarry Smith    Sample usage:
105430de9b25SBarry Smith .vb
105530de9b25SBarry Smith    MatPartitioningRegisterDynamic("my_part",/home/username/my_lib/lib/libO/solaris/mylib.a,
105630de9b25SBarry Smith                "MyPartCreate",MyPartCreate);
105730de9b25SBarry Smith .ve
105830de9b25SBarry Smith 
105930de9b25SBarry Smith    Then, your partitioner can be chosen with the procedural interface via
106030de9b25SBarry Smith $     MatPartitioningSetType(part,"my_part")
106130de9b25SBarry Smith    or at runtime via the option
106230de9b25SBarry Smith $     -mat_partitioning_type my_part
106330de9b25SBarry Smith 
106430de9b25SBarry Smith    $PETSC_ARCH and $BOPT occuring in pathname will be replaced with appropriate values.
106530de9b25SBarry Smith 
106630de9b25SBarry Smith .keywords: matrix, partitioning, register
106730de9b25SBarry Smith 
106830de9b25SBarry Smith .seealso: MatPartitioningRegisterDestroy(), MatPartitioningRegisterAll()
106930de9b25SBarry Smith M*/
1070aa482453SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
1071f1af5d2fSBarry Smith #define MatPartitioningRegisterDynamic(a,b,c,d) MatPartitioningRegister(a,b,c,0)
10722aabb6bbSBarry Smith #else
1073f1af5d2fSBarry Smith #define MatPartitioningRegisterDynamic(a,b,c,d) MatPartitioningRegister(a,b,c,d)
10742aabb6bbSBarry Smith #endif
10752aabb6bbSBarry Smith 
1076ca44d042SBarry Smith EXTERN int        MatPartitioningRegisterAll(char *);
10772bad1931SBarry Smith extern PetscTruth MatPartitioningRegisterAllCalled;
1078ca44d042SBarry Smith EXTERN int        MatPartitioningRegisterDestroy(void);
10792bad1931SBarry Smith 
1080b0a32e0cSBarry Smith EXTERN int MatPartitioningView(MatPartitioning,PetscViewer);
1081ca44d042SBarry Smith EXTERN int MatPartitioningSetFromOptions(MatPartitioning);
1082ca44d042SBarry Smith EXTERN int MatPartitioningGetType(MatPartitioning,MatPartitioningType*);
1083ca161407SBarry Smith 
1084ca44d042SBarry Smith EXTERN int MatPartitioningParmetisSetCoarseSequential(MatPartitioning);
10850752156aSBarry Smith 
10860752156aSBarry Smith /*
10870a835dfdSSatish Balay     If you add entries here you must also add them to finclude/petscmat.h
1088d4fbbf0eSBarry Smith */
10891c1c02c0SLois Curfman McInnes typedef enum { MATOP_SET_VALUES=0,
10901c1c02c0SLois Curfman McInnes                MATOP_GET_ROW=1,
10911c1c02c0SLois Curfman McInnes                MATOP_RESTORE_ROW=2,
10921c1c02c0SLois Curfman McInnes                MATOP_MULT=3,
10931c1c02c0SLois Curfman McInnes                MATOP_MULT_ADD=4,
10947c922b88SBarry Smith                MATOP_MULT_TRANSPOSE=5,
10957c922b88SBarry Smith                MATOP_MULT_TRANSPOSE_ADD=6,
10961c1c02c0SLois Curfman McInnes                MATOP_SOLVE=7,
10971c1c02c0SLois Curfman McInnes                MATOP_SOLVE_ADD=8,
10987c922b88SBarry Smith                MATOP_SOLVE_TRANSPOSE=9,
10997c922b88SBarry Smith                MATOP_SOLVE_TRANSPOSE_ADD=10,
11001c1c02c0SLois Curfman McInnes                MATOP_LUFACTOR=11,
11011c1c02c0SLois Curfman McInnes                MATOP_CHOLESKYFACTOR=12,
11021c1c02c0SLois Curfman McInnes                MATOP_RELAX=13,
11031c1c02c0SLois Curfman McInnes                MATOP_TRANSPOSE=14,
11041c1c02c0SLois Curfman McInnes                MATOP_GETINFO=15,
11051c1c02c0SLois Curfman McInnes                MATOP_EQUAL=16,
11061c1c02c0SLois Curfman McInnes                MATOP_GET_DIAGONAL=17,
11071c1c02c0SLois Curfman McInnes                MATOP_DIAGONAL_SCALE=18,
11081c1c02c0SLois Curfman McInnes                MATOP_NORM=19,
11091c1c02c0SLois Curfman McInnes                MATOP_ASSEMBLY_BEGIN=20,
11101c1c02c0SLois Curfman McInnes                MATOP_ASSEMBLY_END=21,
11111c1c02c0SLois Curfman McInnes                MATOP_COMPRESS=22,
11121c1c02c0SLois Curfman McInnes                MATOP_SET_OPTION=23,
11131c1c02c0SLois Curfman McInnes                MATOP_ZERO_ENTRIES=24,
11141c1c02c0SLois Curfman McInnes                MATOP_ZERO_ROWS=25,
11151c1c02c0SLois Curfman McInnes                MATOP_LUFACTOR_SYMBOLIC=26,
11161c1c02c0SLois Curfman McInnes                MATOP_LUFACTOR_NUMERIC=27,
11171c1c02c0SLois Curfman McInnes                MATOP_CHOLESKY_FACTOR_SYMBOLIC=28,
11181c1c02c0SLois Curfman McInnes                MATOP_CHOLESKY_FACTOR_NUMERIC=29,
1119d643ce63SMatthew Knepley                MATOP_SETUP_PREALLOCATION=30,
1120d643ce63SMatthew Knepley                MATOP_ILUFACTOR_SYMBOLIC=31,
1121d643ce63SMatthew Knepley                MATOP_ICCFACTOR_SYMBOLIC=32,
1122d643ce63SMatthew Knepley                MATOP_GET_ARRAY=33,
1123d643ce63SMatthew Knepley                MATOP_RESTORE_ARRAY=34,
1124d643ce63SMatthew Knepley                MATOP_DUPLCIATE=35,
1125d643ce63SMatthew Knepley                MATOP_FORWARD_SOLVE=36,
1126d643ce63SMatthew Knepley                MATOP_BACKWARD_SOLVE=37,
1127d643ce63SMatthew Knepley                MATOP_ILUFACTOR=38,
1128d643ce63SMatthew Knepley                MATOP_ICCFACTOR=39,
1129d643ce63SMatthew Knepley                MATOP_AXPY=40,
1130d643ce63SMatthew Knepley                MATOP_GET_SUBMATRICES=41,
1131d643ce63SMatthew Knepley                MATOP_INCREASE_OVERLAP=42,
1132d643ce63SMatthew Knepley                MATOP_GET_VALUES=43,
1133d643ce63SMatthew Knepley                MATOP_COPY=44,
1134d643ce63SMatthew Knepley                MATOP_PRINT_HELP=45,
1135d643ce63SMatthew Knepley                MATOP_SCALE=46,
1136d643ce63SMatthew Knepley                MATOP_SHIFT=47,
1137d643ce63SMatthew Knepley                MATOP_DIAGONAL_SHIFT=48,
1138d643ce63SMatthew Knepley                MATOP_ILUDT_FACTOR=49,
1139d643ce63SMatthew Knepley                MATOP_GET_BLOCK_SIZE=50,
1140d643ce63SMatthew Knepley                MATOP_GET_ROW_IJ=51,
1141d643ce63SMatthew Knepley                MATOP_RESTORE_ROW_IJ=52,
1142d643ce63SMatthew Knepley                MATOP_GET_COLUMN_IJ=53,
1143d643ce63SMatthew Knepley                MATOP_RESTORE_COLUMN_IJ=54,
1144d643ce63SMatthew Knepley                MATOP_FDCOLORING_CREATE=55,
1145d643ce63SMatthew Knepley                MATOP_COLORING_PATCH=56,
1146d643ce63SMatthew Knepley                MATOP_SET_UNFACTORED=57,
1147d643ce63SMatthew Knepley                MATOP_PERMUTE=58,
1148d643ce63SMatthew Knepley                MATOP_SET_VALUES_BLOCKED=59,
1149d643ce63SMatthew Knepley                MATOP_GET_SUBMATRIX=60,
1150d643ce63SMatthew Knepley                MATOP_DESTROY=61,
1151d643ce63SMatthew Knepley                MATOP_VIEW=62,
1152d643ce63SMatthew Knepley                MATOP_GET_MAPS=63,
1153d643ce63SMatthew Knepley                MATOP_USE_SCALED_FORM=64,
1154d643ce63SMatthew Knepley                MATOP_SCALE_SYSTEM=65,
1155d643ce63SMatthew Knepley                MATOP_UNSCALE_SYSTEM=66,
1156d643ce63SMatthew Knepley                MATOP_SET_LOCAL_TO_GLOBAL_MAPPING=67,
1157d643ce63SMatthew Knepley                MATOP_SET_VALUES_LOCAL=68,
1158d643ce63SMatthew Knepley                MATOP_ZERO_ROWS_LOCAL=69,
1159d643ce63SMatthew Knepley                MATOP_GET_ROW_MAX=70,
1160d643ce63SMatthew Knepley                MATOP_CONVERT=71,
1161d643ce63SMatthew Knepley                MATOP_SET_COLORING=72,
1162d643ce63SMatthew Knepley                MATOP_SET_VALUES_ADIC=73,
1163d643ce63SMatthew Knepley                MATOP_SET_VALUES_ADIFOR=74,
1164d643ce63SMatthew Knepley                MATOP_FD_COLORING_APPLY=75,
1165d643ce63SMatthew Knepley                MATOP_SET_FROM_OPTIONS=76,
1166d643ce63SMatthew Knepley                MATOP_MULT_CONSTRAINED=77,
1167d643ce63SMatthew Knepley                MATOP_MULT_TRANSPOSE_CONSTRAINED=78,
1168d643ce63SMatthew Knepley                MATOP_ILU_FACTOR_SYMBOLIC_CONSTRAINED=79,
1169d643ce63SMatthew Knepley                MATOP_PERMUTE_SPARSIFY=80,
1170d643ce63SMatthew Knepley                MATOP_MULT_MULTIPLE=81,
1171d643ce63SMatthew Knepley                MATOP_SOLVE_MULTIPLE=82
1172fae171e0SBarry Smith              } MatOperation;
1173ca44d042SBarry Smith EXTERN int MatHasOperation(Mat,MatOperation,PetscTruth*);
1174ff8b7a98SSatish Balay EXTERN int MatShellSetOperation(Mat,MatOperation,void(*)(void));
1175ff8b7a98SSatish Balay EXTERN int MatShellGetOperation(Mat,MatOperation,void(**)(void));
1176273d9f13SBarry Smith EXTERN int MatShellSetContext(Mat,void*);
1177112a2221SBarry Smith 
117890ace30eSBarry Smith /*
117990ace30eSBarry Smith    Codes for matrices stored on disk. By default they are
118090ace30eSBarry Smith  stored in a universal format. By changing the format with
1181fb9695e5SSatish Balay  PetscViewerSetFormat(viewer,PETSC_VIEWER_BINARY_NATIVE); the matrices will
118290ace30eSBarry Smith  be stored in a way natural for the matrix, for example dense matrices
118390ace30eSBarry Smith  would be stored as dense. Matrices stored this way may only be
118490ace30eSBarry Smith  read into matrices of the same time.
118590ace30eSBarry Smith */
118690ace30eSBarry Smith #define MATRIX_BINARY_FORMAT_DENSE -1
118790ace30eSBarry Smith 
11886d053be9SSatish Balay EXTERN int MatMPIBAIJSetHashTableFactor(Mat,PetscReal);
1189ca44d042SBarry Smith EXTERN int MatSeqAIJGetInodeSizes(Mat,int *,int *[],int *);
119008918a0eSSatish Balay EXTERN int MatMPIRowbsGetColor(Mat,ISColoring *);
1191860d1616SSatish Balay 
1192d9274352SBarry Smith /*S
1193d9274352SBarry Smith      MatNullSpace - Object that removes a null space from a vector, i.e.
1194d9274352SBarry Smith          orthogonalizes the vector to a subsapce
1195d9274352SBarry Smith 
1196f7a9e4ceSBarry Smith    Level: advanced
1197d9274352SBarry Smith 
1198d9274352SBarry Smith   Concepts: matrix; linear operator, null space
1199d9274352SBarry Smith 
12006e1639daSBarry Smith   Users manual sections:
12016e1639daSBarry Smith .   sec_singular
12026e1639daSBarry Smith 
1203d9274352SBarry Smith .seealso:  MatNullSpaceCreate()
1204d9274352SBarry Smith S*/
120574637425SBarry Smith typedef struct _p_MatNullSpace* MatNullSpace;
1206d9274352SBarry Smith 
12074e7234bfSBarry Smith EXTERN int MatNullSpaceCreate(MPI_Comm,int,int,const Vec[],MatNullSpace*);
120874637425SBarry Smith EXTERN int MatNullSpaceDestroy(MatNullSpace);
120974637425SBarry Smith EXTERN int MatNullSpaceRemove(MatNullSpace,Vec,Vec*);
121074637425SBarry Smith EXTERN int MatNullSpaceAttach(Mat,MatNullSpace);
121174637425SBarry Smith EXTERN int MatNullSpaceTest(MatNullSpace,Mat);
121274637425SBarry Smith 
1213273d9f13SBarry Smith EXTERN int MatReorderingSeqSBAIJ(Mat A,IS isp);
1214273d9f13SBarry Smith EXTERN int MatMPISBAIJSetHashTableFactor(Mat,PetscReal);
1215273d9f13SBarry Smith EXTERN int MatSeqSBAIJSetColumnIndices(Mat,int *);
1216273d9f13SBarry Smith 
12175c66b693SKris Buschelman EXTERN int MatMatMult(Mat A,Mat B, Mat *C);
12185c66b693SKris Buschelman EXTERN int MatMatMultSymbolic(Mat A,Mat B,Mat *C);
12195c66b693SKris Buschelman EXTERN int MatMatMultNumeric(Mat A,Mat B,Mat C);
12203f1d51d7SBarry Smith 
1221f069c275SSatish Balay EXTERN int MatCreateMAIJ(Mat,int,Mat*);
1222c4f061fbSSatish Balay EXTERN int MatMAIJRedimension(Mat,int,Mat*);
1223c4f061fbSSatish Balay EXTERN int MatMAIJGetAIJ(Mat,Mat*);
1224c4f061fbSSatish Balay 
1225b0a32e0cSBarry Smith EXTERN int MatComputeExplicitOperator(Mat,Mat*);
1226b0a32e0cSBarry Smith 
122724a595ddSBarry Smith EXTERN int MatESISetType(Mat,char*);
122824a595ddSBarry Smith EXTERN int MatESISetFromOptions(Mat);
122924a595ddSBarry Smith 
12302cd6534aSBarry Smith EXTERN int MatDiagonalScaleLocal(Mat,Vec);
123104f1ad80SBarry Smith 
12327dbadf16SMatthew Knepley EXTERN int PetscViewerMathematicaPutMatrix(PetscViewer, int, int, PetscReal *);
12337dbadf16SMatthew Knepley EXTERN int PetscViewerMathematicaPutCSRMatrix(PetscViewer, int, int, int *, int *, PetscReal *);
12347dbadf16SMatthew Knepley 
1235e82a3eeeSBarry Smith EXTERN int MatUseSpooles_SeqAIJ(Mat);
1236e82a3eeeSBarry Smith EXTERN int MatUseUMFPACK_SeqAIJ(Mat);
1237e82a3eeeSBarry Smith EXTERN int MatUseSuperLU_SeqAIJ(Mat);
1238e82a3eeeSBarry Smith EXTERN int MatUseEssl_SeqAIJ(Mat);
1239e82a3eeeSBarry Smith EXTERN int MatUseLUSOL_SeqAIJ(Mat);
1240e82a3eeeSBarry Smith EXTERN int MatUseMatlab_SeqAIJ(Mat);
1241e82a3eeeSBarry Smith EXTERN int MatUseDXML_SeqAIJ(Mat);
12420889b5dcSvictorle EXTERN int MatUsePETSc_SeqAIJ(Mat);
1243e82a3eeeSBarry Smith EXTERN int MatUseSuperLU_DIST_MPIAIJ(Mat);
1244e82a3eeeSBarry Smith EXTERN int MatUseSpooles_MPIAIJ(Mat);
1245e82a3eeeSBarry Smith EXTERN int MatUseSpooles_SeqSBAIJ(Mat);
1246eee76cafSHong Zhang EXTERN int MatUseSpooles_MPISBAIJ(Mat);
1247eee76cafSHong Zhang EXTERN int MatUseMUMPS_MPIAIJ(Mat);
1248e82a3eeeSBarry Smith 
12492eac72dbSBarry Smith #endif
12502eac72dbSBarry Smith 
12512eac72dbSBarry Smith 
12529d00d63dSBarry Smith 
1253