xref: /petsc/include/petscmat.h (revision d64ed03d54a2fae6c0c58880c522fae65f427572)
1*d64ed03dSBarry Smith /* $Id: mat.h,v 1.147 1997/10/21 04:23:16 bsmith Exp bsmith $ */
22eac72dbSBarry Smith /*
32eac72dbSBarry Smith      Include file for the matrix component of PETSc
4f1d1b154SWilliam Gropp 
5f1d1b154SWilliam Gropp      Any change to this file must also be made to FINCLUDE/mat.h
62eac72dbSBarry Smith */
71eb62cbbSBarry Smith #ifndef __MAT_PACKAGE
81eb62cbbSBarry Smith #define __MAT_PACKAGE
98ed539a5SBarry Smith #include "vec.h"
102eac72dbSBarry Smith 
119cd28387SBarry Smith #define MAT_COOKIE         PETSC_COOKIE+5
12f0479e8cSBarry Smith 
13e2a1c21fSSatish Balay typedef struct _p_Mat*           Mat;
142eac72dbSBarry Smith 
15f1d1b154SWilliam Gropp #define MAX_MATRIX_TYPES 14
16639f9d9dSBarry Smith /*
17639f9d9dSBarry Smith    The default matrix data storage formats and routines to create them.
18f1d1b154SWilliam Gropp 
19f1d1b154SWilliam Gropp    MATLASTTYPE is "end-of-list" marker that can be used to check that
20f1d1b154SWilliam Gropp    MAX_MATRIX_TYPES is large enough.  The rule is
21f1d1b154SWilliam Gropp    MAX_MATRIX_TYPES >= MATLASTTYPE .
22f1d1b154SWilliam Gropp 
23f1d1b154SWilliam Gropp    To do: add a test program that checks the consistency of these values.
24639f9d9dSBarry Smith */
254ac9ca07SLois Curfman McInnes typedef enum { MATSAME=-1,  MATSEQDENSE, MATSEQAIJ,   MATMPIAIJ,   MATSHELL,
2684cb2905SBarry Smith                MATMPIROWBS, MATSEQBDIAG, MATMPIBDIAG, MATMPIDENSE, MATSEQBAIJ,
27f1d1b154SWilliam Gropp                MATMPIBAIJ,  MATMPICSN,   MATSEQCSN,   MATSEQADJ,   MATMPIADJ,
28f1d1b154SWilliam Gropp                MATLASTTYPE } MatType;
2928988994SBarry Smith 
300e998a85SBarry Smith extern int MatCreate(MPI_Comm,int,int,Mat*);
31df6e0191SLois Curfman McInnes extern int MatCreateSeqDense(MPI_Comm,int,int,Scalar*,Mat*);
32d5bc1036SLois Curfman McInnes extern int MatCreateMPIDense(MPI_Comm,int,int,int,int,Scalar*,Mat*);
33de7da479SBarry Smith extern int MatCreateSeqAIJ(MPI_Comm,int,int,int,int*,Mat*);
349717bf64SBarry Smith extern int MatCreateMPIAIJ(MPI_Comm,int,int,int,int,int,int*,int,int*,Mat*);
35cfe223acSLois Curfman McInnes extern int MatCreateMPIRowbs(MPI_Comm,int,int,int,int*,void*,Mat*);
36f26ada1bSBarry Smith extern int MatCreateSeqBDiag(MPI_Comm,int,int,int,int,int*,Scalar**,Mat*);
37f26ada1bSBarry Smith extern int MatCreateMPIBDiag(MPI_Comm,int,int,int,int,int,int*,Scalar**,Mat*);
38df8a92d1SBarry Smith extern int MatCreateSeqBAIJ(MPI_Comm,int,int,int,int,int*,Mat*);
39eba03b66SLois Curfman McInnes extern int MatCreateMPIBAIJ(MPI_Comm,int,int,int,int,int,int,int*,int,int*,Mat*);
4082c9921cSBarry Smith extern int MatCreateSeqAdj(MPI_Comm,int,int,int*,int*,Mat *);
410752156aSBarry Smith extern int MatCreateMPIAdj(MPI_Comm,int,int,int*,int*,Mat*);
429717bf64SBarry Smith 
437b80b807SBarry Smith extern int MatDestroy(Mat);
447b80b807SBarry Smith 
457ddc982cSLois Curfman McInnes extern int MatCreateShell(MPI_Comm,int,int,int,int,void *,Mat*);
4617116c71SBarry Smith extern int MatShellGetContext(Mat,void **);
4721c89e3eSBarry Smith 
48ec0117caSBarry Smith extern int MatPrintHelp(Mat);
49ec0117caSBarry Smith 
508ed539a5SBarry Smith /* ------------------------------------------------------------*/
51ee50ffe9SBarry Smith extern int MatSetValues(Mat,int,int*,int,int*,Scalar*,InsertMode);
5295e63191SSatish Balay extern int MatSetValuesBlocked(Mat,int,int*,int,int*,Scalar*,InsertMode);
5384cb2905SBarry Smith 
546d4a8577SBarry Smith typedef enum {MAT_FLUSH_ASSEMBLY=1,MAT_FINAL_ASSEMBLY=0} MatAssemblyType;
55ee50ffe9SBarry Smith extern int MatAssemblyBegin(Mat,MatAssemblyType);
56ee50ffe9SBarry Smith extern int MatAssemblyEnd(Mat,MatAssemblyType);
57b951964fSBarry Smith #define MatSetValue(v,i,j,va,mode) \
58b951964fSBarry Smith {int _ierr,_row = i,_col = j; Scalar _va = va; \
59b951964fSBarry Smith   _ierr = MatSetValues(v,1,&_row,1,&_col,&_va,mode);CHKERRQ(_ierr); \
60b951964fSBarry Smith }
61ee50ffe9SBarry Smith 
626d4a8577SBarry Smith typedef enum {MAT_ROW_ORIENTED=1,MAT_COLUMN_ORIENTED=2,MAT_ROWS_SORTED=4,
636d4a8577SBarry Smith               MAT_COLUMNS_SORTED=8,MAT_NO_NEW_NONZERO_LOCATIONS=16,
646d4a8577SBarry Smith               MAT_YES_NEW_NONZERO_LOCATIONS=32,MAT_SYMMETRIC=64,
656d4a8577SBarry Smith               MAT_STRUCTURALLY_SYMMETRIC,MAT_NO_NEW_DIAGONALS,
666d4a8577SBarry Smith               MAT_YES_NEW_DIAGONALS,MAT_INODE_LIMIT_1,MAT_INODE_LIMIT_2,
6790f02eecSBarry Smith               MAT_INODE_LIMIT_3,MAT_INODE_LIMIT_4,MAT_INODE_LIMIT_5,
682b362799SSatish Balay               MAT_IGNORE_OFF_PROC_ENTRIES,MAT_ROWS_UNSORTED,
6996854ed6SLois Curfman McInnes               MAT_COLUMNS_UNSORTED,MAT_NEW_NONZERO_LOCATION_ERROR,
7096854ed6SLois Curfman McInnes               MAT_NEW_NONZERO_ALLOCATION_ERROR} MatOption;
71ee50ffe9SBarry Smith extern int MatSetOption(Mat,MatOption);
724b0e389bSBarry Smith extern int MatGetType(Mat,MatType*,char**);
7356cd22aeSBarry Smith extern int MatGetTypeFromOptions(MPI_Comm,char*,MatType*,PetscTruth*);
7484cb2905SBarry Smith 
75ee50ffe9SBarry Smith extern int MatGetValues(Mat,int,int*,int,int*,Scalar*);
768ed539a5SBarry Smith extern int MatGetRow(Mat,int,int *,int **,Scalar**);
778ed539a5SBarry Smith extern int MatRestoreRow(Mat,int,int *,int **,Scalar**);
7877c4ece6SBarry Smith extern int MatGetColumn(Mat,int,int *,int **,Scalar**);
7977c4ece6SBarry Smith extern int MatRestoreColumn(Mat,int,int *,int **,Scalar**);
8064e87e97SBarry Smith extern int MatGetArray(Mat,Scalar **);
8109883261SBarry Smith extern int MatRestoreArray(Mat,Scalar **);
82870582ebSSatish Balay extern int MatGetBlockSize(Mat,int *);
837b80b807SBarry Smith 
848ed539a5SBarry Smith extern int MatMult(Mat,Vec,Vec);
858ed539a5SBarry Smith extern int MatMultAdd(Mat,Vec,Vec,Vec);
868ed539a5SBarry Smith extern int MatMultTrans(Mat,Vec,Vec);
878ed539a5SBarry Smith extern int MatMultTransAdd(Mat,Vec,Vec,Vec);
882eac72dbSBarry Smith 
897b80b807SBarry Smith extern int MatConvert(Mat,MatType,Mat*);
903a40ed3dSBarry Smith extern int MatDuplicate(Mat,Mat*);
9194a9d846SBarry Smith extern int MatConvertRegister(MatType,MatType,int (*)(Mat,MatType,Mat*));
9294a9d846SBarry Smith extern int MatConvertRegisterAll();
9394a9d846SBarry Smith 
947b80b807SBarry Smith extern int MatCopy(Mat,Mat);
957b80b807SBarry Smith extern int MatView(Mat,Viewer);
967b80b807SBarry Smith extern int MatLoad(Viewer,MatType,Mat*);
9794a9d846SBarry Smith extern int MatLoadRegister(MatType,int (*)(Viewer,MatType,Mat*));
9894a9d846SBarry Smith extern int MatLoadRegisterAll();
997b80b807SBarry Smith 
100d4fbbf0eSBarry Smith extern int MatGetRowIJ(Mat,int,PetscTruth,int*,int **,int **,PetscTruth *);
101d4fbbf0eSBarry Smith extern int MatRestoreRowIJ(Mat,int,PetscTruth,int *,int **,int **,PetscTruth *);
102d4fbbf0eSBarry Smith extern int MatGetColumnIJ(Mat,int,PetscTruth,int*,int **,int **,PetscTruth *);
103d4fbbf0eSBarry Smith extern int MatRestoreColumnIJ(Mat,int,PetscTruth,int *,int **,int **,PetscTruth *);
104d4fbbf0eSBarry Smith 
1051d607229SLois Curfman McInnes /*
1061d607229SLois Curfman McInnes    Context of matrix information, used with MatGetInfo()
1071d607229SLois Curfman McInnes    Note: If any entries are added to this context, be sure
1081d607229SLois Curfman McInnes          to adjust MAT_INFO_SIZE in FINCLUDE/mat.h
1091d607229SLois Curfman McInnes  */
1104e220ebcSLois Curfman McInnes typedef struct {
11137f753daSBarry Smith   PLogDouble rows_global, columns_global;         /* number of global rows and columns */
11237f753daSBarry Smith   PLogDouble rows_local, columns_local;           /* number of local rows and columns */
11337f753daSBarry Smith   PLogDouble block_size;                          /* block size */
11437f753daSBarry Smith   PLogDouble nz_allocated, nz_used, nz_unneeded;  /* number of nonzeros */
11537f753daSBarry Smith   PLogDouble memory;                              /* memory allocated */
11637f753daSBarry Smith   PLogDouble assemblies;                          /* number of matrix assemblies */
11737f753daSBarry Smith   PLogDouble mallocs;                             /* number of mallocs during MatSetValues() */
11837f753daSBarry Smith   PLogDouble fill_ratio_given, fill_ratio_needed; /* fill ratio for LU/ILU */
11937f753daSBarry Smith   PLogDouble factor_mallocs;                      /* number of mallocs during factorization */
1204e220ebcSLois Curfman McInnes } MatInfo;
1214e220ebcSLois Curfman McInnes 
1227b80b807SBarry Smith typedef enum {MAT_LOCAL=1,MAT_GLOBAL_MAX=2,MAT_GLOBAL_SUM=3} MatInfoType;
1234e220ebcSLois Curfman McInnes extern int MatGetInfo(Mat,MatInfoType,MatInfo*);
12477c4ece6SBarry Smith extern int MatValid(Mat,PetscTruth*);
1257b80b807SBarry Smith extern int MatGetDiagonal(Mat,Vec);
126cd8486b4SBarry Smith extern int MatTranspose(Mat,Mat*);
1270513a670SBarry Smith extern int MatPermute(Mat,IS,IS,Mat *);
128f4c33d5aSBarry Smith extern int MatDiagonalScale(Mat,Vec,Vec);
1298b3e568eSBarry Smith extern int MatDiagonalShift(Mat,Vec);
13077c4ece6SBarry Smith extern int MatEqual(Mat,Mat, PetscTruth*);
1317b80b807SBarry Smith 
1327b80b807SBarry Smith extern int MatNorm(Mat,NormType,double *);
1337b80b807SBarry Smith extern int MatZeroEntries(Mat);
1347b80b807SBarry Smith extern int MatZeroRows(Mat,IS,Scalar*);
1357b80b807SBarry Smith extern int MatZeroColumns(Mat,IS,Scalar*);
1367b80b807SBarry Smith 
1377b80b807SBarry Smith extern int MatGetSize(Mat,int*,int*);
1387b80b807SBarry Smith extern int MatGetLocalSize(Mat,int*,int*);
1397b80b807SBarry Smith extern int MatGetOwnershipRange(Mat,int*,int*);
1407b80b807SBarry Smith 
1417b80b807SBarry Smith typedef enum {MAT_INITIAL_MATRIX, MAT_REUSE_MATRIX} MatGetSubMatrixCall;
1427b80b807SBarry Smith extern int MatGetSubMatrices(Mat,int,IS *,IS *,MatGetSubMatrixCall,Mat **);
143905e6a2fSBarry Smith extern int MatDestroyMatrices(int, Mat **);
144*d64ed03dSBarry Smith extern int MatGetSubMatrix(Mat,IS,IS,MatGetSubMatrixCall,Mat *);
1458efafbd8SBarry Smith 
1467b80b807SBarry Smith extern int MatIncreaseOverlap(Mat,int,IS *,int);
1477b80b807SBarry Smith 
1487b80b807SBarry Smith extern int MatAXPY(Scalar *,Mat,Mat);
14986787d2cSSatish Balay extern int MatAYPX(Scalar *,Mat,Mat);
1507b80b807SBarry Smith extern int MatCompress(Mat);
1517b80b807SBarry Smith 
152052efed2SBarry Smith extern int MatScale(Scalar *,Mat);
153052efed2SBarry Smith extern int MatShift(Scalar *,Mat);
154052efed2SBarry Smith 
155d4bb536fSBarry Smith extern int MatSetLocalToGlobalMapping(Mat, ISLocalToGlobalMapping);
156d4bb536fSBarry Smith extern int MatSetLocalToGlobalMappingBlocked(Mat, ISLocalToGlobalMapping);
15790f02eecSBarry Smith extern int MatZeroRowsLocal(Mat,IS,Scalar*);
15890f02eecSBarry Smith extern int MatSetValuesLocal(Mat,int,int*,int,int*,Scalar*,InsertMode);
1594a387fc0SSatish Balay extern int MatSetValuesBlockedLocal(Mat,int,int*,int,int*,Scalar*,InsertMode);
16090f02eecSBarry Smith 
1617b80b807SBarry Smith /* Routines unique to particular data structures */
1627b80b807SBarry Smith extern int MatBDiagGetData(Mat,int*,int*,int**,int**,Scalar***);
1637b80b807SBarry Smith 
1647b80b807SBarry Smith /*
1657b80b807SBarry Smith   These routines are not usually accessed directly, rather solving is
1667b80b807SBarry Smith   done through the SLES, KSP and PC interfaces.
1677b80b807SBarry Smith */
1687b80b807SBarry Smith 
16984cb2905SBarry Smith typedef enum {ORDER_NATURAL=0,ORDER_ND=1,ORDER_1WD=2,ORDER_RCM=3,
17084cb2905SBarry Smith               ORDER_QMD=4,ORDER_ROWLENGTH=5,ORDER_FLOW,ORDER_NEW} MatReordering;
171a2ce50c7SBarry Smith extern int MatGetReordering(Mat,MatReordering,IS*,IS*);
172a2ce50c7SBarry Smith extern int MatGetReorderingTypeFromOptions(char *,MatReordering*);
17384cb2905SBarry Smith extern int MatReorderingRegister(MatReordering,MatReordering*,char*,int(*)(Mat,MatReordering,IS*,IS*));
174a2ce50c7SBarry Smith extern int MatReorderingGetName(MatReordering,char **);
17584cb2905SBarry Smith extern int MatReorderingRegisterDestroy();
17684cb2905SBarry Smith extern int MatReorderingRegisterAll();
17784cb2905SBarry Smith extern int MatReorderingRegisterAllCalled;
178d4fbbf0eSBarry Smith 
179a2ce50c7SBarry Smith extern int MatReorderForNonzeroDiagonal(Mat,double,IS,IS);
180a2ce50c7SBarry Smith 
181a2ce50c7SBarry Smith extern int MatCholeskyFactor(Mat,IS,double);
182a2ce50c7SBarry Smith extern int MatCholeskyFactorSymbolic(Mat,IS,double,Mat*);
183a2ce50c7SBarry Smith extern int MatCholeskyFactorNumeric(Mat,Mat*);
184a2ce50c7SBarry Smith 
18549d8b64dSBarry Smith extern int MatLUFactor(Mat,IS,IS,double);
186d7b056bfSBarry Smith extern int MatILUFactor(Mat,IS,IS,double,int);
18764051cb3SBarry Smith extern int MatLUFactorSymbolic(Mat,IS,IS,double,Mat*);
18864051cb3SBarry Smith extern int MatILUFactorSymbolic(Mat,IS,IS,double,int,Mat*);
18964051cb3SBarry Smith extern int MatIncompleteCholeskyFactorSymbolic(Mat,IS,double,int,Mat*);
19020563c6bSBarry Smith extern int MatLUFactorNumeric(Mat,Mat*);
191a2ce50c7SBarry Smith extern int MatILUDTFactor(Mat,double,int,IS,IS,Mat *);
192a2ce50c7SBarry Smith 
1938ed539a5SBarry Smith extern int MatSolve(Mat,Vec,Vec);
19422169318SLois Curfman McInnes extern int MatForwardSolve(Mat,Vec,Vec);
19522169318SLois Curfman McInnes extern int MatBackwardSolve(Mat,Vec,Vec);
1968ed539a5SBarry Smith extern int MatSolveAdd(Mat,Vec,Vec,Vec);
19728988994SBarry Smith extern int MatSolveTrans(Mat,Vec,Vec);
19828988994SBarry Smith extern int MatSolveTransAdd(Mat,Vec,Vec,Vec);
1998ed539a5SBarry Smith 
200bb5a7306SBarry Smith extern int MatSetUnfactored(Mat);
201bb5a7306SBarry Smith 
202ee50ffe9SBarry Smith typedef enum {SOR_FORWARD_SWEEP=1,SOR_BACKWARD_SWEEP=2,SOR_SYMMETRIC_SWEEP=3,
203ee50ffe9SBarry Smith               SOR_LOCAL_FORWARD_SWEEP=4,SOR_LOCAL_BACKWARD_SWEEP=8,
204ee50ffe9SBarry Smith               SOR_LOCAL_SYMMETRIC_SWEEP=12,SOR_ZERO_INITIAL_GUESS=16,
20584cb2905SBarry Smith               SOR_EISENSTAT=32,SOR_APPLY_UPPER=64,SOR_APPLY_LOWER=128} MatSORType;
206ca9b4cbeSLois Curfman McInnes extern int MatRelax(Mat,Vec,double,MatSORType,double,int,Vec);
2078ed539a5SBarry Smith 
208005c665bSBarry Smith typedef enum {SAME_NONZERO_PATTERN,DIFFERENT_NONZERO_PATTERN,SAME_PRECONDITIONER} MatStructure;
209005c665bSBarry Smith 
210d4fbbf0eSBarry Smith /*
211639f9d9dSBarry Smith     These routines are for efficiently computing Jacobians via finite differences.
212639f9d9dSBarry Smith */
213639f9d9dSBarry Smith typedef enum {COLORING_NATURAL, COLORING_SL, COLORING_LF, COLORING_ID,
21484cb2905SBarry Smith               COLORING_NEW} MatColoring;
215639f9d9dSBarry Smith extern int MatGetColoring(Mat,MatColoring,ISColoring*);
216639f9d9dSBarry Smith extern int MatGetColoringTypeFromOptions(char *,MatColoring*);
21784cb2905SBarry Smith extern int MatColoringRegister(MatColoring,MatColoring*,char*,int(*)(Mat,MatColoring,ISColoring *));
218639f9d9dSBarry Smith extern int MatColoringRegisterAll();
21984cb2905SBarry Smith extern int MatColoringRegisterAllCalled;
220639f9d9dSBarry Smith extern int MatColoringRegisterDestroy();
221639f9d9dSBarry Smith extern int MatColoringPatch(Mat,int,int *,ISColoring*);
222639f9d9dSBarry Smith 
22384cb2905SBarry Smith /*
22484cb2905SBarry Smith     Data structures used to compute Jacobian vector products
22584cb2905SBarry Smith   efficiently using finite differences.
22684cb2905SBarry Smith */
227639f9d9dSBarry Smith #define MAT_FDCOLORING_COOKIE PETSC_COOKIE + 22
228639f9d9dSBarry Smith 
229e2a1c21fSSatish Balay typedef struct _p_MatFDColoring *MatFDColoring;
230639f9d9dSBarry Smith 
231639f9d9dSBarry Smith extern int MatFDColoringCreate(Mat,ISColoring,MatFDColoring *);
232639f9d9dSBarry Smith extern int MatFDColoringDestroy(MatFDColoring);
233639f9d9dSBarry Smith extern int MatFDColoringView(MatFDColoring,Viewer);
2346eb013d7SBarry Smith extern int MatFDColoringSetFunction(MatFDColoring,int (*)(void),void*);
235639f9d9dSBarry Smith extern int MatFDColoringSetParameters(MatFDColoring,double,double);
236005c665bSBarry Smith extern int MatFDColoringSetFrequency(MatFDColoring,int);
2378bba8e72SBarry Smith extern int MatFDColoringGetFrequency(MatFDColoring,int*);
238639f9d9dSBarry Smith extern int MatFDColoringSetFromOptions(MatFDColoring);
239639f9d9dSBarry Smith extern int MatFDColoringPrintHelp(MatFDColoring);
240005c665bSBarry Smith extern int MatFDColoringApply(Mat,MatFDColoring,Vec,MatStructure*,void *);
2416eb013d7SBarry Smith extern int MatFDColoringApplyTS(Mat,MatFDColoring,double,Vec,MatStructure*,void *);
242639f9d9dSBarry Smith 
243639f9d9dSBarry Smith /*
2440752156aSBarry Smith     These routines are for partitioning matrices: currently used only
2450752156aSBarry Smith   for adjacency matrix, MatCreateSeqAdj() or MatCreateMPIAdj().
2460752156aSBarry Smith */
2470752156aSBarry Smith typedef enum {PARTITIONING_NATURAL, PARTITIONING_CURRENT, PARTITIONING_NEW} MatPartitioning;
2480752156aSBarry Smith extern int MatGetPartitioning(Mat,MatPartitioning,int,ISPartitioning*);
2490752156aSBarry Smith extern int MatGetPartitioningTypeFromOptions(char *,MatPartitioning*);
2500752156aSBarry Smith extern int MatPartitioningRegister(MatPartitioning,MatPartitioning*,char*,
2510752156aSBarry Smith                                    int(*)(Mat,MatPartitioning,int,ISPartitioning *));
2520752156aSBarry Smith extern int MatPartitioningRegisterAll();
2530752156aSBarry Smith extern int MatPartitioningRegisterAllCalled;
2540752156aSBarry Smith extern int MatPartitioningRegisterDestroy();
2550752156aSBarry Smith 
2560752156aSBarry Smith /*
257d4fbbf0eSBarry Smith     If you add entries here you must also add them to FINCLUDE/mat.h
258d4fbbf0eSBarry Smith */
2591c1c02c0SLois Curfman McInnes typedef enum { MATOP_SET_VALUES=0,
2601c1c02c0SLois Curfman McInnes                MATOP_GET_ROW=1,
2611c1c02c0SLois Curfman McInnes                MATOP_RESTORE_ROW=2,
2621c1c02c0SLois Curfman McInnes                MATOP_MULT=3,
2631c1c02c0SLois Curfman McInnes                MATOP_MULT_ADD=4,
2641c1c02c0SLois Curfman McInnes                MATOP_MULT_TRANS=5,
2651c1c02c0SLois Curfman McInnes                MATOP_MULT_TRANS_ADD=6,
2661c1c02c0SLois Curfman McInnes                MATOP_SOLVE=7,
2671c1c02c0SLois Curfman McInnes                MATOP_SOLVE_ADD=8,
2681c1c02c0SLois Curfman McInnes                MATOP_SOLVE_TRANS=9,
2691c1c02c0SLois Curfman McInnes                MATOP_SOLVE_TRANS_ADD=10,
2701c1c02c0SLois Curfman McInnes                MATOP_LUFACTOR=11,
2711c1c02c0SLois Curfman McInnes                MATOP_CHOLESKYFACTOR=12,
2721c1c02c0SLois Curfman McInnes                MATOP_RELAX=13,
2731c1c02c0SLois Curfman McInnes                MATOP_TRANSPOSE=14,
2741c1c02c0SLois Curfman McInnes                MATOP_GETINFO=15,
2751c1c02c0SLois Curfman McInnes                MATOP_EQUAL=16,
2761c1c02c0SLois Curfman McInnes                MATOP_GET_DIAGONAL=17,
2771c1c02c0SLois Curfman McInnes                MATOP_DIAGONAL_SCALE=18,
2781c1c02c0SLois Curfman McInnes                MATOP_NORM=19,
2791c1c02c0SLois Curfman McInnes                MATOP_ASSEMBLY_BEGIN=20,
2801c1c02c0SLois Curfman McInnes                MATOP_ASSEMBLY_END=21,
2811c1c02c0SLois Curfman McInnes                MATOP_COMPRESS=22,
2821c1c02c0SLois Curfman McInnes                MATOP_SET_OPTION=23,
2831c1c02c0SLois Curfman McInnes                MATOP_ZERO_ENTRIES=24,
2841c1c02c0SLois Curfman McInnes                MATOP_ZERO_ROWS=25,
2851c1c02c0SLois Curfman McInnes                MATOP_LUFACTOR_SYMBOLIC=26,
2861c1c02c0SLois Curfman McInnes                MATOP_LUFACTOR_NUMERIC=27,
2871c1c02c0SLois Curfman McInnes                MATOP_CHOLESKY_FACTOR_SYMBOLIC=28,
2881c1c02c0SLois Curfman McInnes                MATOP_CHOLESKY_FACTOR_NUMERIC=29,
2891c1c02c0SLois Curfman McInnes                MATOP_GET_SIZE=30,
2901c1c02c0SLois Curfman McInnes                MATOP_GET_LOCAL_SIZE=31,
2911c1c02c0SLois Curfman McInnes                MATOP_GET_OWNERSHIP_RANGE=32,
2921c1c02c0SLois Curfman McInnes                MATOP_ILUFACTOR_SYMBOLIC=33,
2931c1c02c0SLois Curfman McInnes                MATOP_INCOMPLETECHOLESKYFACTOR_SYMBOLIC=34,
2941c1c02c0SLois Curfman McInnes                MATOP_GET_ARRAY=35,
2951c1c02c0SLois Curfman McInnes                MATOP_RESTORE_ARRAY=36,
2967bf97ca4SSatish Balay 
297005c665bSBarry Smith                MATOP_CONVERT_SAME_TYPE=37,
298005c665bSBarry Smith                MATOP_FORWARD_SOLVE=38,
299005c665bSBarry Smith                MATOP_BACKWARD_SOLVE=39,
300005c665bSBarry Smith                MATOP_ILUFACTOR=40,
301005c665bSBarry Smith                MATOP_INCOMPLETECHOLESKYFACTOR=41,
302005c665bSBarry Smith                MATOP_AXPY=42,
303005c665bSBarry Smith                MATOP_GET_SUBMATRICES=43,
304005c665bSBarry Smith                MATOP_INCREASE_OVERLAP=44,
305005c665bSBarry Smith                MATOP_GET_VALUES=45,
306005c665bSBarry Smith                MATOP_COPY=46,
307005c665bSBarry Smith                MATOP_PRINT_HELP=47,
308005c665bSBarry Smith                MATOP_SCALE=48,
309005c665bSBarry Smith                MATOP_SHIFT=49,
310005c665bSBarry Smith                MATOP_DIAGONAL_SHIFT=50,
311005c665bSBarry Smith                MATOP_ILUDT_FACTOR=51,
312005c665bSBarry Smith                MATOP_GET_BLOCK_SIZE=52,
313005c665bSBarry Smith                MATOP_GET_ROW_IJ=53,
314005c665bSBarry Smith                MATOP_RESTORE_ROW_IJ=54,
315005c665bSBarry Smith                MATOP_GET_COLUMN_IJ=55,
316005c665bSBarry Smith                MATOP_RESTORE_COLUMN_IJ=56,
317005c665bSBarry Smith                MATOP_FDCOLORING_CREATE=57,
318005c665bSBarry Smith                MATOP_COLORING_PATCH=58,
319005c665bSBarry Smith                MATOP_SET_UNFACTORED=59,
320005c665bSBarry Smith                MATOP_PERMUTE=60,
321005c665bSBarry Smith                MATOP_SET_VALUES_BLOCKED=61,
3221c1c02c0SLois Curfman McInnes                MATOP_DESTROY=250,
3231c1c02c0SLois Curfman McInnes                MATOP_VIEW=251
324fae171e0SBarry Smith              } MatOperation;
325112a2221SBarry Smith extern int MatHasOperation(Mat,MatOperation,PetscTruth*);
326fae171e0SBarry Smith extern int MatShellSetOperation(Mat,MatOperation,void *);
327d4bb536fSBarry Smith extern int MatShellGetOperation(Mat,MatOperation,void **);
328112a2221SBarry Smith 
32990ace30eSBarry Smith /*
33090ace30eSBarry Smith    Codes for matrices stored on disk. By default they are
33190ace30eSBarry Smith  stored in a universal format. By changing the format with
332639f9d9dSBarry Smith  ViewerSetFormat(viewer,VIEWER_FORMAT_BINARY_NATIVE); the matrices will
33390ace30eSBarry Smith  be stored in a way natural for the matrix, for example dense matrices
33490ace30eSBarry Smith  would be stored as dense. Matrices stored this way may only be
33590ace30eSBarry Smith  read into matrices of the same time.
33690ace30eSBarry Smith */
33790ace30eSBarry Smith #define MATRIX_BINARY_FORMAT_DENSE -1
33890ace30eSBarry Smith 
3393f1d51d7SBarry Smith /*
3403f1d51d7SBarry Smith      New matrix classes not yet distributed
3413f1d51d7SBarry Smith */
3423f1d51d7SBarry Smith /*
3433f1d51d7SBarry Smith     MatAIJIndices is a data structure for storing the nonzero location information
3443f1d51d7SBarry Smith   for sparse matrices. Several matrices with identical nonzero structure can share
3453f1d51d7SBarry Smith   the same MatAIJIndices.
3463f1d51d7SBarry Smith */
347e2a1c21fSSatish Balay typedef struct _p_MatAIJIndices* MatAIJIndices;
3483f1d51d7SBarry Smith 
3493f1d51d7SBarry Smith extern int MatCreateAIJIndices(int,int,int*,int*,PetscTruth,MatAIJIndices*);
3503f1d51d7SBarry Smith extern int MatCreateAIJIndicesEmpty(int,int,int*,PetscTruth,MatAIJIndices*);
3513f1d51d7SBarry Smith extern int MatAttachAIJIndices(MatAIJIndices,MatAIJIndices*);
3523f1d51d7SBarry Smith extern int MatDestroyAIJIndices(MatAIJIndices);
3533f1d51d7SBarry Smith extern int MatCopyAIJIndices(MatAIJIndices,MatAIJIndices*);
3543f1d51d7SBarry Smith extern int MatValidateAIJIndices(int,MatAIJIndices);
3553f1d51d7SBarry Smith extern int MatShiftAIJIndices(MatAIJIndices);
3563f1d51d7SBarry Smith extern int MatShrinkAIJIndices(MatAIJIndices);
3573f1d51d7SBarry Smith extern int MatTransposeAIJIndices(MatAIJIndices, MatAIJIndices*);
3583f1d51d7SBarry Smith 
3593f1d51d7SBarry Smith extern int MatCreateSeqCSN(MPI_Comm,int,int,int*,int,Mat*);
3603f1d51d7SBarry Smith extern int MatCreateSeqCSN_Single(MPI_Comm,int,int,int*,int,Mat*);
3613f1d51d7SBarry Smith extern int MatCreateSeqCSNWithPrecision(MPI_Comm,int,int,int*,int,ScalarPrecision,Mat*);
3623f1d51d7SBarry Smith 
3633f1d51d7SBarry Smith extern int MatCreateSeqCSNIndices(MPI_Comm,MatAIJIndices,int,Mat *);
3643f1d51d7SBarry Smith extern int MatCreateSeqCSNIndices_Single(MPI_Comm,MatAIJIndices,int,Mat *);
3653f1d51d7SBarry Smith extern int MatCreateSeqCSNIndicesWithPrecision(MPI_Comm,MatAIJIndices,int,ScalarPrecision,Mat *);
3663f1d51d7SBarry Smith 
3673f1d51d7SBarry Smith 
3682eac72dbSBarry Smith #endif
3692eac72dbSBarry Smith 
3702eac72dbSBarry Smith 
3719d00d63dSBarry Smith 
372