xref: /petsc/include/petscmat.h (revision e9fa29b77eaf32efadba30e98aa12b45e655e5d0)
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"
8*e9fa29b7SSatish Balay PETSC_EXTERN_CXX_BEGIN
92eac72dbSBarry Smith 
10d9274352SBarry Smith /*S
11d9274352SBarry Smith      Mat - Abstract PETSc matrix object
122eac72dbSBarry Smith 
13d91e6319SBarry Smith    Level: beginner
14d91e6319SBarry Smith 
15d9274352SBarry Smith   Concepts: matrix; linear operator
16d9274352SBarry Smith 
17d9274352SBarry Smith .seealso:  MatCreate(), MatType, MatSetType()
18d9274352SBarry Smith S*/
19d9274352SBarry Smith typedef struct _p_Mat*           Mat;
20d9274352SBarry Smith 
21d9274352SBarry Smith /*E
22d9274352SBarry Smith     MatType - String with the name of a PETSc matrix or the creation function
23d9274352SBarry Smith        with an optional dynamic library name, for example
24d9274352SBarry Smith        http://www.mcs.anl.gov/petsc/lib.a:mymatcreate()
25d9274352SBarry Smith 
26d9274352SBarry Smith    Level: beginner
27d9274352SBarry Smith 
28d9274352SBarry Smith .seealso: MatSetType(), Mat
29d91e6319SBarry Smith E*/
30273d9f13SBarry Smith #define MATSAME            "same"
31273d9f13SBarry Smith #define MATSEQMAIJ         "seqmaij"
32273d9f13SBarry Smith #define MATMPIMAIJ         "mpimaij"
33209238afSKris Buschelman #define MATMAIJ            "maij"
34273d9f13SBarry Smith #define MATIS              "is"
35273d9f13SBarry Smith #define MATMPIROWBS        "mpirowbs"
36273d9f13SBarry Smith #define MATSEQAIJ          "seqaij"
37273d9f13SBarry Smith #define MATMPIAIJ          "mpiaij"
38209238afSKris Buschelman #define MATAIJ             "aij"
39273d9f13SBarry Smith #define MATSHELL           "shell"
40273d9f13SBarry Smith #define MATSEQBDIAG        "seqbdiag"
41273d9f13SBarry Smith #define MATMPIBDIAG        "mpibdiag"
42209238afSKris Buschelman #define MATBDIAG           "bdiag"
43209238afSKris Buschelman #define MATSEQDENSE        "seqdense"
44273d9f13SBarry Smith #define MATMPIDENSE        "mpidense"
45209238afSKris Buschelman #define MATDENSE           "dense"
46273d9f13SBarry Smith #define MATSEQBAIJ         "seqbaij"
47273d9f13SBarry Smith #define MATMPIBAIJ         "mpibaij"
48209238afSKris Buschelman #define MATBAIJ            "baij"
49273d9f13SBarry Smith #define MATMPIADJ          "mpiadj"
50273d9f13SBarry Smith #define MATSEQSBAIJ        "seqsbaij"
51273d9f13SBarry Smith #define MATMPISBAIJ        "mpisbaij"
52209238afSKris Buschelman #define MATSBAIJ           "sbaij"
53cebc7f6cSBarry Smith #define MATDAAD            "daad"
54cebc7f6cSBarry Smith #define MATMFFD            "mffd"
556d88219bSBarry Smith #define MATESI             "esi"
566d88219bSBarry Smith #define MATPETSCESI        "petscesi"
57c8a8475eSBarry Smith #define MATNORMAL          "normal"
58b3a1e11cSKris Buschelman #define MATSEQAIJSPOOLES   "seqaijspooles"
59d10c748bSKris Buschelman #define MATMPIAIJSPOOLES   "mpiaijspooles"
609abb65ffSKris Buschelman #define MATSEQSBAIJSPOOLES "seqsbaijspooles"
6122191285SKris Buschelman #define MATMPISBAIJSPOOLES "mpisbaijspooles"
6214b396bbSKris Buschelman #define MATSUPERLU         "superlu"
631d96aa28SKris Buschelman #define MATSUPERLU_DIST    "superlu_dist"
641677d0b8SKris Buschelman #define MATUMFPACK         "umfpack"
65e8aa55a4SKris Buschelman #define MATESSL            "essl"
664eb8e494SKris Buschelman #define MATLUSOL           "lusol"
67397b6df1SKris Buschelman #define MATAIJMUMPS        "aijmumps"
68397b6df1SKris Buschelman #define MATSBAIJMUMPS      "sbaijmumps"
698da957c5SKris Buschelman #define MATDSCPACK         "dscpack"
70273d9f13SBarry Smith typedef char* MatType;
71d91e6319SBarry Smith 
72c06d978dSMatthew Knepley #define MAT_SER_SEQAIJ_BINARY "seqaij_binary"
73c06d978dSMatthew Knepley #define MAT_SER_MPIAIJ_BINARY "mpiaij_binary"
74c06d978dSMatthew Knepley typedef char *MatSerializeType;
75c06d978dSMatthew Knepley 
76c06d978dSMatthew Knepley /* Logging support */
77552e946dSBarry Smith #define    MAT_FILE_COOKIE 1211216    /* used to indicate matrices in binary files */
78c06d978dSMatthew Knepley extern int MAT_COOKIE;
7971d41ebeSBarry Smith extern int MATSNESMFCTX_COOKIE;
80c06d978dSMatthew Knepley extern int MAT_FDCOLORING_COOKIE;
818ba1e511SMatthew Knepley extern int MAT_PARTITIONING_COOKIE;
828ba1e511SMatthew Knepley extern int MAT_NULLSPACE_COOKIE;
83d59c15a7SBarry Smith extern int MAT_Mult, MAT_MultMatrixFree, MAT_Mults, MAT_MultConstrained, MAT_MultAdd, MAT_MultTranspose;
84d59c15a7SBarry Smith extern int MAT_MultTransposeConstrained, MAT_MultTransposeAdd, MAT_Solve, MAT_Solves, MAT_SolveAdd, MAT_SolveTranspose;
85d5ba7fb7SMatthew Knepley extern int MAT_SolveTransposeAdd, MAT_Relax, MAT_ForwardSolve, MAT_BackwardSolve, MAT_LUFactor, MAT_LUFactorSymbolic;
86d5ba7fb7SMatthew Knepley extern int MAT_LUFactorNumeric, MAT_CholeskyFactor, MAT_CholeskyFactorSymbolic, MAT_CholeskyFactorNumeric, MAT_ILUFactor;
87d5ba7fb7SMatthew Knepley extern int MAT_ILUFactorSymbolic, MAT_ICCFactorSymbolic, MAT_Copy, MAT_Convert, MAT_Scale, MAT_AssemblyBegin;
88d5ba7fb7SMatthew Knepley extern int MAT_AssemblyEnd, MAT_SetValues, MAT_GetValues, MAT_GetRow, MAT_GetSubMatrices, MAT_GetColoring, MAT_GetOrdering;
89d5ba7fb7SMatthew Knepley extern int MAT_IncreaseOverlap, MAT_Partitioning, MAT_ZeroEntries, MAT_Load, MAT_View, MAT_AXPY, MAT_FDColoringCreate;
9066f9b7ceSBarry Smith extern int MAT_FDColoringApply, MAT_Transpose, MAT_FDColoringFunction;
91c06d978dSMatthew Knepley 
928ba1e511SMatthew Knepley EXTERN int MatInitializePackage(char *);
93c06d978dSMatthew Knepley 
94273d9f13SBarry Smith EXTERN int MatCreate(MPI_Comm,int,int,int,int,Mat*);
95273d9f13SBarry Smith EXTERN int MatSetType(Mat,MatType);
96273d9f13SBarry Smith EXTERN int MatSetFromOptions(Mat);
97273d9f13SBarry Smith EXTERN int MatSetUpPreallocation(Mat);
98273d9f13SBarry Smith EXTERN int MatRegisterAll(char*);
99273d9f13SBarry Smith EXTERN int MatRegister(char*,char*,char*,int(*)(Mat));
100c06d978dSMatthew Knepley EXTERN int MatSerializeRegister(const char [], const char [], const char [], int (*)(MPI_Comm, Mat *, PetscViewer, PetscTruth));
10130de9b25SBarry Smith 
10230de9b25SBarry Smith /*MC
10330de9b25SBarry Smith    MatRegisterDynamic - Adds a new matrix type
10430de9b25SBarry Smith 
10530de9b25SBarry Smith    Synopsis:
10630de9b25SBarry Smith    int MatRegisterDynamic(char *name,char *path,char *name_create,int (*routine_create)(Mat))
10730de9b25SBarry Smith 
10830de9b25SBarry Smith    Not Collective
10930de9b25SBarry Smith 
11030de9b25SBarry Smith    Input Parameters:
11130de9b25SBarry Smith +  name - name of a new user-defined matrix type
11230de9b25SBarry Smith .  path - path (either absolute or relative) the library containing this solver
11330de9b25SBarry Smith .  name_create - name of routine to create method context
11430de9b25SBarry Smith -  routine_create - routine to create method context
11530de9b25SBarry Smith 
11630de9b25SBarry Smith    Notes:
11730de9b25SBarry Smith    MatRegisterDynamic() may be called multiple times to add several user-defined solvers.
11830de9b25SBarry Smith 
11930de9b25SBarry Smith    If dynamic libraries are used, then the fourth input argument (routine_create)
12030de9b25SBarry Smith    is ignored.
12130de9b25SBarry Smith 
12230de9b25SBarry Smith    Sample usage:
12330de9b25SBarry Smith .vb
12430de9b25SBarry Smith    MatRegisterDynamic("my_mat",/home/username/my_lib/lib/libO/solaris/mylib.a,
12530de9b25SBarry Smith                "MyMatCreate",MyMatCreate);
12630de9b25SBarry Smith .ve
12730de9b25SBarry Smith 
12830de9b25SBarry Smith    Then, your solver can be chosen with the procedural interface via
12930de9b25SBarry Smith $     MatSetType(Mat,"my_mat")
13030de9b25SBarry Smith    or at runtime via the option
13130de9b25SBarry Smith $     -mat_type my_mat
13230de9b25SBarry Smith 
13330de9b25SBarry Smith    Level: advanced
13430de9b25SBarry Smith 
13530de9b25SBarry Smith    Notes: ${PETSC_ARCH} and ${BOPT} occuring in pathname will be replaced with appropriate values.
13630de9b25SBarry Smith          If your function is not being put into a shared library then use VecRegister() instead
13730de9b25SBarry Smith 
13830de9b25SBarry Smith .keywords: Mat, register
13930de9b25SBarry Smith 
14030de9b25SBarry Smith .seealso: MatRegisterAll(), MatRegisterDestroy()
14130de9b25SBarry Smith 
14230de9b25SBarry Smith M*/
143273d9f13SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
144273d9f13SBarry Smith #define MatRegisterDynamic(a,b,c,d) MatRegister(a,b,c,0)
145273d9f13SBarry Smith #else
146273d9f13SBarry Smith #define MatRegisterDynamic(a,b,c,d) MatRegister(a,b,c,d)
14730de9b25SBarry Smith #endif
14830de9b25SBarry Smith 
14930de9b25SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
15030de9b25SBarry Smith #define MatSerializeRegisterDynamic(a,b,c,d) MatSerializeRegister(a,b,c,0)
15130de9b25SBarry Smith #else
152c06d978dSMatthew Knepley #define MatSerializeRegisterDynamic(a,b,c,d) MatSerializeRegister(a,b,c,d)
153273d9f13SBarry Smith #endif
15430de9b25SBarry Smith 
155273d9f13SBarry Smith extern PetscTruth MatRegisterAllCalled;
156b0a32e0cSBarry Smith extern PetscFList MatList;
15728988994SBarry Smith 
158c06d978dSMatthew Knepley EXTERN PetscFList MatSerializeList;
159c06d978dSMatthew Knepley EXTERN int MatSerializeRegisterAll(const char []);
16065804fbbSSatish Balay EXTERN int MatSerializeRegisterDestroy(void);
161c06d978dSMatthew Knepley EXTERN int MatSerializeRegisterAllCalled;
162c06d978dSMatthew Knepley EXTERN int MatSerialize(MPI_Comm, Mat *, PetscViewer, PetscTruth);
163c06d978dSMatthew Knepley EXTERN int MatSetSerializeType(Mat, MatSerializeType);
164c06d978dSMatthew Knepley 
165ca01db9bSBarry Smith EXTERN int MatCreateSeqDense(MPI_Comm,int,int,PetscScalar[],Mat*);
166ca01db9bSBarry Smith EXTERN int MatCreateMPIDense(MPI_Comm,int,int,int,int,PetscScalar[],Mat*);
167ca01db9bSBarry Smith EXTERN int MatCreateSeqAIJ(MPI_Comm,int,int,int,const int[],Mat*);
168ca01db9bSBarry Smith EXTERN int MatCreateMPIAIJ(MPI_Comm,int,int,int,int,int,const int[],int,const int[],Mat*);
169ca01db9bSBarry Smith EXTERN int MatCreateMPIRowbs(MPI_Comm,int,int,int,const int[],Mat*);
170ca01db9bSBarry Smith EXTERN int MatCreateSeqBDiag(MPI_Comm,int,int,int,int,const int[],PetscScalar*[],Mat*);
171ca01db9bSBarry Smith EXTERN int MatCreateMPIBDiag(MPI_Comm,int,int,int,int,int,const int[],PetscScalar*[],Mat*);
172ca01db9bSBarry Smith EXTERN int MatCreateSeqBAIJ(MPI_Comm,int,int,int,int,const int[],Mat*);
173ca01db9bSBarry Smith EXTERN int MatCreateMPIBAIJ(MPI_Comm,int,int,int,int,int,int,const int[],int,const int[],Mat*);
174ca01db9bSBarry Smith EXTERN int MatCreateMPIAdj(MPI_Comm,int,int,int[],int[],int[],Mat*);
175ca01db9bSBarry Smith EXTERN int MatCreateSeqSBAIJ(MPI_Comm,int,int,int,int,const int[],Mat*);
176ca01db9bSBarry Smith EXTERN int MatCreateMPISBAIJ(MPI_Comm,int,int,int,int,int,int,const int[],int,const int[],Mat*);
177ca44d042SBarry Smith EXTERN int MatCreateShell(MPI_Comm,int,int,int,int,void *,Mat*);
1783a7fca6bSBarry Smith EXTERN int MatCreateAdic(MPI_Comm,int,int,int,int,int,void (*)(void),Mat*);
179c8a8475eSBarry Smith EXTERN int MatCreateNormal(Mat,Mat*);
180435da068SBarry Smith EXTERN int MatDestroy(Mat);
18121c89e3eSBarry Smith 
182ca44d042SBarry Smith EXTERN int MatPrintHelp(Mat);
1838a124369SBarry Smith EXTERN int MatGetPetscMaps(Mat,PetscMap*,PetscMap*);
184ec0117caSBarry Smith 
1858ed539a5SBarry Smith /* ------------------------------------------------------------*/
186f15d580aSBarry Smith EXTERN int MatSetValues(Mat,int,const int[],int,const int[],const PetscScalar[],InsertMode);
187f15d580aSBarry Smith EXTERN int MatSetValuesBlocked(Mat,int,const int[],int,const int[],const PetscScalar[],InsertMode);
18884cb2905SBarry Smith 
1892ef4de8bSBarry Smith /*S
1902ef4de8bSBarry Smith      MatStencil - Data structure (C struct) for storing information about a single row or
1912ef4de8bSBarry Smith         column of a matrix as index on an associated grid.
1922ef4de8bSBarry Smith 
1932ef4de8bSBarry Smith    Level: beginner
1942ef4de8bSBarry Smith 
1952ef4de8bSBarry Smith   Concepts: matrix; linear operator
1962ef4de8bSBarry Smith 
1972ef4de8bSBarry Smith .seealso:  MatSetValuesStencil(), MatSetStencil()
1982ef4de8bSBarry Smith S*/
199435da068SBarry Smith typedef struct {
200435da068SBarry Smith   int k,j,i,c;
201435da068SBarry Smith } MatStencil;
2022ef4de8bSBarry Smith 
203f15d580aSBarry Smith EXTERN int MatSetValuesStencil(Mat,int,const MatStencil[],int,const MatStencil[],const PetscScalar[],InsertMode);
204f15d580aSBarry Smith EXTERN int MatSetValuesBlockedStencil(Mat,int,const MatStencil[],int,const MatStencil[],const PetscScalar[],InsertMode);
205f15d580aSBarry Smith EXTERN int MatSetStencil(Mat,int,const int[],const int[],int);
206435da068SBarry Smith 
2073a7fca6bSBarry Smith EXTERN int MatSetColoring(Mat,ISColoring);
2083a7fca6bSBarry Smith EXTERN int MatSetValuesAdic(Mat,void*);
2093a7fca6bSBarry Smith EXTERN int MatSetValuesAdifor(Mat,int,void*);
2103a7fca6bSBarry Smith 
211d91e6319SBarry Smith /*E
212d91e6319SBarry Smith     MatAssemblyType - Indicates if the matrix is now to be used, or if you plan
213d91e6319SBarry Smith      to continue to add values to it
214d91e6319SBarry Smith 
215d91e6319SBarry Smith     Level: beginner
216d91e6319SBarry Smith 
217d91e6319SBarry Smith .seealso: MatAssemblyBegin(), MatAssemblyEnd()
218d91e6319SBarry Smith E*/
2196d4a8577SBarry Smith typedef enum {MAT_FLUSH_ASSEMBLY=1,MAT_FINAL_ASSEMBLY=0} MatAssemblyType;
220ca44d042SBarry Smith EXTERN int MatAssemblyBegin(Mat,MatAssemblyType);
221ca44d042SBarry Smith EXTERN int MatAssemblyEnd(Mat,MatAssemblyType);
222ca44d042SBarry Smith EXTERN int MatAssembled(Mat,PetscTruth*);
2234f9c727eSBarry Smith 
22430de9b25SBarry Smith /*MC
22530de9b25SBarry Smith    MatSetValue - Set a single entry into a matrix.
22630de9b25SBarry Smith 
22730de9b25SBarry Smith    Synopsis:
22830de9b25SBarry Smith    int MatSetValue(Mat m,int row,int col,PetscScalar value,InsertMode mode);
22930de9b25SBarry Smith 
23030de9b25SBarry Smith    Not collective
23130de9b25SBarry Smith 
23230de9b25SBarry Smith    Input Parameters:
23330de9b25SBarry Smith +  m - the matrix
23430de9b25SBarry Smith .  row - the row location of the entry
23530de9b25SBarry Smith .  col - the column location of the entry
23630de9b25SBarry Smith .  value - the value to insert
23730de9b25SBarry Smith -  mode - either INSERT_VALUES or ADD_VALUES
23830de9b25SBarry Smith 
23930de9b25SBarry Smith    Notes:
24030de9b25SBarry Smith    For efficiency one should use MatSetValues() and set several or many
24130de9b25SBarry Smith    values simultaneously if possible.
24230de9b25SBarry Smith 
24330de9b25SBarry Smith    Note that MatSetValue() does NOT return an error code (since this
24430de9b25SBarry Smith    is checked internally).
24530de9b25SBarry Smith 
24630de9b25SBarry Smith    Level: beginner
24730de9b25SBarry Smith 
24830de9b25SBarry Smith .seealso: MatSetValues(), MatSetValueLocal()
24930de9b25SBarry Smith M*/
250b951964fSBarry Smith #define MatSetValue(v,i,j,va,mode) \
251ea709b57SSatish Balay 0; {int _ierr,_row = i,_col = j; PetscScalar _va = va; \
252b951964fSBarry Smith   _ierr = MatSetValues(v,1,&_row,1,&_col,&_va,mode);CHKERRQ(_ierr); \
253b951964fSBarry Smith }
25430de9b25SBarry Smith 
255ea06a074SBarry Smith #define MatGetValue(v,i,j,va) \
256d91e6319SBarry Smith 0; {int _ierr,_row = i,_col = j; \
257ea06a074SBarry Smith   _ierr = MatGetValues(v,1,&_row,1,&_col,&va);CHKERRQ(_ierr); \
258ea06a074SBarry Smith }
25930de9b25SBarry Smith 
260d91e6319SBarry Smith #define MatSetValueLocal(v,i,j,va,mode) \
261ea709b57SSatish Balay 0; {int _ierr,_row = i,_col = j; PetscScalar _va = va; \
262d91e6319SBarry Smith   _ierr = MatSetValuesLocal(v,1,&_row,1,&_col,&_va,mode);CHKERRQ(_ierr); \
263d91e6319SBarry Smith }
26430de9b25SBarry Smith 
265d91e6319SBarry Smith /*E
266d91e6319SBarry Smith     MatOption - Options that may be set for a matrix and its behavior or storage
267d91e6319SBarry Smith 
268d91e6319SBarry Smith     Level: beginner
269d91e6319SBarry Smith 
2700a835dfdSSatish Balay    Any additions/changes here MUST also be made in include/finclude/petscmat.h
271d91e6319SBarry Smith 
272d91e6319SBarry Smith .seealso: MatSetOption()
273d91e6319SBarry Smith E*/
2746d4a8577SBarry Smith typedef enum {MAT_ROW_ORIENTED=1,MAT_COLUMN_ORIENTED=2,MAT_ROWS_SORTED=4,
2756d4a8577SBarry Smith               MAT_COLUMNS_SORTED=8,MAT_NO_NEW_NONZERO_LOCATIONS=16,
2766d4a8577SBarry Smith               MAT_YES_NEW_NONZERO_LOCATIONS=32,MAT_SYMMETRIC=64,
2776ca9ecd3SBarry Smith               MAT_STRUCTURALLY_SYMMETRIC=65,MAT_NO_NEW_DIAGONALS=66,
2786ca9ecd3SBarry Smith               MAT_YES_NEW_DIAGONALS=67,MAT_INODE_LIMIT_1=68,MAT_INODE_LIMIT_2=69,
2796ca9ecd3SBarry Smith               MAT_INODE_LIMIT_3=70,MAT_INODE_LIMIT_4=71,MAT_INODE_LIMIT_5=72,
2806ca9ecd3SBarry Smith               MAT_IGNORE_OFF_PROC_ENTRIES=73,MAT_ROWS_UNSORTED=74,
2814787f768SSatish Balay               MAT_COLUMNS_UNSORTED=75,MAT_NEW_NONZERO_LOCATION_ERR=76,
2827c922b88SBarry Smith               MAT_NEW_NONZERO_ALLOCATION_ERR=77,MAT_USE_HASH_TABLE=78,
2832bad1931SBarry Smith               MAT_KEEP_ZEROED_ROWS=79,MAT_IGNORE_ZERO_ENTRIES=80,MAT_USE_INODES=81,
284123145dfSKris Buschelman               MAT_DO_NOT_USE_INODES=82} MatOption;
285ca44d042SBarry Smith EXTERN int MatSetOption(Mat,MatOption);
286273d9f13SBarry Smith EXTERN int MatGetType(Mat,MatType*);
28784cb2905SBarry Smith 
288f15d580aSBarry Smith EXTERN int MatGetValues(Mat,int,const int[],int,const int[],PetscScalar[]);
289f15d580aSBarry Smith EXTERN int MatGetRow(Mat,int,int *,int *[],PetscScalar*[]);
290f15d580aSBarry Smith EXTERN int MatRestoreRow(Mat,int,int *,int *[],PetscScalar*[]);
2914e7234bfSBarry Smith EXTERN int MatGetColumn(Mat,int,int *,int *[],PetscScalar*[]);
2924e7234bfSBarry Smith EXTERN int MatRestoreColumn(Mat,int,int *,int *[],PetscScalar*[]);
293ca44d042SBarry Smith EXTERN int MatGetColumnVector(Mat,Vec,int);
2944e7234bfSBarry Smith EXTERN int MatGetArray(Mat,PetscScalar *[]);
2954e7234bfSBarry Smith EXTERN int MatRestoreArray(Mat,PetscScalar *[]);
296ca44d042SBarry Smith EXTERN int MatGetBlockSize(Mat,int *);
2977b80b807SBarry Smith 
298ca44d042SBarry Smith EXTERN int MatMult(Mat,Vec,Vec);
299ca44d042SBarry Smith EXTERN int MatMultAdd(Mat,Vec,Vec,Vec);
300ca44d042SBarry Smith EXTERN int MatMultTranspose(Mat,Vec,Vec);
301cd0d46ebSvictorle EXTERN int MatIsSymmetric(Mat,Mat,PetscTruth*);
302ca44d042SBarry Smith EXTERN int MatMultTransposeAdd(Mat,Vec,Vec,Vec);
303c06d978dSMatthew Knepley EXTERN int MatMultConstrained(Mat,Vec,Vec);
3046d0dc95fSMatthew Knepley EXTERN int MatMultTransposeConstrained(Mat,Vec,Vec);
3052eac72dbSBarry Smith 
306d91e6319SBarry Smith /*E
307d91e6319SBarry Smith     MatDuplicateOption - Indicates if a duplicated sparse matrix should have
308d91e6319SBarry Smith   its numerical values copied over or just its nonzero structure.
309d91e6319SBarry Smith 
310d91e6319SBarry Smith     Level: beginner
311d91e6319SBarry Smith 
312d91e6319SBarry Smith    Any additions/changes here MUST also be made in include/finclude/petscmat.h
313d91e6319SBarry Smith 
314d91e6319SBarry Smith .seealso: MatDuplicate()
315d91e6319SBarry Smith E*/
3162e8a6d31SBarry Smith typedef enum {MAT_DO_NOT_COPY_VALUES,MAT_COPY_VALUES} MatDuplicateOption;
3172e8a6d31SBarry Smith 
318273d9f13SBarry Smith EXTERN int MatConvertRegister(char*,char*,char*,int (*)(Mat,MatType,Mat*));
319273d9f13SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
320273d9f13SBarry Smith #define MatConvertRegisterDynamic(a,b,c,d) MatConvertRegister(a,b,c,0)
321273d9f13SBarry Smith #else
322273d9f13SBarry Smith #define MatConvertRegisterDynamic(a,b,c,d) MatConvertRegister(a,b,c,d)
323273d9f13SBarry Smith #endif
324273d9f13SBarry Smith EXTERN int        MatConvertRegisterAll(char*);
325273d9f13SBarry Smith EXTERN int        MatConvertRegisterDestroy(void);
326273d9f13SBarry Smith extern PetscTruth MatConvertRegisterAllCalled;
327b0a32e0cSBarry Smith extern PetscFList MatConvertList;
328ca44d042SBarry Smith EXTERN int        MatConvert(Mat,MatType,Mat*);
329ca44d042SBarry Smith EXTERN int        MatDuplicate(Mat,MatDuplicateOption,Mat*);
33094a9d846SBarry Smith 
331d91e6319SBarry Smith /*E
332d91e6319SBarry Smith     MatStructure - Indicates if the matrix has the same nonzero structure
333d91e6319SBarry Smith 
334d91e6319SBarry Smith     Level: beginner
335d91e6319SBarry Smith 
336d91e6319SBarry Smith    Any additions/changes here MUST also be made in include/finclude/petscmat.h
337d91e6319SBarry Smith 
338d91e6319SBarry Smith .seealso: MatCopy(), SLESSetOperators(), PCSetOperators()
339d91e6319SBarry Smith E*/
340c537a176SHong Zhang typedef enum {SAME_NONZERO_PATTERN,DIFFERENT_NONZERO_PATTERN,SAME_PRECONDITIONER,SUBSET_NONZERO_PATTERN} MatStructure;
341cb5b572fSBarry Smith 
342ca44d042SBarry Smith EXTERN int MatCopy(Mat,Mat,MatStructure);
343b0a32e0cSBarry Smith EXTERN int MatView(Mat,PetscViewer);
344273d9f13SBarry Smith 
345b0a32e0cSBarry Smith EXTERN int MatLoad(PetscViewer,MatType,Mat*);
34651dd7536SBarry Smith EXTERN int MatMerge(MPI_Comm,Mat,Mat*);
3477b80b807SBarry Smith 
3484e7234bfSBarry Smith EXTERN int MatGetRowIJ(Mat,int,PetscTruth,int*,int *[],int *[],PetscTruth *);
3494e7234bfSBarry Smith EXTERN int MatRestoreRowIJ(Mat,int,PetscTruth,int *,int *[],int *[],PetscTruth *);
3504e7234bfSBarry Smith EXTERN int MatGetColumnIJ(Mat,int,PetscTruth,int*,int *[],int *[],PetscTruth *);
3514e7234bfSBarry Smith EXTERN int MatRestoreColumnIJ(Mat,int,PetscTruth,int *,int *[],int *[],PetscTruth *);
352d4fbbf0eSBarry Smith 
353d91e6319SBarry Smith /*S
354d91e6319SBarry Smith      MatInfo - Context of matrix information, used with MatGetInfo()
355d91e6319SBarry Smith 
356d91e6319SBarry Smith    In Fortran this is simply a double precision array of dimension MAT_INFO_SIZE
357d91e6319SBarry Smith 
358d91e6319SBarry Smith    Level: intermediate
359d91e6319SBarry Smith 
360d91e6319SBarry Smith   Concepts: matrix^nonzero information
361d91e6319SBarry Smith 
362d9274352SBarry Smith .seealso:  MatGetInfo(), MatInfoType
363d91e6319SBarry Smith S*/
3644e220ebcSLois Curfman McInnes typedef struct {
365b0a32e0cSBarry Smith   PetscLogDouble rows_global,columns_global;         /* number of global rows and columns */
366b0a32e0cSBarry Smith   PetscLogDouble rows_local,columns_local;           /* number of local rows and columns */
367b0a32e0cSBarry Smith   PetscLogDouble block_size;                         /* block size */
368b0a32e0cSBarry Smith   PetscLogDouble nz_allocated,nz_used,nz_unneeded;   /* number of nonzeros */
369b0a32e0cSBarry Smith   PetscLogDouble memory;                             /* memory allocated */
370b0a32e0cSBarry Smith   PetscLogDouble assemblies;                         /* number of matrix assemblies called */
371b0a32e0cSBarry Smith   PetscLogDouble mallocs;                            /* number of mallocs during MatSetValues() */
372b0a32e0cSBarry Smith   PetscLogDouble fill_ratio_given,fill_ratio_needed; /* fill ratio for LU/ILU */
373b0a32e0cSBarry Smith   PetscLogDouble factor_mallocs;                     /* number of mallocs during factorization */
3744e220ebcSLois Curfman McInnes } MatInfo;
3754e220ebcSLois Curfman McInnes 
376d9274352SBarry Smith /*E
377d9274352SBarry Smith     MatInfoType - Indicates if you want information about the local part of the matrix,
378d9274352SBarry Smith      the entire parallel matrix or the maximum over all the local parts.
379d9274352SBarry Smith 
380d9274352SBarry Smith     Level: beginner
381d9274352SBarry Smith 
382d9274352SBarry Smith    Any additions/changes here MUST also be made in include/finclude/petscmat.h
383d9274352SBarry Smith 
384d9274352SBarry Smith .seealso: MatGetInfo(), MatInfo
385d9274352SBarry Smith E*/
3867b80b807SBarry Smith typedef enum {MAT_LOCAL=1,MAT_GLOBAL_MAX=2,MAT_GLOBAL_SUM=3} MatInfoType;
387ca44d042SBarry Smith EXTERN int MatGetInfo(Mat,MatInfoType,MatInfo*);
388ca44d042SBarry Smith EXTERN int MatValid(Mat,PetscTruth*);
389ca44d042SBarry Smith EXTERN int MatGetDiagonal(Mat,Vec);
390273d9f13SBarry Smith EXTERN int MatGetRowMax(Mat,Vec);
391ca44d042SBarry Smith EXTERN int MatTranspose(Mat,Mat*);
392ca44d042SBarry Smith EXTERN int MatPermute(Mat,IS,IS,Mat *);
393bf1d55d4SSatish Balay EXTERN int MatPermuteSparsify(Mat,int,PetscReal,PetscReal,IS,IS,Mat *);
394ca44d042SBarry Smith EXTERN int MatDiagonalScale(Mat,Vec,Vec);
39506ef90c2SBarry Smith EXTERN int MatDiagonalSet(Mat,Vec,InsertMode);
396ca44d042SBarry Smith EXTERN int MatEqual(Mat,Mat,PetscTruth*);
3977b80b807SBarry Smith 
39887828ca2SBarry Smith EXTERN int MatNorm(Mat,NormType,PetscReal *);
399ca44d042SBarry Smith EXTERN int MatZeroEntries(Mat);
400268466fbSBarry Smith EXTERN int MatZeroRows(Mat,IS,const PetscScalar*);
401268466fbSBarry Smith EXTERN int MatZeroColumns(Mat,IS,const PetscScalar*);
4027b80b807SBarry Smith 
403ca44d042SBarry Smith EXTERN int MatUseScaledForm(Mat,PetscTruth);
404ca44d042SBarry Smith EXTERN int MatScaleSystem(Mat,Vec,Vec);
405ca44d042SBarry Smith EXTERN int MatUnScaleSystem(Mat,Vec,Vec);
4065ef9f2a5SBarry Smith 
407ca44d042SBarry Smith EXTERN int MatGetSize(Mat,int*,int*);
408ca44d042SBarry Smith EXTERN int MatGetLocalSize(Mat,int*,int*);
409ca44d042SBarry Smith EXTERN int MatGetOwnershipRange(Mat,int*,int*);
4107b80b807SBarry Smith 
411d91e6319SBarry Smith /*E
412d91e6319SBarry Smith     MatReuse - Indicates if matrices obtained from a previous call to MatGetSubMatrices()
413d91e6319SBarry Smith      or MatGetSubMatrix() are to be reused to store the new matrix values.
414d91e6319SBarry Smith 
415d91e6319SBarry Smith     Level: beginner
416d91e6319SBarry Smith 
417d91e6319SBarry Smith    Any additions/changes here MUST also be made in include/finclude/petscmat.h
418d91e6319SBarry Smith 
419d91e6319SBarry Smith .seealso: MatGetSubMatrices(), MatGetSubMatrix(), MatDestroyMatrices()
420d91e6319SBarry Smith E*/
4217b2a1423SBarry Smith typedef enum {MAT_INITIAL_MATRIX,MAT_REUSE_MATRIX} MatReuse;
422268466fbSBarry Smith EXTERN int MatGetSubMatrices(Mat,int,const IS[],const IS[],MatReuse,Mat *[]);
423268466fbSBarry Smith EXTERN int MatDestroyMatrices(int,Mat *[]);
424ca44d042SBarry Smith EXTERN int MatGetSubMatrix(Mat,IS,IS,int,MatReuse,Mat *);
4258efafbd8SBarry Smith 
426268466fbSBarry Smith EXTERN int MatIncreaseOverlap(Mat,int,IS[],int);
4277b80b807SBarry Smith 
428268466fbSBarry Smith EXTERN int MatAXPY(const PetscScalar *,Mat,Mat,MatStructure);
429268466fbSBarry Smith EXTERN int MatAYPX(const PetscScalar *,Mat,Mat);
430ca44d042SBarry Smith EXTERN int MatCompress(Mat);
4317b80b807SBarry Smith 
432268466fbSBarry Smith EXTERN int MatScale(const PetscScalar *,Mat);
433268466fbSBarry Smith EXTERN int MatShift(const PetscScalar *,Mat);
434052efed2SBarry Smith 
435ca44d042SBarry Smith EXTERN int MatSetLocalToGlobalMapping(Mat,ISLocalToGlobalMapping);
436ca44d042SBarry Smith EXTERN int MatSetLocalToGlobalMappingBlock(Mat,ISLocalToGlobalMapping);
437268466fbSBarry Smith EXTERN int MatZeroRowsLocal(Mat,IS,const PetscScalar*);
438f15d580aSBarry Smith EXTERN int MatSetValuesLocal(Mat,int,const int[],int,const int[],const PetscScalar[],InsertMode);
439f15d580aSBarry Smith EXTERN int MatSetValuesBlockedLocal(Mat,int,const int[],int,const int[],const PetscScalar[],InsertMode);
44090f02eecSBarry Smith 
441ca44d042SBarry Smith EXTERN int MatSetStashInitialSize(Mat,int,int);
442649db694SBarry Smith 
443ca44d042SBarry Smith EXTERN int MatInterpolateAdd(Mat,Vec,Vec,Vec);
444ca44d042SBarry Smith EXTERN int MatInterpolate(Mat,Vec,Vec);
445ca44d042SBarry Smith EXTERN int MatRestrict(Mat,Vec,Vec);
4467c922b88SBarry Smith 
447bd481603SBarry Smith 
448bd481603SBarry Smith /*MC
449bd481603SBarry Smith    MatPreallocInitialize - Begins the block of code that will count the number of nonzeros per
450bd481603SBarry Smith        row in a matrix providing the data that one can use to correctly preallocate the matrix.
451bd481603SBarry Smith 
452bd481603SBarry Smith    Synopsis:
453bd481603SBarry Smith    int MatPreallocateInitialize(MPI_Comm comm, int nrows, int ncols, int *dnz, int *onz)
454bd481603SBarry Smith 
455bd481603SBarry Smith    Collective on MPI_Comm
456bd481603SBarry Smith 
457bd481603SBarry Smith    Input Parameters:
458bd481603SBarry Smith +  comm - the communicator that will share the eventually allocated matrix
459bd481603SBarry Smith .  nrows - the number of rows in the matrix
460bd481603SBarry Smith -  ncols - the number of columns in the matrix
461bd481603SBarry Smith 
462bd481603SBarry Smith    Output Parameters:
463bd481603SBarry Smith +  dnz - the array that will be passed to the matrix preallocation routines
464bd481603SBarry Smith -  ozn - the other array passed to the matrix preallocation routines
465bd481603SBarry Smith 
466bd481603SBarry Smith 
467bd481603SBarry Smith    Level: intermediate
468bd481603SBarry Smith 
469bd481603SBarry Smith    Notes:
470bd481603SBarry Smith    See the chapter in the users manual on performance for more details
471bd481603SBarry Smith 
472bd481603SBarry Smith    Do not malloc or free dnz and onz that is handled internally by these routines
473bd481603SBarry Smith 
474bd481603SBarry Smith    Use MatPreallocateInitializeSymmetric() for symmetric matrices (MPISBAIJ matrices)
475bd481603SBarry Smith 
476bd481603SBarry Smith   Concepts: preallocation^Matrix
477bd481603SBarry Smith 
478bd481603SBarry Smith .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateSetLocal(),
479bd481603SBarry Smith           MatPreallocateInitializeSymmetric(), MatPreallocateSymmetricSetLocal()
480bd481603SBarry Smith M*/
481c4f061fbSSatish Balay #define MatPreallocateInitialize(comm,nrows,ncols,dnz,onz) 0; \
4827c922b88SBarry Smith { \
483ef66eb69SBarry Smith   int _4_ierr,__tmp = (nrows),__ctmp = (ncols),__rstart,__start,__end; \
484ef66eb69SBarry Smith   _4_ierr = PetscMalloc(2*__tmp*sizeof(int),&dnz);CHKERRQ(_4_ierr);onz = dnz + __tmp;\
485ef66eb69SBarry Smith   _4_ierr = PetscMemzero(dnz,2*__tmp*sizeof(int));CHKERRQ(_4_ierr);\
486ef66eb69SBarry Smith   _4_ierr = MPI_Scan(&__ctmp,&__end,1,MPI_INT,MPI_SUM,comm);CHKERRQ(_4_ierr); __start = __end - __ctmp;\
487ef66eb69SBarry Smith   _4_ierr = MPI_Scan(&__tmp,&__rstart,1,MPI_INT,MPI_SUM,comm);CHKERRQ(_4_ierr); __rstart = __rstart - __tmp;
4887c922b88SBarry Smith 
489bd481603SBarry Smith /*MC
490bd481603SBarry Smith    MatPreallocSymmetricInitialize - Begins the block of code that will count the number of nonzeros per
491bd481603SBarry Smith        row in a matrix providing the data that one can use to correctly preallocate the matrix.
492bd481603SBarry Smith 
493bd481603SBarry Smith    Synopsis:
494bd481603SBarry Smith    int MatPreallocateSymmetricInitialize(MPI_Comm comm, int nrows, int ncols, int *dnz, int *onz)
495bd481603SBarry Smith 
496bd481603SBarry Smith    Collective on MPI_Comm
497bd481603SBarry Smith 
498bd481603SBarry Smith    Input Parameters:
499bd481603SBarry Smith +  comm - the communicator that will share the eventually allocated matrix
500bd481603SBarry Smith .  nrows - the number of rows in the matrix
501bd481603SBarry Smith -  ncols - the number of columns in the matrix
502bd481603SBarry Smith 
503bd481603SBarry Smith    Output Parameters:
504bd481603SBarry Smith +  dnz - the array that will be passed to the matrix preallocation routines
505bd481603SBarry Smith -  ozn - the other array passed to the matrix preallocation routines
506bd481603SBarry Smith 
507bd481603SBarry Smith 
508bd481603SBarry Smith    Level: intermediate
509bd481603SBarry Smith 
510bd481603SBarry Smith    Notes:
511bd481603SBarry Smith    See the chapter in the users manual on performance for more details
512bd481603SBarry Smith 
513bd481603SBarry Smith    Do not malloc or free dnz and onz that is handled internally by these routines
514bd481603SBarry Smith 
515bd481603SBarry Smith   Concepts: preallocation^Matrix
516bd481603SBarry Smith 
517bd481603SBarry Smith .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateSetLocal(),
518bd481603SBarry Smith           MatPreallocateInitialize(), MatPreallocateSymmetricSetLocal()
519bd481603SBarry Smith M*/
520222b16d4SBarry Smith #define MatPreallocateSymmetricInitialize(comm,nrows,ncols,dnz,onz) 0; \
521222b16d4SBarry Smith { \
522222b16d4SBarry Smith   int _4_ierr,__tmp = (nrows),__ctmp = (ncols),__rstart,__end; \
523222b16d4SBarry Smith   _4_ierr = PetscMalloc(2*__tmp*sizeof(int),&dnz);CHKERRQ(_4_ierr);onz = dnz + __tmp;\
524222b16d4SBarry Smith   _4_ierr = PetscMemzero(dnz,2*__tmp*sizeof(int));CHKERRQ(_4_ierr);\
525222b16d4SBarry Smith   _4_ierr = MPI_Scan(&__ctmp,&__end,1,MPI_INT,MPI_SUM,comm);CHKERRQ(_4_ierr);\
526222b16d4SBarry Smith   _4_ierr = MPI_Scan(&__tmp,&__rstart,1,MPI_INT,MPI_SUM,comm);CHKERRQ(_4_ierr); __rstart = __rstart - __tmp;
527222b16d4SBarry Smith 
528bd481603SBarry Smith /*MC
529bd481603SBarry Smith    MatPreallocateSetLocal - Indicates the locations (rows and columns) in the matrix where nonzeros will be
530bd481603SBarry Smith        inserted using a local number of the rows and columns
531bd481603SBarry Smith 
532bd481603SBarry Smith    Synopsis:
533bd481603SBarry Smith    int MatPreallocateSetLocal(ISLocalToGlobalMappping map,int nrows, int *rows,int ncols, int *cols,int *dnz, int *onz)
534bd481603SBarry Smith 
535bd481603SBarry Smith    Not Collective
536bd481603SBarry Smith 
537bd481603SBarry Smith    Input Parameters:
538bd481603SBarry Smith +  map - the mapping between local numbering and global numbering
539bd481603SBarry Smith .  nrows - the number of rows indicated
540bd481603SBarry Smith .  rows - the indices of the rows (these will be mapped in the
541bd481603SBarry Smith .  ncols - the number of columns in the matrix
542bd481603SBarry Smith .  cols - the columns indicated
543bd481603SBarry Smith .  dnz - the array that will be passed to the matrix preallocation routines
544bd481603SBarry Smith -  ozn - the other array passed to the matrix preallocation routines
545bd481603SBarry Smith 
546bd481603SBarry Smith 
547bd481603SBarry Smith    Level: intermediate
548bd481603SBarry Smith 
549bd481603SBarry Smith    Notes:
550bd481603SBarry Smith    See the chapter in the users manual on performance for more details
551bd481603SBarry Smith 
552bd481603SBarry Smith    Do not malloc or free dnz and onz that is handled internally by these routines
553bd481603SBarry Smith 
554bd481603SBarry Smith   Concepts: preallocation^Matrix
555bd481603SBarry Smith 
556bd481603SBarry Smith .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateInitialize(),
557bd481603SBarry Smith           MatPreallocateInitialize(), MatPreallocateSymmetricSetLocal()
558bd481603SBarry Smith M*/
559c4f061fbSSatish Balay #define MatPreallocateSetLocal(map,nrows,rows,ncols,cols,dnz,onz) 0;\
560c4f061fbSSatish Balay {\
561c4f061fbSSatish Balay   int __l;\
562ef66eb69SBarry Smith   _4_ierr = ISLocalToGlobalMappingApply(map,nrows,rows,rows);CHKERRQ(_4_ierr);\
563ef66eb69SBarry Smith   _4_ierr = ISLocalToGlobalMappingApply(map,ncols,cols,cols);CHKERRQ(_4_ierr);\
564c4f061fbSSatish Balay   for (__l=0;__l<nrows;__l++) {\
565ef66eb69SBarry Smith     _4_ierr = MatPreallocateSet((rows)[__l],ncols,cols,dnz,onz);CHKERRQ(_4_ierr);\
566c4f061fbSSatish Balay   }\
567c4f061fbSSatish Balay }
568c4f061fbSSatish Balay 
569bd481603SBarry Smith /*MC
570bd481603SBarry Smith    MatPreallocateSymmetricSetLocal - Indicates the locations (rows and columns) in the matrix where nonzeros will be
571bd481603SBarry Smith        inserted using a local number of the rows and columns
572bd481603SBarry Smith 
573bd481603SBarry Smith    Synopsis:
574bd481603SBarry Smith    int MatPreallocateSymmetricSetLocal(ISLocalToGlobalMappping map,int nrows, int *rows,int ncols, int *cols,int *dnz, int *onz)
575bd481603SBarry Smith 
576bd481603SBarry Smith    Not Collective
577bd481603SBarry Smith 
578bd481603SBarry Smith    Input Parameters:
579bd481603SBarry Smith +  map - the mapping between local numbering and global numbering
580bd481603SBarry Smith .  nrows - the number of rows indicated
581bd481603SBarry Smith .  rows - the indices of the rows (these will be mapped in the
582bd481603SBarry Smith .  ncols - the number of columns in the matrix
583bd481603SBarry Smith .  cols - the columns indicated
584bd481603SBarry Smith .  dnz - the array that will be passed to the matrix preallocation routines
585bd481603SBarry Smith -  ozn - the other array passed to the matrix preallocation routines
586bd481603SBarry Smith 
587bd481603SBarry Smith 
588bd481603SBarry Smith    Level: intermediate
589bd481603SBarry Smith 
590bd481603SBarry Smith    Notes:
591bd481603SBarry Smith    See the chapter in the users manual on performance for more details
592bd481603SBarry Smith 
593bd481603SBarry Smith    Do not malloc or free dnz and onz that is handled internally by these routines
594bd481603SBarry Smith 
595bd481603SBarry Smith   Concepts: preallocation^Matrix
596bd481603SBarry Smith 
597bd481603SBarry Smith .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateInitialize(),
598bd481603SBarry Smith           MatPreallocateInitialize(), MatPreallocateSymmetricSetLocal(), MatPreallocateSetLocal()
599bd481603SBarry Smith M*/
600d3d32019SBarry Smith #define MatPreallocateSymmetricSetLocal(map,nrows,rows,ncols,cols,dnz,onz) 0;\
601d3d32019SBarry Smith {\
602d3d32019SBarry Smith   int __l;\
603d3d32019SBarry Smith   _4_ierr = ISLocalToGlobalMappingApply(map,nrows,rows,rows);CHKERRQ(_4_ierr);\
604d3d32019SBarry Smith   _4_ierr = ISLocalToGlobalMappingApply(map,ncols,cols,cols);CHKERRQ(_4_ierr);\
605d3d32019SBarry Smith   for (__l=0;__l<nrows;__l++) {\
606d3d32019SBarry Smith     _4_ierr = MatPreallocateSymmetricSet((rows)[__l],ncols,cols,dnz,onz);CHKERRQ(_4_ierr);\
607d3d32019SBarry Smith   }\
608d3d32019SBarry Smith }
609d3d32019SBarry Smith 
610bd481603SBarry Smith /*MC
611bd481603SBarry Smith    MatPreallocateSet - Indicates the locations (rows and columns) in the matrix where nonzeros will be
612bd481603SBarry Smith        inserted using a local number of the rows and columns
613bd481603SBarry Smith 
614bd481603SBarry Smith    Synopsis:
615bd481603SBarry Smith    int MatPreallocateSet(int nrows, int *rows,int ncols, int *cols,int *dnz, int *onz)
616bd481603SBarry Smith 
617bd481603SBarry Smith    Not Collective
618bd481603SBarry Smith 
619bd481603SBarry Smith    Input Parameters:
620bd481603SBarry Smith +  nrows - the number of rows indicated
621bd481603SBarry Smith .  rows - the indices of the rows (these will be mapped in the
622bd481603SBarry Smith .  ncols - the number of columns in the matrix
623bd481603SBarry Smith .  cols - the columns indicated
624bd481603SBarry Smith .  dnz - the array that will be passed to the matrix preallocation routines
625bd481603SBarry Smith -  ozn - the other array passed to the matrix preallocation routines
626bd481603SBarry Smith 
627bd481603SBarry Smith 
628bd481603SBarry Smith    Level: intermediate
629bd481603SBarry Smith 
630bd481603SBarry Smith    Notes:
631bd481603SBarry Smith    See the chapter in the users manual on performance for more details
632bd481603SBarry Smith 
633bd481603SBarry Smith    Do not malloc or free dnz and onz that is handled internally by these routines
634bd481603SBarry Smith 
635bd481603SBarry Smith   Concepts: preallocation^Matrix
636bd481603SBarry Smith 
637bd481603SBarry Smith .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateInitialize(),
638bd481603SBarry Smith           MatPreallocateInitialize(), MatPreallocateSymmetricSetLocal(), MatPreallocateSetLocal()
639bd481603SBarry Smith M*/
640c4f061fbSSatish Balay #define MatPreallocateSet(row,nc,cols,dnz,onz) 0;\
6417c922b88SBarry Smith { int __i; \
6427c922b88SBarry Smith   for (__i=0; __i<nc; __i++) {\
6437c922b88SBarry Smith     if (cols[__i] < __start || cols[__i] >= __end) onz[row - __rstart]++; \
6447c922b88SBarry Smith   }\
6457c922b88SBarry Smith   dnz[row - __rstart] = nc - onz[row - __rstart];\
6467c922b88SBarry Smith }
6477c922b88SBarry Smith 
648bd481603SBarry Smith /*MC
649bd481603SBarry Smith    MatPreallocateSymmetricSet - Indicates the locations (rows and columns) in the matrix where nonzeros will be
650bd481603SBarry Smith        inserted using a local number of the rows and columns
651bd481603SBarry Smith 
652bd481603SBarry Smith    Synopsis:
653bd481603SBarry Smith    int MatPreallocateSymmetricSet(int nrows, int *rows,int ncols, int *cols,int *dnz, int *onz)
654bd481603SBarry Smith 
655bd481603SBarry Smith    Not Collective
656bd481603SBarry Smith 
657bd481603SBarry Smith    Input Parameters:
658bd481603SBarry Smith +  nrows - the number of rows indicated
659bd481603SBarry Smith .  rows - the indices of the rows (these will be mapped in the
660bd481603SBarry Smith .  ncols - the number of columns in the matrix
661bd481603SBarry Smith .  cols - the columns indicated
662bd481603SBarry Smith .  dnz - the array that will be passed to the matrix preallocation routines
663bd481603SBarry Smith -  ozn - the other array passed to the matrix preallocation routines
664bd481603SBarry Smith 
665bd481603SBarry Smith 
666bd481603SBarry Smith    Level: intermediate
667bd481603SBarry Smith 
668bd481603SBarry Smith    Notes:
669bd481603SBarry Smith    See the chapter in the users manual on performance for more details
670bd481603SBarry Smith 
671bd481603SBarry Smith    Do not malloc or free dnz and onz that is handled internally by these routines
672bd481603SBarry Smith 
673bd481603SBarry Smith   Concepts: preallocation^Matrix
674bd481603SBarry Smith 
675bd481603SBarry Smith .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateInitialize(),
676bd481603SBarry Smith           MatPreallocateInitialize(), MatPreallocateSymmetricSetLocal(), MatPreallocateSetLocal()
677bd481603SBarry Smith M*/
678d3d32019SBarry Smith #define MatPreallocateSymmetricSet(row,nc,cols,dnz,onz) 0;\
679d3d32019SBarry Smith { int __i; \
680d3d32019SBarry Smith   for (__i=0; __i<nc; __i++) {\
681d3d32019SBarry Smith     if (cols[__i] >= __end) onz[row - __rstart]++; \
682d3d32019SBarry Smith     else if (cols[__i] >= row) dnz[row - __rstart]++;\
683d3d32019SBarry Smith   }\
684d3d32019SBarry Smith }
685d3d32019SBarry Smith 
686bd481603SBarry Smith /*MC
687bd481603SBarry Smith    MatPreallocFinalize - Ends the block of code that will count the number of nonzeros per
688bd481603SBarry Smith        row in a matrix providing the data that one can use to correctly preallocate the matrix.
689bd481603SBarry Smith 
690bd481603SBarry Smith    Synopsis:
691bd481603SBarry Smith    int MatPreallocateFinalize(int *dnz, int *onz)
692bd481603SBarry Smith 
693bd481603SBarry Smith    Collective on MPI_Comm
694bd481603SBarry Smith 
695bd481603SBarry Smith    Input Parameters:
696bd481603SBarry Smith +  dnz - the array that will be passed to the matrix preallocation routines
697bd481603SBarry Smith -  ozn - the other array passed to the matrix preallocation routines
698bd481603SBarry Smith 
699bd481603SBarry Smith 
700bd481603SBarry Smith    Level: intermediate
701bd481603SBarry Smith 
702bd481603SBarry Smith    Notes:
703bd481603SBarry Smith    See the chapter in the users manual on performance for more details
704bd481603SBarry Smith 
705bd481603SBarry Smith    Do not malloc or free dnz and onz that is handled internally by these routines
706bd481603SBarry Smith 
707bd481603SBarry Smith   Concepts: preallocation^Matrix
708bd481603SBarry Smith 
709bd481603SBarry Smith .seealso: MatPreallocateInitialize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateSetLocal(),
710bd481603SBarry Smith           MatPreallocateSymmetricInitialize(), MatPreallocateSymmetricSetLocal()
711bd481603SBarry Smith M*/
712ef66eb69SBarry Smith #define MatPreallocateFinalize(dnz,onz) 0;_4_ierr = PetscFree(dnz);CHKERRQ(_4_ierr);}
7137c922b88SBarry Smith 
714bd481603SBarry Smith 
715bd481603SBarry Smith 
7167b80b807SBarry Smith /* Routines unique to particular data structures */
717435da068SBarry Smith EXTERN int MatShellGetContext(Mat,void **);
718435da068SBarry Smith 
719268466fbSBarry Smith EXTERN int MatBDiagGetData(Mat,int*,int*,int*[],int*[],PetscScalar***);
720ca01db9bSBarry Smith EXTERN int MatSeqAIJSetColumnIndices(Mat,int[]);
721ca01db9bSBarry Smith EXTERN int MatSeqBAIJSetColumnIndices(Mat,int[]);
722ca01db9bSBarry Smith EXTERN int MatCreateSeqAIJWithArrays(MPI_Comm,int,int,int[],int[],PetscScalar[],Mat*);
7237b80b807SBarry Smith 
724ca01db9bSBarry Smith EXTERN int MatSeqBAIJSetPreallocation(Mat,int,int,const int[]);
725ca01db9bSBarry Smith EXTERN int MatSeqSBAIJSetPreallocation(Mat,int,int,const int[]);
726ca01db9bSBarry Smith EXTERN int MatSeqAIJSetPreallocation(Mat,int,const int[]);
727ca01db9bSBarry Smith EXTERN int MatSeqDensePreallocation(Mat,PetscScalar[]);
728ca01db9bSBarry Smith EXTERN int MatSeqBDiagSetPreallocation(Mat,int,int,const int[],PetscScalar*[]);
729ca01db9bSBarry Smith EXTERN int MatSeqDenseSetPreallocation(Mat,PetscScalar[]);
730273d9f13SBarry Smith 
731ca01db9bSBarry Smith EXTERN int MatMPIBAIJSetPreallocation(Mat,int,int,const int[],int,const int[]);
732ca01db9bSBarry Smith EXTERN int MatMPISBAIJSetPreallocation(Mat,int,int,const int[],int,const int[]);
733ca01db9bSBarry Smith EXTERN int MatMPIAIJSetPreallocation(Mat,int,const int[],int,const int[]);
734ca01db9bSBarry Smith EXTERN int MatMPIDensePreallocation(Mat,PetscScalar[]);
735ca01db9bSBarry Smith EXTERN int MatMPIBDiagSetPreallocation(Mat,int,int,const int[],PetscScalar*[]);
736ca01db9bSBarry Smith EXTERN int MatMPIAdjSetPreallocation(Mat,int[],int[],int[]);
737ca01db9bSBarry Smith EXTERN int MatMPIDenseSetPreallocation(Mat,PetscScalar[]);
738ca01db9bSBarry Smith EXTERN int MatMPIRowbsSetPreallocation(Mat,int,const int[]);
739268466fbSBarry Smith EXTERN int MatMPIAIJGetSeqAIJ(Mat,Mat*,Mat*,int*[]);
740268466fbSBarry Smith EXTERN int MatMPIBAIJGetSeqBAIJ(Mat,Mat*,Mat*,int*[]);
7413a7fca6bSBarry Smith EXTERN int MatAdicSetLocalFunction(Mat,void (*)(void));
742273d9f13SBarry Smith 
7431b807ce4Svictorle EXTERN int MatSeqDenseSetLDA(Mat,int);
7441b807ce4Svictorle 
745ca44d042SBarry Smith EXTERN int MatStoreValues(Mat);
746ca44d042SBarry Smith EXTERN int MatRetrieveValues(Mat);
7472e8a6d31SBarry Smith 
7483a7fca6bSBarry Smith EXTERN int MatDAADSetCtx(Mat,void*);
7493a7fca6bSBarry Smith 
7507b80b807SBarry Smith /*
7517b80b807SBarry Smith   These routines are not usually accessed directly, rather solving is
7527b80b807SBarry Smith   done through the SLES, KSP and PC interfaces.
7537b80b807SBarry Smith */
7547b80b807SBarry Smith 
755d9274352SBarry Smith /*E
756d9274352SBarry Smith     MatOrderingType - String with the name of a PETSc matrix ordering or the creation function
757d9274352SBarry Smith        with an optional dynamic library name, for example
758d9274352SBarry Smith        http://www.mcs.anl.gov/petsc/lib.a:orderingcreate()
759d9274352SBarry Smith 
760d9274352SBarry Smith    Level: beginner
761d9274352SBarry Smith 
762d9274352SBarry Smith .seealso: MatGetOrdering()
763d9274352SBarry Smith E*/
764b12f92e5SBarry Smith typedef char* MatOrderingType;
765b12f92e5SBarry Smith #define MATORDERING_NATURAL   "natural"
766b12f92e5SBarry Smith #define MATORDERING_ND        "nd"
767b12f92e5SBarry Smith #define MATORDERING_1WD       "1wd"
768b12f92e5SBarry Smith #define MATORDERING_RCM       "rcm"
769b12f92e5SBarry Smith #define MATORDERING_QMD       "qmd"
770b12f92e5SBarry Smith #define MATORDERING_ROWLENGTH "rowlength"
77162152c8bSBarry Smith #define MATORDERING_DSC_ND    "dsc_nd"
77262152c8bSBarry Smith #define MATORDERING_DSC_MMD   "dsc_mmd"
77362152c8bSBarry Smith #define MATORDERING_DSC_MDF   "dsc_mdf"
774c06d978dSMatthew Knepley #define MATORDERING_CONSTRAINED "constrained"
775c06d978dSMatthew Knepley #define MATORDERING_IDENTITY  "identity"
776c06d978dSMatthew Knepley #define MATORDERING_REVERSE   "reverse"
777b12f92e5SBarry Smith 
778ca44d042SBarry Smith EXTERN int MatGetOrdering(Mat,MatOrderingType,IS*,IS*);
779ca44d042SBarry Smith EXTERN int MatOrderingRegister(char*,char*,char*,int(*)(Mat,MatOrderingType,IS*,IS*));
78030de9b25SBarry Smith 
78130de9b25SBarry Smith /*MC
78230de9b25SBarry Smith    MatOrderingRegisterDynamic - Adds a new sparse matrix ordering to the
78330de9b25SBarry Smith                                matrix package.
78430de9b25SBarry Smith 
78530de9b25SBarry Smith    Synopsis:
78630de9b25SBarry Smith    int MatOrderingRegisterDynamic(char *name_ordering,char *path,char *name_create,int (*routine_create)(MatOrdering))
78730de9b25SBarry Smith 
78830de9b25SBarry Smith    Not Collective
78930de9b25SBarry Smith 
79030de9b25SBarry Smith    Input Parameters:
79130de9b25SBarry Smith +  sname - name of ordering (for example MATORDERING_ND)
79230de9b25SBarry Smith .  path - location of library where creation routine is
79330de9b25SBarry Smith .  name - name of function that creates the ordering type,a string
79430de9b25SBarry Smith -  function - function pointer that creates the ordering
79530de9b25SBarry Smith 
79630de9b25SBarry Smith    Level: developer
79730de9b25SBarry Smith 
79830de9b25SBarry Smith    If dynamic libraries are used, then the fourth input argument (function)
79930de9b25SBarry Smith    is ignored.
80030de9b25SBarry Smith 
80130de9b25SBarry Smith    Sample usage:
80230de9b25SBarry Smith .vb
80330de9b25SBarry Smith    MatOrderingRegisterDynamic("my_order",/home/username/my_lib/lib/libO/solaris/mylib.a,
80430de9b25SBarry Smith                "MyOrder",MyOrder);
80530de9b25SBarry Smith .ve
80630de9b25SBarry Smith 
80730de9b25SBarry Smith    Then, your partitioner can be chosen with the procedural interface via
80830de9b25SBarry Smith $     MatOrderingSetType(part,"my_order)
80930de9b25SBarry Smith    or at runtime via the option
81030de9b25SBarry Smith $     -pc_ilu_mat_ordering_type my_order
81130de9b25SBarry Smith $     -pc_lu_mat_ordering_type my_order
81230de9b25SBarry Smith 
81330de9b25SBarry Smith    ${PETSC_ARCH} and ${BOPT} occuring in pathname will be replaced with appropriate values.
81430de9b25SBarry Smith 
81530de9b25SBarry Smith .keywords: matrix, ordering, register
81630de9b25SBarry Smith 
81730de9b25SBarry Smith .seealso: MatOrderingRegisterDestroy(), MatOrderingRegisterAll()
81830de9b25SBarry Smith M*/
819aa482453SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
820f1af5d2fSBarry Smith #define MatOrderingRegisterDynamic(a,b,c,d) MatOrderingRegister(a,b,c,0)
821b12f92e5SBarry Smith #else
822f1af5d2fSBarry Smith #define MatOrderingRegisterDynamic(a,b,c,d) MatOrderingRegister(a,b,c,d)
823b12f92e5SBarry Smith #endif
82430de9b25SBarry Smith 
825ca44d042SBarry Smith EXTERN int        MatOrderingRegisterDestroy(void);
826ca44d042SBarry Smith EXTERN int        MatOrderingRegisterAll(char*);
8272bad1931SBarry Smith extern PetscTruth MatOrderingRegisterAllCalled;
828b0a32e0cSBarry Smith extern PetscFList MatOrderingList;
829d4fbbf0eSBarry Smith 
83087828ca2SBarry Smith EXTERN int MatReorderForNonzeroDiagonal(Mat,PetscReal,IS,IS);
831a2ce50c7SBarry Smith 
832d91e6319SBarry Smith /*S
83315e8a5b3SHong Zhang    MatFactorInfo - Data based into the matrix factorization routines
834b00f7748SHong Zhang 
83515e8a5b3SHong Zhang    In Fortran these are simply double precision arrays of size MAT_FACTORINFO_SIZE
836b00f7748SHong Zhang 
83715e8a5b3SHong Zhang    Notes: These are not usually directly used by users, instead use PC type of LU, ILU, CHOLESKY or ICC.
838b00f7748SHong Zhang 
839b00f7748SHong Zhang    Level: developer
840b00f7748SHong Zhang 
841b380c88cSHong Zhang .seealso: MatLUFactorSymbolic(), MatILUFactorSymbolic(), MatCholeskyFactorSymbolic(), MatICCFactorSymbolic(), MatICCFactor()
842b00f7748SHong Zhang 
843b00f7748SHong Zhang S*/
844b00f7748SHong Zhang typedef struct {
84515e8a5b3SHong Zhang   PetscReal     damping;        /* scaling of identity added to matrix to prevent zero pivots */
8462cea7109SBarry Smith   PetscReal     shift;          /* if true, shift until positive pivots */
8472cea7109SBarry Smith   PetscReal     shift_fraction; /* record shift fraction taken */
84815e8a5b3SHong Zhang   PetscReal     diagonal_fill;  /* force diagonal to fill in if initially not filled */
84915e8a5b3SHong Zhang   PetscReal     dt;             /* drop tolerance */
850b00f7748SHong Zhang   PetscReal     dtcol;          /* tolerance for pivoting */
85115e8a5b3SHong Zhang   PetscReal     dtcount;        /* maximum nonzeros to be allowed per row */
852f6275e2eSBarry Smith   PetscReal     fill;           /* expected fill; nonzeros in factored matrix/nonzeros in original matrix*/
853348344bbSBarry Smith   PetscReal     levels;         /* ICC/ILU(levels) */
854bcd9e38bSBarry Smith   PetscReal     pivotinblocks;  /* for BAIJ and SBAIJ matrices pivot in factorization on blocks, default 1.0
855bcd9e38bSBarry Smith                                    factorization may be faster if do not pivot */
85615e8a5b3SHong Zhang   PetscReal     zeropivot;      /* pivot is called zero if less than this */
85715e8a5b3SHong Zhang } MatFactorInfo;
858ffa6d0a5SLois Curfman McInnes 
85915e8a5b3SHong Zhang EXTERN int MatCholeskyFactor(Mat,IS,MatFactorInfo*);
86015e8a5b3SHong Zhang EXTERN int MatCholeskyFactorSymbolic(Mat,IS,MatFactorInfo*,Mat*);
86115e8a5b3SHong Zhang EXTERN int MatCholeskyFactorNumeric(Mat,Mat*);
862b380c88cSHong Zhang EXTERN int MatLUFactor(Mat,IS,IS,MatFactorInfo*);
863b380c88cSHong Zhang EXTERN int MatILUFactor(Mat,IS,IS,MatFactorInfo*);
864b380c88cSHong Zhang EXTERN int MatLUFactorSymbolic(Mat,IS,IS,MatFactorInfo*,Mat*);
865b380c88cSHong Zhang EXTERN int MatILUFactorSymbolic(Mat,IS,IS,MatFactorInfo*,Mat*);
86615e8a5b3SHong Zhang EXTERN int MatICCFactorSymbolic(Mat,IS,MatFactorInfo*,Mat*);
86715e8a5b3SHong Zhang EXTERN int MatICCFactor(Mat,IS,MatFactorInfo*);
868ca44d042SBarry Smith EXTERN int MatLUFactorNumeric(Mat,Mat*);
869b380c88cSHong Zhang EXTERN int MatILUDTFactor(Mat,MatFactorInfo*,IS,IS,Mat *);
8703e0d88b5SBarry Smith EXTERN int MatGetInertia(Mat,int*,int*,int*);
871ca44d042SBarry Smith EXTERN int MatSolve(Mat,Vec,Vec);
872ca44d042SBarry Smith EXTERN int MatForwardSolve(Mat,Vec,Vec);
873ca44d042SBarry Smith EXTERN int MatBackwardSolve(Mat,Vec,Vec);
874ca44d042SBarry Smith EXTERN int MatSolveAdd(Mat,Vec,Vec,Vec);
875ca44d042SBarry Smith EXTERN int MatSolveTranspose(Mat,Vec,Vec);
876ca44d042SBarry Smith EXTERN int MatSolveTransposeAdd(Mat,Vec,Vec,Vec);
877d59c15a7SBarry Smith EXTERN int MatSolves(Mat,Vecs,Vecs);
8788ed539a5SBarry Smith 
879ca44d042SBarry Smith EXTERN int MatSetUnfactored(Mat);
880bb5a7306SBarry Smith 
881d91e6319SBarry Smith /*E
882d91e6319SBarry Smith     MatSORType - What type of (S)SOR to perform
883bb1eb677SSatish Balay 
884d91e6319SBarry Smith     Level: beginner
885d91e6319SBarry Smith 
886d9274352SBarry Smith    May be bitwise ORd together
887d9274352SBarry Smith 
888d91e6319SBarry Smith    Any additions/changes here MUST also be made in include/finclude/petscmat.h
889d91e6319SBarry Smith 
8904e7234bfSBarry Smith    MatSORType may be bitwise ORd together, so do not change the numbers
8914e7234bfSBarry Smith 
892d91e6319SBarry Smith .seealso: MatRelax()
893d91e6319SBarry Smith E*/
894ee50ffe9SBarry Smith typedef enum {SOR_FORWARD_SWEEP=1,SOR_BACKWARD_SWEEP=2,SOR_SYMMETRIC_SWEEP=3,
895ee50ffe9SBarry Smith               SOR_LOCAL_FORWARD_SWEEP=4,SOR_LOCAL_BACKWARD_SWEEP=8,
896ee50ffe9SBarry Smith               SOR_LOCAL_SYMMETRIC_SWEEP=12,SOR_ZERO_INITIAL_GUESS=16,
89784cb2905SBarry Smith               SOR_EISENSTAT=32,SOR_APPLY_UPPER=64,SOR_APPLY_LOWER=128} MatSORType;
898c14dc6b6SHong Zhang EXTERN int MatRelax(Mat,Vec,PetscReal,MatSORType,PetscReal,int,int,Vec);
8998ed539a5SBarry Smith 
900d4fbbf0eSBarry Smith /*
901639f9d9dSBarry Smith     These routines are for efficiently computing Jacobians via finite differences.
902639f9d9dSBarry Smith */
903b12f92e5SBarry Smith 
904d9274352SBarry Smith /*E
905d9274352SBarry Smith     MatColoringType - String with the name of a PETSc matrix coloring or the creation function
906d9274352SBarry Smith        with an optional dynamic library name, for example
907d9274352SBarry Smith        http://www.mcs.anl.gov/petsc/lib.a:coloringcreate()
908d9274352SBarry Smith 
909d9274352SBarry Smith    Level: beginner
910d9274352SBarry Smith 
911d9274352SBarry Smith .seealso: MatGetColoring()
912d9274352SBarry Smith E*/
913b12f92e5SBarry Smith typedef char* MatColoringType;
914b12f92e5SBarry Smith #define MATCOLORING_NATURAL "natural"
915b12f92e5SBarry Smith #define MATCOLORING_SL      "sl"
916b12f92e5SBarry Smith #define MATCOLORING_LF      "lf"
917b12f92e5SBarry Smith #define MATCOLORING_ID      "id"
918b12f92e5SBarry Smith 
919ca44d042SBarry Smith EXTERN int MatGetColoring(Mat,MatColoringType,ISColoring*);
920ca44d042SBarry Smith EXTERN int MatColoringRegister(char*,char*,char*,int(*)(Mat,MatColoringType,ISColoring *));
92130de9b25SBarry Smith 
92230de9b25SBarry Smith /*MC
92330de9b25SBarry Smith    MatColoringRegisterDynamic - Adds a new sparse matrix coloring to the
92430de9b25SBarry Smith                                matrix package.
92530de9b25SBarry Smith 
92630de9b25SBarry Smith    Synopsis:
92730de9b25SBarry Smith    int MatColoringRegisterDynamic(char *name_coloring,char *path,char *name_create,int (*routine_create)(MatColoring))
92830de9b25SBarry Smith 
92930de9b25SBarry Smith    Not Collective
93030de9b25SBarry Smith 
93130de9b25SBarry Smith    Input Parameters:
93230de9b25SBarry Smith +  sname - name of Coloring (for example MATCOLORING_SL)
93330de9b25SBarry Smith .  path - location of library where creation routine is
93430de9b25SBarry Smith .  name - name of function that creates the Coloring type, a string
93530de9b25SBarry Smith -  function - function pointer that creates the coloring
93630de9b25SBarry Smith 
93730de9b25SBarry Smith    Level: developer
93830de9b25SBarry Smith 
93930de9b25SBarry Smith    If dynamic libraries are used, then the fourth input argument (function)
94030de9b25SBarry Smith    is ignored.
94130de9b25SBarry Smith 
94230de9b25SBarry Smith    Sample usage:
94330de9b25SBarry Smith .vb
94430de9b25SBarry Smith    MatColoringRegisterDynamic("my_color",/home/username/my_lib/lib/libO/solaris/mylib.a,
94530de9b25SBarry Smith                "MyColor",MyColor);
94630de9b25SBarry Smith .ve
94730de9b25SBarry Smith 
94830de9b25SBarry Smith    Then, your partitioner can be chosen with the procedural interface via
94930de9b25SBarry Smith $     MatColoringSetType(part,"my_color")
95030de9b25SBarry Smith    or at runtime via the option
95130de9b25SBarry Smith $     -mat_coloring_type my_color
95230de9b25SBarry Smith 
95330de9b25SBarry Smith    $PETSC_ARCH and $BOPT occuring in pathname will be replaced with appropriate values.
95430de9b25SBarry Smith 
95530de9b25SBarry Smith .keywords: matrix, Coloring, register
95630de9b25SBarry Smith 
95730de9b25SBarry Smith .seealso: MatColoringRegisterDestroy(), MatColoringRegisterAll()
95830de9b25SBarry Smith M*/
959aa482453SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
960f1af5d2fSBarry Smith #define MatColoringRegisterDynamic(a,b,c,d) MatColoringRegister(a,b,c,0)
961b12f92e5SBarry Smith #else
962f1af5d2fSBarry Smith #define MatColoringRegisterDynamic(a,b,c,d) MatColoringRegister(a,b,c,d)
963b12f92e5SBarry Smith #endif
96430de9b25SBarry Smith 
965ca44d042SBarry Smith EXTERN int        MatColoringRegisterAll(char *);
9662bad1931SBarry Smith extern PetscTruth MatColoringRegisterAllCalled;
967ca44d042SBarry Smith EXTERN int        MatColoringRegisterDestroy(void);
9684e7234bfSBarry Smith EXTERN int        MatColoringPatch(Mat,int,int,const ISColoringValue[],ISColoring*);
969639f9d9dSBarry Smith 
970d9274352SBarry Smith /*S
971d9274352SBarry Smith      MatFDColoring - Object for computing a sparse Jacobian via finite differences
972d9274352SBarry Smith         and coloring
973639f9d9dSBarry Smith 
974d9274352SBarry Smith    Level: beginner
975d9274352SBarry Smith 
976d9274352SBarry Smith   Concepts: coloring, sparse Jacobian, finite differences
977d9274352SBarry Smith 
978d9274352SBarry Smith .seealso:  MatFDColoringCreate()
979d9274352SBarry Smith S*/
980e2a1c21fSSatish Balay typedef struct _p_MatFDColoring *MatFDColoring;
981639f9d9dSBarry Smith 
982ca44d042SBarry Smith EXTERN int MatFDColoringCreate(Mat,ISColoring,MatFDColoring *);
983ca44d042SBarry Smith EXTERN int MatFDColoringDestroy(MatFDColoring);
984b0a32e0cSBarry Smith EXTERN int MatFDColoringView(MatFDColoring,PetscViewer);
985ca44d042SBarry Smith EXTERN int MatFDColoringSetFunction(MatFDColoring,int (*)(void),void*);
98687828ca2SBarry Smith EXTERN int MatFDColoringSetParameters(MatFDColoring,PetscReal,PetscReal);
987ca44d042SBarry Smith EXTERN int MatFDColoringSetFrequency(MatFDColoring,int);
988ca44d042SBarry Smith EXTERN int MatFDColoringGetFrequency(MatFDColoring,int*);
989ca44d042SBarry Smith EXTERN int MatFDColoringSetFromOptions(MatFDColoring);
990ca44d042SBarry Smith EXTERN int MatFDColoringApply(Mat,MatFDColoring,Vec,MatStructure*,void *);
99187828ca2SBarry Smith EXTERN int MatFDColoringApplyTS(Mat,MatFDColoring,PetscReal,Vec,MatStructure*,void *);
99262152c8bSBarry Smith EXTERN int MatFDColoringSetRecompute(MatFDColoring);
9933a7fca6bSBarry Smith EXTERN int MatFDColoringSetF(MatFDColoring,Vec);
9944e7234bfSBarry Smith EXTERN int MatFDColoringGetPerturbedColumns(MatFDColoring,int*,int*[]);
995639f9d9dSBarry Smith /*
9960752156aSBarry Smith     These routines are for partitioning matrices: currently used only
9973eda8832SBarry Smith   for adjacency matrix, MatCreateMPIAdj().
9980752156aSBarry Smith */
999ca161407SBarry Smith 
1000d9274352SBarry Smith /*S
1001d9274352SBarry Smith      MatPartitioning - Object for managing the partitioning of a matrix or graph
1002d9274352SBarry Smith 
1003d9274352SBarry Smith    Level: beginner
1004d9274352SBarry Smith 
1005d9274352SBarry Smith   Concepts: partitioning
1006d9274352SBarry Smith 
1007743a1026Svictorle .seealso:  MatPartitioningCreate(), MatPartitioningType
1008d9274352SBarry Smith S*/
100991e9ee9fSBarry Smith typedef struct _p_MatPartitioning *MatPartitioning;
1010d9274352SBarry Smith 
1011d9274352SBarry Smith /*E
10125bc6e7ccSvictorle     MatPartitioningType - String with the name of a PETSc matrix partitioning or the creation function
1013d9274352SBarry Smith        with an optional dynamic library name, for example
1014d9274352SBarry Smith        http://www.mcs.anl.gov/petsc/lib.a:partitioningcreate()
1015d9274352SBarry Smith 
1016d9274352SBarry Smith    Level: beginner
1017d9274352SBarry Smith 
1018b547a13bSvictorle .seealso: MatPartitioningCreate(), MatPartitioning
1019d9274352SBarry Smith E*/
10202aabb6bbSBarry Smith typedef char* MatPartitioningType;
10218ba1e511SMatthew Knepley #define MAT_PARTITIONING_CURRENT  "current"
10228ba1e511SMatthew Knepley #define MAT_PARTITIONING_PARMETIS "parmetis"
1023ca161407SBarry Smith 
1024ca44d042SBarry Smith EXTERN int MatPartitioningCreate(MPI_Comm,MatPartitioning*);
1025ca44d042SBarry Smith EXTERN int MatPartitioningSetType(MatPartitioning,MatPartitioningType);
10265bc6e7ccSvictorle EXTERN int MatPartitioningSetNParts(MatPartitioning,int);
1027ca44d042SBarry Smith EXTERN int MatPartitioningSetAdjacency(MatPartitioning,Mat);
10284e7234bfSBarry Smith EXTERN int MatPartitioningSetVertexWeights(MatPartitioning,const int[]);
10294e7234bfSBarry Smith EXTERN int MatPartitioningSetPartitionWeights(MatPartitioning,const PetscReal []);
1030ca44d042SBarry Smith EXTERN int MatPartitioningApply(MatPartitioning,IS*);
1031ca44d042SBarry Smith EXTERN int MatPartitioningDestroy(MatPartitioning);
10322aabb6bbSBarry Smith 
1033ca44d042SBarry Smith EXTERN int MatPartitioningRegister(char*,char*,char*,int(*)(MatPartitioning));
103430de9b25SBarry Smith 
103530de9b25SBarry Smith /*MC
103630de9b25SBarry Smith    MatPartitioningRegisterDynamic - Adds a new sparse matrix partitioning to the
103730de9b25SBarry Smith    matrix package.
103830de9b25SBarry Smith 
103930de9b25SBarry Smith    Synopsis:
104030de9b25SBarry Smith    int MatPartitioningRegisterDynamic(char *name_partitioning,char *path,char *name_create,int (*routine_create)(MatPartitioning))
104130de9b25SBarry Smith 
104230de9b25SBarry Smith    Not Collective
104330de9b25SBarry Smith 
104430de9b25SBarry Smith    Input Parameters:
104530de9b25SBarry Smith +  sname - name of partitioning (for example MAT_PARTITIONING_CURRENT) or parmetis
104630de9b25SBarry Smith .  path - location of library where creation routine is
104730de9b25SBarry Smith .  name - name of function that creates the partitioning type, a string
104830de9b25SBarry Smith -  function - function pointer that creates the partitioning type
104930de9b25SBarry Smith 
105030de9b25SBarry Smith    Level: developer
105130de9b25SBarry Smith 
105230de9b25SBarry Smith    If dynamic libraries are used, then the fourth input argument (function)
105330de9b25SBarry Smith    is ignored.
105430de9b25SBarry Smith 
105530de9b25SBarry Smith    Sample usage:
105630de9b25SBarry Smith .vb
105730de9b25SBarry Smith    MatPartitioningRegisterDynamic("my_part",/home/username/my_lib/lib/libO/solaris/mylib.a,
105830de9b25SBarry Smith                "MyPartCreate",MyPartCreate);
105930de9b25SBarry Smith .ve
106030de9b25SBarry Smith 
106130de9b25SBarry Smith    Then, your partitioner can be chosen with the procedural interface via
106230de9b25SBarry Smith $     MatPartitioningSetType(part,"my_part")
106330de9b25SBarry Smith    or at runtime via the option
106430de9b25SBarry Smith $     -mat_partitioning_type my_part
106530de9b25SBarry Smith 
106630de9b25SBarry Smith    $PETSC_ARCH and $BOPT occuring in pathname will be replaced with appropriate values.
106730de9b25SBarry Smith 
106830de9b25SBarry Smith .keywords: matrix, partitioning, register
106930de9b25SBarry Smith 
107030de9b25SBarry Smith .seealso: MatPartitioningRegisterDestroy(), MatPartitioningRegisterAll()
107130de9b25SBarry Smith M*/
1072aa482453SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
1073f1af5d2fSBarry Smith #define MatPartitioningRegisterDynamic(a,b,c,d) MatPartitioningRegister(a,b,c,0)
10742aabb6bbSBarry Smith #else
1075f1af5d2fSBarry Smith #define MatPartitioningRegisterDynamic(a,b,c,d) MatPartitioningRegister(a,b,c,d)
10762aabb6bbSBarry Smith #endif
10772aabb6bbSBarry Smith 
1078ca44d042SBarry Smith EXTERN int        MatPartitioningRegisterAll(char *);
10792bad1931SBarry Smith extern PetscTruth MatPartitioningRegisterAllCalled;
1080ca44d042SBarry Smith EXTERN int        MatPartitioningRegisterDestroy(void);
10812bad1931SBarry Smith 
1082b0a32e0cSBarry Smith EXTERN int MatPartitioningView(MatPartitioning,PetscViewer);
1083ca44d042SBarry Smith EXTERN int MatPartitioningSetFromOptions(MatPartitioning);
1084ca44d042SBarry Smith EXTERN int MatPartitioningGetType(MatPartitioning,MatPartitioningType*);
1085ca161407SBarry Smith 
1086ca44d042SBarry Smith EXTERN int MatPartitioningParmetisSetCoarseSequential(MatPartitioning);
10870752156aSBarry Smith 
10880752156aSBarry Smith /*
10890a835dfdSSatish Balay     If you add entries here you must also add them to finclude/petscmat.h
1090d4fbbf0eSBarry Smith */
10911c1c02c0SLois Curfman McInnes typedef enum { MATOP_SET_VALUES=0,
10921c1c02c0SLois Curfman McInnes                MATOP_GET_ROW=1,
10931c1c02c0SLois Curfman McInnes                MATOP_RESTORE_ROW=2,
10941c1c02c0SLois Curfman McInnes                MATOP_MULT=3,
10951c1c02c0SLois Curfman McInnes                MATOP_MULT_ADD=4,
10967c922b88SBarry Smith                MATOP_MULT_TRANSPOSE=5,
10977c922b88SBarry Smith                MATOP_MULT_TRANSPOSE_ADD=6,
10981c1c02c0SLois Curfman McInnes                MATOP_SOLVE=7,
10991c1c02c0SLois Curfman McInnes                MATOP_SOLVE_ADD=8,
11007c922b88SBarry Smith                MATOP_SOLVE_TRANSPOSE=9,
11017c922b88SBarry Smith                MATOP_SOLVE_TRANSPOSE_ADD=10,
11021c1c02c0SLois Curfman McInnes                MATOP_LUFACTOR=11,
11031c1c02c0SLois Curfman McInnes                MATOP_CHOLESKYFACTOR=12,
11041c1c02c0SLois Curfman McInnes                MATOP_RELAX=13,
11051c1c02c0SLois Curfman McInnes                MATOP_TRANSPOSE=14,
11061c1c02c0SLois Curfman McInnes                MATOP_GETINFO=15,
11071c1c02c0SLois Curfman McInnes                MATOP_EQUAL=16,
11081c1c02c0SLois Curfman McInnes                MATOP_GET_DIAGONAL=17,
11091c1c02c0SLois Curfman McInnes                MATOP_DIAGONAL_SCALE=18,
11101c1c02c0SLois Curfman McInnes                MATOP_NORM=19,
11111c1c02c0SLois Curfman McInnes                MATOP_ASSEMBLY_BEGIN=20,
11121c1c02c0SLois Curfman McInnes                MATOP_ASSEMBLY_END=21,
11131c1c02c0SLois Curfman McInnes                MATOP_COMPRESS=22,
11141c1c02c0SLois Curfman McInnes                MATOP_SET_OPTION=23,
11151c1c02c0SLois Curfman McInnes                MATOP_ZERO_ENTRIES=24,
11161c1c02c0SLois Curfman McInnes                MATOP_ZERO_ROWS=25,
11171c1c02c0SLois Curfman McInnes                MATOP_LUFACTOR_SYMBOLIC=26,
11181c1c02c0SLois Curfman McInnes                MATOP_LUFACTOR_NUMERIC=27,
11191c1c02c0SLois Curfman McInnes                MATOP_CHOLESKY_FACTOR_SYMBOLIC=28,
11201c1c02c0SLois Curfman McInnes                MATOP_CHOLESKY_FACTOR_NUMERIC=29,
1121d643ce63SMatthew Knepley                MATOP_SETUP_PREALLOCATION=30,
1122d643ce63SMatthew Knepley                MATOP_ILUFACTOR_SYMBOLIC=31,
1123d643ce63SMatthew Knepley                MATOP_ICCFACTOR_SYMBOLIC=32,
1124d643ce63SMatthew Knepley                MATOP_GET_ARRAY=33,
1125d643ce63SMatthew Knepley                MATOP_RESTORE_ARRAY=34,
1126d643ce63SMatthew Knepley                MATOP_DUPLCIATE=35,
1127d643ce63SMatthew Knepley                MATOP_FORWARD_SOLVE=36,
1128d643ce63SMatthew Knepley                MATOP_BACKWARD_SOLVE=37,
1129d643ce63SMatthew Knepley                MATOP_ILUFACTOR=38,
1130d643ce63SMatthew Knepley                MATOP_ICCFACTOR=39,
1131d643ce63SMatthew Knepley                MATOP_AXPY=40,
1132d643ce63SMatthew Knepley                MATOP_GET_SUBMATRICES=41,
1133d643ce63SMatthew Knepley                MATOP_INCREASE_OVERLAP=42,
1134d643ce63SMatthew Knepley                MATOP_GET_VALUES=43,
1135d643ce63SMatthew Knepley                MATOP_COPY=44,
1136d643ce63SMatthew Knepley                MATOP_PRINT_HELP=45,
1137d643ce63SMatthew Knepley                MATOP_SCALE=46,
1138d643ce63SMatthew Knepley                MATOP_SHIFT=47,
1139d643ce63SMatthew Knepley                MATOP_DIAGONAL_SHIFT=48,
1140d643ce63SMatthew Knepley                MATOP_ILUDT_FACTOR=49,
1141d643ce63SMatthew Knepley                MATOP_GET_BLOCK_SIZE=50,
1142d643ce63SMatthew Knepley                MATOP_GET_ROW_IJ=51,
1143d643ce63SMatthew Knepley                MATOP_RESTORE_ROW_IJ=52,
1144d643ce63SMatthew Knepley                MATOP_GET_COLUMN_IJ=53,
1145d643ce63SMatthew Knepley                MATOP_RESTORE_COLUMN_IJ=54,
1146d643ce63SMatthew Knepley                MATOP_FDCOLORING_CREATE=55,
1147d643ce63SMatthew Knepley                MATOP_COLORING_PATCH=56,
1148d643ce63SMatthew Knepley                MATOP_SET_UNFACTORED=57,
1149d643ce63SMatthew Knepley                MATOP_PERMUTE=58,
1150d643ce63SMatthew Knepley                MATOP_SET_VALUES_BLOCKED=59,
1151d643ce63SMatthew Knepley                MATOP_GET_SUBMATRIX=60,
1152d643ce63SMatthew Knepley                MATOP_DESTROY=61,
1153d643ce63SMatthew Knepley                MATOP_VIEW=62,
1154d643ce63SMatthew Knepley                MATOP_GET_MAPS=63,
1155d643ce63SMatthew Knepley                MATOP_USE_SCALED_FORM=64,
1156d643ce63SMatthew Knepley                MATOP_SCALE_SYSTEM=65,
1157d643ce63SMatthew Knepley                MATOP_UNSCALE_SYSTEM=66,
1158d643ce63SMatthew Knepley                MATOP_SET_LOCAL_TO_GLOBAL_MAPPING=67,
1159d643ce63SMatthew Knepley                MATOP_SET_VALUES_LOCAL=68,
1160d643ce63SMatthew Knepley                MATOP_ZERO_ROWS_LOCAL=69,
1161d643ce63SMatthew Knepley                MATOP_GET_ROW_MAX=70,
1162d643ce63SMatthew Knepley                MATOP_CONVERT=71,
1163d643ce63SMatthew Knepley                MATOP_SET_COLORING=72,
1164d643ce63SMatthew Knepley                MATOP_SET_VALUES_ADIC=73,
1165d643ce63SMatthew Knepley                MATOP_SET_VALUES_ADIFOR=74,
1166d643ce63SMatthew Knepley                MATOP_FD_COLORING_APPLY=75,
1167d643ce63SMatthew Knepley                MATOP_SET_FROM_OPTIONS=76,
1168d643ce63SMatthew Knepley                MATOP_MULT_CONSTRAINED=77,
1169d643ce63SMatthew Knepley                MATOP_MULT_TRANSPOSE_CONSTRAINED=78,
1170d643ce63SMatthew Knepley                MATOP_ILU_FACTOR_SYMBOLIC_CONSTRAINED=79,
1171d643ce63SMatthew Knepley                MATOP_PERMUTE_SPARSIFY=80,
1172d643ce63SMatthew Knepley                MATOP_MULT_MULTIPLE=81,
1173d643ce63SMatthew Knepley                MATOP_SOLVE_MULTIPLE=82
1174fae171e0SBarry Smith              } MatOperation;
1175ca44d042SBarry Smith EXTERN int MatHasOperation(Mat,MatOperation,PetscTruth*);
1176ff8b7a98SSatish Balay EXTERN int MatShellSetOperation(Mat,MatOperation,void(*)(void));
1177ff8b7a98SSatish Balay EXTERN int MatShellGetOperation(Mat,MatOperation,void(**)(void));
1178273d9f13SBarry Smith EXTERN int MatShellSetContext(Mat,void*);
1179112a2221SBarry Smith 
118090ace30eSBarry Smith /*
118190ace30eSBarry Smith    Codes for matrices stored on disk. By default they are
118290ace30eSBarry Smith  stored in a universal format. By changing the format with
1183fb9695e5SSatish Balay  PetscViewerSetFormat(viewer,PETSC_VIEWER_BINARY_NATIVE); the matrices will
118490ace30eSBarry Smith  be stored in a way natural for the matrix, for example dense matrices
118590ace30eSBarry Smith  would be stored as dense. Matrices stored this way may only be
118690ace30eSBarry Smith  read into matrices of the same time.
118790ace30eSBarry Smith */
118890ace30eSBarry Smith #define MATRIX_BINARY_FORMAT_DENSE -1
118990ace30eSBarry Smith 
11906d053be9SSatish Balay EXTERN int MatMPIBAIJSetHashTableFactor(Mat,PetscReal);
1191ca44d042SBarry Smith EXTERN int MatSeqAIJGetInodeSizes(Mat,int *,int *[],int *);
119208918a0eSSatish Balay EXTERN int MatMPIRowbsGetColor(Mat,ISColoring *);
1193860d1616SSatish Balay 
1194d9274352SBarry Smith /*S
1195d9274352SBarry Smith      MatNullSpace - Object that removes a null space from a vector, i.e.
1196d9274352SBarry Smith          orthogonalizes the vector to a subsapce
1197d9274352SBarry Smith 
1198f7a9e4ceSBarry Smith    Level: advanced
1199d9274352SBarry Smith 
1200d9274352SBarry Smith   Concepts: matrix; linear operator, null space
1201d9274352SBarry Smith 
12026e1639daSBarry Smith   Users manual sections:
12036e1639daSBarry Smith .   sec_singular
12046e1639daSBarry Smith 
1205d9274352SBarry Smith .seealso:  MatNullSpaceCreate()
1206d9274352SBarry Smith S*/
120774637425SBarry Smith typedef struct _p_MatNullSpace* MatNullSpace;
1208d9274352SBarry Smith 
12094e7234bfSBarry Smith EXTERN int MatNullSpaceCreate(MPI_Comm,int,int,const Vec[],MatNullSpace*);
121074637425SBarry Smith EXTERN int MatNullSpaceDestroy(MatNullSpace);
121174637425SBarry Smith EXTERN int MatNullSpaceRemove(MatNullSpace,Vec,Vec*);
121274637425SBarry Smith EXTERN int MatNullSpaceAttach(Mat,MatNullSpace);
121374637425SBarry Smith EXTERN int MatNullSpaceTest(MatNullSpace,Mat);
121474637425SBarry Smith 
1215273d9f13SBarry Smith EXTERN int MatReorderingSeqSBAIJ(Mat A,IS isp);
1216273d9f13SBarry Smith EXTERN int MatMPISBAIJSetHashTableFactor(Mat,PetscReal);
1217273d9f13SBarry Smith EXTERN int MatSeqSBAIJSetColumnIndices(Mat,int *);
1218273d9f13SBarry Smith 
12195c66b693SKris Buschelman EXTERN int MatMatMult(Mat A,Mat B, Mat *C);
12205c66b693SKris Buschelman EXTERN int MatMatMultSymbolic(Mat A,Mat B,Mat *C);
12215c66b693SKris Buschelman EXTERN int MatMatMultNumeric(Mat A,Mat B,Mat C);
12223f1d51d7SBarry Smith 
1223f069c275SSatish Balay EXTERN int MatCreateMAIJ(Mat,int,Mat*);
1224c4f061fbSSatish Balay EXTERN int MatMAIJRedimension(Mat,int,Mat*);
1225c4f061fbSSatish Balay EXTERN int MatMAIJGetAIJ(Mat,Mat*);
1226c4f061fbSSatish Balay 
1227b0a32e0cSBarry Smith EXTERN int MatComputeExplicitOperator(Mat,Mat*);
1228b0a32e0cSBarry Smith 
122924a595ddSBarry Smith EXTERN int MatESISetType(Mat,char*);
123024a595ddSBarry Smith EXTERN int MatESISetFromOptions(Mat);
123124a595ddSBarry Smith 
12322cd6534aSBarry Smith EXTERN int MatDiagonalScaleLocal(Mat,Vec);
123304f1ad80SBarry Smith 
12347dbadf16SMatthew Knepley EXTERN int PetscViewerMathematicaPutMatrix(PetscViewer, int, int, PetscReal *);
12357dbadf16SMatthew Knepley EXTERN int PetscViewerMathematicaPutCSRMatrix(PetscViewer, int, int, int *, int *, PetscReal *);
12367dbadf16SMatthew Knepley 
1237e82a3eeeSBarry Smith EXTERN int MatUseSpooles_SeqAIJ(Mat);
1238e82a3eeeSBarry Smith EXTERN int MatUseUMFPACK_SeqAIJ(Mat);
1239e82a3eeeSBarry Smith EXTERN int MatUseSuperLU_SeqAIJ(Mat);
1240e82a3eeeSBarry Smith EXTERN int MatUseEssl_SeqAIJ(Mat);
1241e82a3eeeSBarry Smith EXTERN int MatUseLUSOL_SeqAIJ(Mat);
1242e82a3eeeSBarry Smith EXTERN int MatUseMatlab_SeqAIJ(Mat);
1243e82a3eeeSBarry Smith EXTERN int MatUseDXML_SeqAIJ(Mat);
12440889b5dcSvictorle EXTERN int MatUsePETSc_SeqAIJ(Mat);
1245e82a3eeeSBarry Smith EXTERN int MatUseSuperLU_DIST_MPIAIJ(Mat);
1246e82a3eeeSBarry Smith EXTERN int MatUseSpooles_MPIAIJ(Mat);
1247e82a3eeeSBarry Smith EXTERN int MatUseSpooles_SeqSBAIJ(Mat);
1248eee76cafSHong Zhang EXTERN int MatUseSpooles_MPISBAIJ(Mat);
1249eee76cafSHong Zhang EXTERN int MatUseMUMPS_MPIAIJ(Mat);
1250e82a3eeeSBarry Smith 
1251*e9fa29b7SSatish Balay PETSC_EXTERN_CXX_END
12522eac72dbSBarry Smith #endif
1253