173f4d377SMatthew Knepley /* $Id: petscmat.h,v 1.228 2001/09/07 20:09:08 bsmith Exp $ */ 22eac72dbSBarry Smith /* 32eac72dbSBarry Smith Include file for the matrix component of PETSc 42eac72dbSBarry Smith */ 50a835dfdSSatish Balay #ifndef __PETSCMAT_H 60a835dfdSSatish Balay #define __PETSCMAT_H 70a835dfdSSatish Balay #include "petscvec.h" 82eac72dbSBarry Smith 9d9274352SBarry Smith /*S 10d9274352SBarry Smith Mat - Abstract PETSc matrix object 112eac72dbSBarry Smith 12d91e6319SBarry Smith Level: beginner 13d91e6319SBarry Smith 14d9274352SBarry Smith Concepts: matrix; linear operator 15d9274352SBarry Smith 16d9274352SBarry Smith .seealso: MatCreate(), MatType, MatSetType() 17d9274352SBarry Smith S*/ 18d9274352SBarry Smith typedef struct _p_Mat* Mat; 19d9274352SBarry Smith 20d9274352SBarry Smith /*E 21d9274352SBarry Smith MatType - String with the name of a PETSc matrix or the creation function 22d9274352SBarry Smith with an optional dynamic library name, for example 23d9274352SBarry Smith http://www.mcs.anl.gov/petsc/lib.a:mymatcreate() 24d9274352SBarry Smith 25d9274352SBarry Smith Level: beginner 26d9274352SBarry Smith 27d9274352SBarry Smith .seealso: MatSetType(), Mat 28d91e6319SBarry Smith E*/ 29273d9f13SBarry Smith #define MATSAME "same" 30273d9f13SBarry Smith #define MATSEQMAIJ "seqmaij" 31273d9f13SBarry Smith #define MATMPIMAIJ "mpimaij" 32273d9f13SBarry Smith #define MATIS "is" 33273d9f13SBarry Smith #define MATMPIROWBS "mpirowbs" 34273d9f13SBarry Smith #define MATSEQDENSE "seqdense" 35273d9f13SBarry Smith #define MATSEQAIJ "seqaij" 36273d9f13SBarry Smith #define MATMPIAIJ "mpiaij" 37273d9f13SBarry Smith #define MATSHELL "shell" 38273d9f13SBarry Smith #define MATSEQBDIAG "seqbdiag" 39273d9f13SBarry Smith #define MATMPIBDIAG "mpibdiag" 40273d9f13SBarry Smith #define MATMPIDENSE "mpidense" 41273d9f13SBarry Smith #define MATSEQBAIJ "seqbaij" 42273d9f13SBarry Smith #define MATMPIBAIJ "mpibaij" 43273d9f13SBarry Smith #define MATMPIADJ "mpiadj" 44273d9f13SBarry Smith #define MATSEQSBAIJ "seqsbaij" 45273d9f13SBarry Smith #define MATMPISBAIJ "mpisbaij" 46cebc7f6cSBarry Smith #define MATDAAD "daad" 47cebc7f6cSBarry Smith #define MATMFFD "mffd" 486d88219bSBarry Smith #define MATESI "esi" 496d88219bSBarry Smith #define MATPETSCESI "petscesi" 50c8a8475eSBarry Smith #define MATNORMAL "normal" 51273d9f13SBarry Smith typedef char* MatType; 52d91e6319SBarry Smith 53c06d978dSMatthew Knepley #define MAT_SER_SEQAIJ_BINARY "seqaij_binary" 54c06d978dSMatthew Knepley #define MAT_SER_MPIAIJ_BINARY "mpiaij_binary" 55c06d978dSMatthew Knepley typedef char *MatSerializeType; 56c06d978dSMatthew Knepley 57c06d978dSMatthew Knepley /* Logging support */ 58552e946dSBarry Smith #define MAT_FILE_COOKIE 1211216 /* used to indicate matrices in binary files */ 59c06d978dSMatthew Knepley extern int MAT_COOKIE; 6071d41ebeSBarry Smith extern int MATSNESMFCTX_COOKIE; 61c06d978dSMatthew Knepley extern int MAT_FDCOLORING_COOKIE; 628ba1e511SMatthew Knepley extern int MAT_PARTITIONING_COOKIE; 638ba1e511SMatthew Knepley extern int MAT_NULLSPACE_COOKIE; 64d59c15a7SBarry Smith extern int MAT_Mult, MAT_MultMatrixFree, MAT_Mults, MAT_MultConstrained, MAT_MultAdd, MAT_MultTranspose; 65d59c15a7SBarry Smith extern int MAT_MultTransposeConstrained, MAT_MultTransposeAdd, MAT_Solve, MAT_Solves, MAT_SolveAdd, MAT_SolveTranspose; 66d5ba7fb7SMatthew Knepley extern int MAT_SolveTransposeAdd, MAT_Relax, MAT_ForwardSolve, MAT_BackwardSolve, MAT_LUFactor, MAT_LUFactorSymbolic; 67d5ba7fb7SMatthew Knepley extern int MAT_LUFactorNumeric, MAT_CholeskyFactor, MAT_CholeskyFactorSymbolic, MAT_CholeskyFactorNumeric, MAT_ILUFactor; 68d5ba7fb7SMatthew Knepley extern int MAT_ILUFactorSymbolic, MAT_ICCFactorSymbolic, MAT_Copy, MAT_Convert, MAT_Scale, MAT_AssemblyBegin; 69d5ba7fb7SMatthew Knepley extern int MAT_AssemblyEnd, MAT_SetValues, MAT_GetValues, MAT_GetRow, MAT_GetSubMatrices, MAT_GetColoring, MAT_GetOrdering; 70d5ba7fb7SMatthew Knepley extern int MAT_IncreaseOverlap, MAT_Partitioning, MAT_ZeroEntries, MAT_Load, MAT_View, MAT_AXPY, MAT_FDColoringCreate; 7166f9b7ceSBarry Smith extern int MAT_FDColoringApply, MAT_Transpose, MAT_FDColoringFunction; 72c06d978dSMatthew Knepley 738ba1e511SMatthew Knepley EXTERN int MatInitializePackage(char *); 74c06d978dSMatthew Knepley 75273d9f13SBarry Smith EXTERN int MatCreate(MPI_Comm,int,int,int,int,Mat*); 76273d9f13SBarry Smith EXTERN int MatSetType(Mat,MatType); 77273d9f13SBarry Smith EXTERN int MatSetFromOptions(Mat); 78273d9f13SBarry Smith EXTERN int MatSetUpPreallocation(Mat); 79273d9f13SBarry Smith EXTERN int MatRegisterAll(char*); 80273d9f13SBarry Smith EXTERN int MatRegister(char*,char*,char*,int(*)(Mat)); 81c06d978dSMatthew Knepley EXTERN int MatSerializeRegister(const char [], const char [], const char [], int (*)(MPI_Comm, Mat *, PetscViewer, PetscTruth)); 82*30de9b25SBarry Smith 83*30de9b25SBarry Smith /*MC 84*30de9b25SBarry Smith MatRegisterDynamic - Adds a new matrix type 85*30de9b25SBarry Smith 86*30de9b25SBarry Smith Synopsis: 87*30de9b25SBarry Smith int MatRegisterDynamic(char *name,char *path,char *name_create,int (*routine_create)(Mat)) 88*30de9b25SBarry Smith 89*30de9b25SBarry Smith Not Collective 90*30de9b25SBarry Smith 91*30de9b25SBarry Smith Input Parameters: 92*30de9b25SBarry Smith + name - name of a new user-defined matrix type 93*30de9b25SBarry Smith . path - path (either absolute or relative) the library containing this solver 94*30de9b25SBarry Smith . name_create - name of routine to create method context 95*30de9b25SBarry Smith - routine_create - routine to create method context 96*30de9b25SBarry Smith 97*30de9b25SBarry Smith Notes: 98*30de9b25SBarry Smith MatRegisterDynamic() may be called multiple times to add several user-defined solvers. 99*30de9b25SBarry Smith 100*30de9b25SBarry Smith If dynamic libraries are used, then the fourth input argument (routine_create) 101*30de9b25SBarry Smith is ignored. 102*30de9b25SBarry Smith 103*30de9b25SBarry Smith Sample usage: 104*30de9b25SBarry Smith .vb 105*30de9b25SBarry Smith MatRegisterDynamic("my_mat",/home/username/my_lib/lib/libO/solaris/mylib.a, 106*30de9b25SBarry Smith "MyMatCreate",MyMatCreate); 107*30de9b25SBarry Smith .ve 108*30de9b25SBarry Smith 109*30de9b25SBarry Smith Then, your solver can be chosen with the procedural interface via 110*30de9b25SBarry Smith $ MatSetType(Mat,"my_mat") 111*30de9b25SBarry Smith or at runtime via the option 112*30de9b25SBarry Smith $ -mat_type my_mat 113*30de9b25SBarry Smith 114*30de9b25SBarry Smith Level: advanced 115*30de9b25SBarry Smith 116*30de9b25SBarry Smith Notes: ${PETSC_ARCH} and ${BOPT} occuring in pathname will be replaced with appropriate values. 117*30de9b25SBarry Smith If your function is not being put into a shared library then use VecRegister() instead 118*30de9b25SBarry Smith 119*30de9b25SBarry Smith .keywords: Mat, register 120*30de9b25SBarry Smith 121*30de9b25SBarry Smith .seealso: MatRegisterAll(), MatRegisterDestroy() 122*30de9b25SBarry Smith 123*30de9b25SBarry Smith M*/ 124273d9f13SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 125273d9f13SBarry Smith #define MatRegisterDynamic(a,b,c,d) MatRegister(a,b,c,0) 126273d9f13SBarry Smith #else 127273d9f13SBarry Smith #define MatRegisterDynamic(a,b,c,d) MatRegister(a,b,c,d) 128*30de9b25SBarry Smith #endif 129*30de9b25SBarry Smith 130*30de9b25SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 131*30de9b25SBarry Smith #define MatSerializeRegisterDynamic(a,b,c,d) MatSerializeRegister(a,b,c,0) 132*30de9b25SBarry Smith #else 133c06d978dSMatthew Knepley #define MatSerializeRegisterDynamic(a,b,c,d) MatSerializeRegister(a,b,c,d) 134273d9f13SBarry Smith #endif 135*30de9b25SBarry Smith 136273d9f13SBarry Smith extern PetscTruth MatRegisterAllCalled; 137b0a32e0cSBarry Smith extern PetscFList MatList; 13828988994SBarry Smith 139c06d978dSMatthew Knepley EXTERN PetscFList MatSerializeList; 140c06d978dSMatthew Knepley EXTERN int MatSerializeRegisterAll(const char []); 14165804fbbSSatish Balay EXTERN int MatSerializeRegisterDestroy(void); 142c06d978dSMatthew Knepley EXTERN int MatSerializeRegisterAllCalled; 143c06d978dSMatthew Knepley EXTERN int MatSerialize(MPI_Comm, Mat *, PetscViewer, PetscTruth); 144c06d978dSMatthew Knepley EXTERN int MatSetSerializeType(Mat, MatSerializeType); 145c06d978dSMatthew Knepley 14687828ca2SBarry Smith EXTERN int MatCreateSeqDense(MPI_Comm,int,int,PetscScalar*,Mat*); 14787828ca2SBarry Smith EXTERN int MatCreateMPIDense(MPI_Comm,int,int,int,int,PetscScalar*,Mat*); 148ca44d042SBarry Smith EXTERN int MatCreateSeqAIJ(MPI_Comm,int,int,int,int*,Mat*); 149ca44d042SBarry Smith EXTERN int MatCreateMPIAIJ(MPI_Comm,int,int,int,int,int,int*,int,int*,Mat*); 150c4f061fbSSatish Balay EXTERN int MatCreateMPIRowbs(MPI_Comm,int,int,int,int*,Mat*); 15187828ca2SBarry Smith EXTERN int MatCreateSeqBDiag(MPI_Comm,int,int,int,int,int*,PetscScalar**,Mat*); 15287828ca2SBarry Smith EXTERN int MatCreateMPIBDiag(MPI_Comm,int,int,int,int,int,int*,PetscScalar**,Mat*); 153ca44d042SBarry Smith EXTERN int MatCreateSeqBAIJ(MPI_Comm,int,int,int,int,int*,Mat*); 154ca44d042SBarry Smith EXTERN int MatCreateMPIBAIJ(MPI_Comm,int,int,int,int,int,int,int*,int,int*,Mat*); 155ca44d042SBarry Smith EXTERN int MatCreateMPIAdj(MPI_Comm,int,int,int*,int*,int *,Mat*); 156ca44d042SBarry Smith EXTERN int MatCreateSeqSBAIJ(MPI_Comm,int,int,int,int,int*,Mat*); 157ca44d042SBarry Smith EXTERN int MatCreateMPISBAIJ(MPI_Comm,int,int,int,int,int,int,int*,int,int*,Mat*); 158ca44d042SBarry Smith EXTERN int MatCreateShell(MPI_Comm,int,int,int,int,void *,Mat*); 1593a7fca6bSBarry Smith EXTERN int MatCreateAdic(MPI_Comm,int,int,int,int,int,void (*)(void),Mat*); 160c8a8475eSBarry Smith EXTERN int MatCreateNormal(Mat,Mat*); 161435da068SBarry Smith EXTERN int MatDestroy(Mat); 16221c89e3eSBarry Smith 163ca44d042SBarry Smith EXTERN int MatPrintHelp(Mat); 1648a124369SBarry Smith EXTERN int MatGetPetscMaps(Mat,PetscMap*,PetscMap*); 165ec0117caSBarry Smith 1668ed539a5SBarry Smith /* ------------------------------------------------------------*/ 16787828ca2SBarry Smith EXTERN int MatSetValues(Mat,int,int*,int,int*,PetscScalar*,InsertMode); 16887828ca2SBarry Smith EXTERN int MatSetValuesBlocked(Mat,int,int*,int,int*,PetscScalar*,InsertMode); 16984cb2905SBarry Smith 1702ef4de8bSBarry Smith /*S 1712ef4de8bSBarry Smith MatStencil - Data structure (C struct) for storing information about a single row or 1722ef4de8bSBarry Smith column of a matrix as index on an associated grid. 1732ef4de8bSBarry Smith 1742ef4de8bSBarry Smith Level: beginner 1752ef4de8bSBarry Smith 1762ef4de8bSBarry Smith Concepts: matrix; linear operator 1772ef4de8bSBarry Smith 1782ef4de8bSBarry Smith .seealso: MatSetValuesStencil(), MatSetStencil() 1792ef4de8bSBarry Smith S*/ 180435da068SBarry Smith typedef struct { 181435da068SBarry Smith int k,j,i,c; 182435da068SBarry Smith } MatStencil; 1832ef4de8bSBarry Smith 18487828ca2SBarry Smith EXTERN int MatSetValuesStencil(Mat,int,MatStencil*,int,MatStencil*,PetscScalar*,InsertMode); 18587828ca2SBarry Smith EXTERN int MatSetValuesBlockedStencil(Mat,int,MatStencil*,int,MatStencil*,PetscScalar*,InsertMode); 186435da068SBarry Smith EXTERN int MatSetStencil(Mat,int,int*,int*,int); 187435da068SBarry Smith 1883a7fca6bSBarry Smith EXTERN int MatSetColoring(Mat,ISColoring); 1893a7fca6bSBarry Smith EXTERN int MatSetValuesAdic(Mat,void*); 1903a7fca6bSBarry Smith EXTERN int MatSetValuesAdifor(Mat,int,void*); 1913a7fca6bSBarry Smith 192d91e6319SBarry Smith /*E 193d91e6319SBarry Smith MatAssemblyType - Indicates if the matrix is now to be used, or if you plan 194d91e6319SBarry Smith to continue to add values to it 195d91e6319SBarry Smith 196d91e6319SBarry Smith Level: beginner 197d91e6319SBarry Smith 198d91e6319SBarry Smith .seealso: MatAssemblyBegin(), MatAssemblyEnd() 199d91e6319SBarry Smith E*/ 2006d4a8577SBarry Smith typedef enum {MAT_FLUSH_ASSEMBLY=1,MAT_FINAL_ASSEMBLY=0} MatAssemblyType; 201ca44d042SBarry Smith EXTERN int MatAssemblyBegin(Mat,MatAssemblyType); 202ca44d042SBarry Smith EXTERN int MatAssemblyEnd(Mat,MatAssemblyType); 203ca44d042SBarry Smith EXTERN int MatAssembled(Mat,PetscTruth*); 2044f9c727eSBarry Smith 205*30de9b25SBarry Smith /*MC 206*30de9b25SBarry Smith MatSetValue - Set a single entry into a matrix. 207*30de9b25SBarry Smith 208*30de9b25SBarry Smith Synopsis: 209*30de9b25SBarry Smith int MatSetValue(Mat m,int row,int col,PetscScalar value,InsertMode mode); 210*30de9b25SBarry Smith 211*30de9b25SBarry Smith Not collective 212*30de9b25SBarry Smith 213*30de9b25SBarry Smith Input Parameters: 214*30de9b25SBarry Smith + m - the matrix 215*30de9b25SBarry Smith . row - the row location of the entry 216*30de9b25SBarry Smith . col - the column location of the entry 217*30de9b25SBarry Smith . value - the value to insert 218*30de9b25SBarry Smith - mode - either INSERT_VALUES or ADD_VALUES 219*30de9b25SBarry Smith 220*30de9b25SBarry Smith Notes: 221*30de9b25SBarry Smith For efficiency one should use MatSetValues() and set several or many 222*30de9b25SBarry Smith values simultaneously if possible. 223*30de9b25SBarry Smith 224*30de9b25SBarry Smith Note that MatSetValue() does NOT return an error code (since this 225*30de9b25SBarry Smith is checked internally). 226*30de9b25SBarry Smith 227*30de9b25SBarry Smith Level: beginner 228*30de9b25SBarry Smith 229*30de9b25SBarry Smith .seealso: MatSetValues(), MatSetValueLocal() 230*30de9b25SBarry Smith M*/ 231b951964fSBarry Smith #define MatSetValue(v,i,j,va,mode) \ 232ea709b57SSatish Balay 0; {int _ierr,_row = i,_col = j; PetscScalar _va = va; \ 233b951964fSBarry Smith _ierr = MatSetValues(v,1,&_row,1,&_col,&_va,mode);CHKERRQ(_ierr); \ 234b951964fSBarry Smith } 235*30de9b25SBarry Smith 236ea06a074SBarry Smith #define MatGetValue(v,i,j,va) \ 237d91e6319SBarry Smith 0; {int _ierr,_row = i,_col = j; \ 238ea06a074SBarry Smith _ierr = MatGetValues(v,1,&_row,1,&_col,&va);CHKERRQ(_ierr); \ 239ea06a074SBarry Smith } 240*30de9b25SBarry Smith 241d91e6319SBarry Smith #define MatSetValueLocal(v,i,j,va,mode) \ 242ea709b57SSatish Balay 0; {int _ierr,_row = i,_col = j; PetscScalar _va = va; \ 243d91e6319SBarry Smith _ierr = MatSetValuesLocal(v,1,&_row,1,&_col,&_va,mode);CHKERRQ(_ierr); \ 244d91e6319SBarry Smith } 245*30de9b25SBarry Smith 246d91e6319SBarry Smith /*E 247d91e6319SBarry Smith MatOption - Options that may be set for a matrix and its behavior or storage 248d91e6319SBarry Smith 249d91e6319SBarry Smith Level: beginner 250d91e6319SBarry Smith 2510a835dfdSSatish Balay Any additions/changes here MUST also be made in include/finclude/petscmat.h 252d91e6319SBarry Smith 253d91e6319SBarry Smith .seealso: MatSetOption() 254d91e6319SBarry Smith E*/ 2556d4a8577SBarry Smith typedef enum {MAT_ROW_ORIENTED=1,MAT_COLUMN_ORIENTED=2,MAT_ROWS_SORTED=4, 2566d4a8577SBarry Smith MAT_COLUMNS_SORTED=8,MAT_NO_NEW_NONZERO_LOCATIONS=16, 2576d4a8577SBarry Smith MAT_YES_NEW_NONZERO_LOCATIONS=32,MAT_SYMMETRIC=64, 2586ca9ecd3SBarry Smith MAT_STRUCTURALLY_SYMMETRIC=65,MAT_NO_NEW_DIAGONALS=66, 2596ca9ecd3SBarry Smith MAT_YES_NEW_DIAGONALS=67,MAT_INODE_LIMIT_1=68,MAT_INODE_LIMIT_2=69, 2606ca9ecd3SBarry Smith MAT_INODE_LIMIT_3=70,MAT_INODE_LIMIT_4=71,MAT_INODE_LIMIT_5=72, 2616ca9ecd3SBarry Smith MAT_IGNORE_OFF_PROC_ENTRIES=73,MAT_ROWS_UNSORTED=74, 2624787f768SSatish Balay MAT_COLUMNS_UNSORTED=75,MAT_NEW_NONZERO_LOCATION_ERR=76, 2637c922b88SBarry Smith MAT_NEW_NONZERO_ALLOCATION_ERR=77,MAT_USE_HASH_TABLE=78, 2642bad1931SBarry Smith MAT_KEEP_ZEROED_ROWS=79,MAT_IGNORE_ZERO_ENTRIES=80,MAT_USE_INODES=81, 265123145dfSKris Buschelman MAT_DO_NOT_USE_INODES=82} MatOption; 266ca44d042SBarry Smith EXTERN int MatSetOption(Mat,MatOption); 267273d9f13SBarry Smith EXTERN int MatGetType(Mat,MatType*); 26884cb2905SBarry Smith 26987828ca2SBarry Smith EXTERN int MatGetValues(Mat,int,int*,int,int*,PetscScalar*); 27087828ca2SBarry Smith EXTERN int MatGetRow(Mat,int,int *,int **,PetscScalar**); 27187828ca2SBarry Smith EXTERN int MatRestoreRow(Mat,int,int *,int **,PetscScalar**); 27287828ca2SBarry Smith EXTERN int MatGetColumn(Mat,int,int *,int **,PetscScalar**); 27387828ca2SBarry Smith EXTERN int MatRestoreColumn(Mat,int,int *,int **,PetscScalar**); 274ca44d042SBarry Smith EXTERN int MatGetColumnVector(Mat,Vec,int); 27587828ca2SBarry Smith EXTERN int MatGetArray(Mat,PetscScalar **); 27687828ca2SBarry Smith EXTERN int MatRestoreArray(Mat,PetscScalar **); 277ca44d042SBarry Smith EXTERN int MatGetBlockSize(Mat,int *); 2787b80b807SBarry Smith 279ca44d042SBarry Smith EXTERN int MatMult(Mat,Vec,Vec); 280ca44d042SBarry Smith EXTERN int MatMultAdd(Mat,Vec,Vec,Vec); 281ca44d042SBarry Smith EXTERN int MatMultTranspose(Mat,Vec,Vec); 282cd0d46ebSvictorle EXTERN int MatIsSymmetric(Mat,Mat,PetscTruth*); 283ca44d042SBarry Smith EXTERN int MatMultTransposeAdd(Mat,Vec,Vec,Vec); 284c06d978dSMatthew Knepley EXTERN int MatMultConstrained(Mat,Vec,Vec); 2856d0dc95fSMatthew Knepley EXTERN int MatMultTransposeConstrained(Mat,Vec,Vec); 2862eac72dbSBarry Smith 287d91e6319SBarry Smith /*E 288d91e6319SBarry Smith MatDuplicateOption - Indicates if a duplicated sparse matrix should have 289d91e6319SBarry Smith its numerical values copied over or just its nonzero structure. 290d91e6319SBarry Smith 291d91e6319SBarry Smith Level: beginner 292d91e6319SBarry Smith 293d91e6319SBarry Smith Any additions/changes here MUST also be made in include/finclude/petscmat.h 294d91e6319SBarry Smith 295d91e6319SBarry Smith .seealso: MatDuplicate() 296d91e6319SBarry Smith E*/ 2972e8a6d31SBarry Smith typedef enum {MAT_DO_NOT_COPY_VALUES,MAT_COPY_VALUES} MatDuplicateOption; 2982e8a6d31SBarry Smith 299273d9f13SBarry Smith EXTERN int MatConvertRegister(char*,char*,char*,int (*)(Mat,MatType,Mat*)); 300273d9f13SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 301273d9f13SBarry Smith #define MatConvertRegisterDynamic(a,b,c,d) MatConvertRegister(a,b,c,0) 302273d9f13SBarry Smith #else 303273d9f13SBarry Smith #define MatConvertRegisterDynamic(a,b,c,d) MatConvertRegister(a,b,c,d) 304273d9f13SBarry Smith #endif 305273d9f13SBarry Smith EXTERN int MatConvertRegisterAll(char*); 306273d9f13SBarry Smith EXTERN int MatConvertRegisterDestroy(void); 307273d9f13SBarry Smith extern PetscTruth MatConvertRegisterAllCalled; 308b0a32e0cSBarry Smith extern PetscFList MatConvertList; 309ca44d042SBarry Smith EXTERN int MatConvert(Mat,MatType,Mat*); 310ca44d042SBarry Smith EXTERN int MatDuplicate(Mat,MatDuplicateOption,Mat*); 31194a9d846SBarry Smith 312d91e6319SBarry Smith /*E 313d91e6319SBarry Smith MatStructure - Indicates if the matrix has the same nonzero structure 314d91e6319SBarry Smith 315d91e6319SBarry Smith Level: beginner 316d91e6319SBarry Smith 317d91e6319SBarry Smith Any additions/changes here MUST also be made in include/finclude/petscmat.h 318d91e6319SBarry Smith 319d91e6319SBarry Smith .seealso: MatCopy(), SLESSetOperators(), PCSetOperators() 320d91e6319SBarry Smith E*/ 321c537a176SHong Zhang typedef enum {SAME_NONZERO_PATTERN,DIFFERENT_NONZERO_PATTERN,SAME_PRECONDITIONER,SUBSET_NONZERO_PATTERN} MatStructure; 322cb5b572fSBarry Smith 323ca44d042SBarry Smith EXTERN int MatCopy(Mat,Mat,MatStructure); 324b0a32e0cSBarry Smith EXTERN int MatView(Mat,PetscViewer); 325273d9f13SBarry Smith 326b0a32e0cSBarry Smith EXTERN int MatLoadRegister(char*,char*,char*,int (*)(PetscViewer,MatType,Mat*)); 327273d9f13SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 328273d9f13SBarry Smith #define MatLoadRegisterDynamic(a,b,c,d) MatLoadRegister(a,b,c,0) 329273d9f13SBarry Smith #else 330273d9f13SBarry Smith #define MatLoadRegisterDynamic(a,b,c,d) MatLoadRegister(a,b,c,d) 331273d9f13SBarry Smith #endif 332273d9f13SBarry Smith EXTERN int MatLoadRegisterAll(char*); 333273d9f13SBarry Smith EXTERN int MatLoadRegisterDestroy(void); 334273d9f13SBarry Smith extern PetscTruth MatLoadRegisterAllCalled; 335b0a32e0cSBarry Smith extern PetscFList MatLoadList; 336b0a32e0cSBarry Smith EXTERN int MatLoad(PetscViewer,MatType,Mat*); 33751dd7536SBarry Smith EXTERN int MatMerge(MPI_Comm,Mat,Mat*); 3387b80b807SBarry Smith 339ca44d042SBarry Smith EXTERN int MatGetRowIJ(Mat,int,PetscTruth,int*,int **,int **,PetscTruth *); 340ca44d042SBarry Smith EXTERN int MatRestoreRowIJ(Mat,int,PetscTruth,int *,int **,int **,PetscTruth *); 341ca44d042SBarry Smith EXTERN int MatGetColumnIJ(Mat,int,PetscTruth,int*,int **,int **,PetscTruth *); 342ca44d042SBarry Smith EXTERN int MatRestoreColumnIJ(Mat,int,PetscTruth,int *,int **,int **,PetscTruth *); 343d4fbbf0eSBarry Smith 344d91e6319SBarry Smith /*S 345d91e6319SBarry Smith MatInfo - Context of matrix information, used with MatGetInfo() 346d91e6319SBarry Smith 347d91e6319SBarry Smith In Fortran this is simply a double precision array of dimension MAT_INFO_SIZE 348d91e6319SBarry Smith 349d91e6319SBarry Smith Level: intermediate 350d91e6319SBarry Smith 351d91e6319SBarry Smith Concepts: matrix^nonzero information 352d91e6319SBarry Smith 353d9274352SBarry Smith .seealso: MatGetInfo(), MatInfoType 354d91e6319SBarry Smith S*/ 3554e220ebcSLois Curfman McInnes typedef struct { 356b0a32e0cSBarry Smith PetscLogDouble rows_global,columns_global; /* number of global rows and columns */ 357b0a32e0cSBarry Smith PetscLogDouble rows_local,columns_local; /* number of local rows and columns */ 358b0a32e0cSBarry Smith PetscLogDouble block_size; /* block size */ 359b0a32e0cSBarry Smith PetscLogDouble nz_allocated,nz_used,nz_unneeded; /* number of nonzeros */ 360b0a32e0cSBarry Smith PetscLogDouble memory; /* memory allocated */ 361b0a32e0cSBarry Smith PetscLogDouble assemblies; /* number of matrix assemblies called */ 362b0a32e0cSBarry Smith PetscLogDouble mallocs; /* number of mallocs during MatSetValues() */ 363b0a32e0cSBarry Smith PetscLogDouble fill_ratio_given,fill_ratio_needed; /* fill ratio for LU/ILU */ 364b0a32e0cSBarry Smith PetscLogDouble factor_mallocs; /* number of mallocs during factorization */ 3654e220ebcSLois Curfman McInnes } MatInfo; 3664e220ebcSLois Curfman McInnes 367d9274352SBarry Smith /*E 368d9274352SBarry Smith MatInfoType - Indicates if you want information about the local part of the matrix, 369d9274352SBarry Smith the entire parallel matrix or the maximum over all the local parts. 370d9274352SBarry Smith 371d9274352SBarry Smith Level: beginner 372d9274352SBarry Smith 373d9274352SBarry Smith Any additions/changes here MUST also be made in include/finclude/petscmat.h 374d9274352SBarry Smith 375d9274352SBarry Smith .seealso: MatGetInfo(), MatInfo 376d9274352SBarry Smith E*/ 3777b80b807SBarry Smith typedef enum {MAT_LOCAL=1,MAT_GLOBAL_MAX=2,MAT_GLOBAL_SUM=3} MatInfoType; 378ca44d042SBarry Smith EXTERN int MatGetInfo(Mat,MatInfoType,MatInfo*); 379ca44d042SBarry Smith EXTERN int MatValid(Mat,PetscTruth*); 380ca44d042SBarry Smith EXTERN int MatGetDiagonal(Mat,Vec); 381273d9f13SBarry Smith EXTERN int MatGetRowMax(Mat,Vec); 382ca44d042SBarry Smith EXTERN int MatTranspose(Mat,Mat*); 383ca44d042SBarry Smith EXTERN int MatPermute(Mat,IS,IS,Mat *); 384bf1d55d4SSatish Balay EXTERN int MatPermuteSparsify(Mat,int,PetscReal,PetscReal,IS,IS,Mat *); 385ca44d042SBarry Smith EXTERN int MatDiagonalScale(Mat,Vec,Vec); 38606ef90c2SBarry Smith EXTERN int MatDiagonalSet(Mat,Vec,InsertMode); 387ca44d042SBarry Smith EXTERN int MatEqual(Mat,Mat,PetscTruth*); 3887b80b807SBarry Smith 38987828ca2SBarry Smith EXTERN int MatNorm(Mat,NormType,PetscReal *); 390ca44d042SBarry Smith EXTERN int MatZeroEntries(Mat); 39187828ca2SBarry Smith EXTERN int MatZeroRows(Mat,IS,PetscScalar*); 39287828ca2SBarry Smith EXTERN int MatZeroColumns(Mat,IS,PetscScalar*); 3937b80b807SBarry Smith 394ca44d042SBarry Smith EXTERN int MatUseScaledForm(Mat,PetscTruth); 395ca44d042SBarry Smith EXTERN int MatScaleSystem(Mat,Vec,Vec); 396ca44d042SBarry Smith EXTERN int MatUnScaleSystem(Mat,Vec,Vec); 3975ef9f2a5SBarry Smith 398ca44d042SBarry Smith EXTERN int MatGetSize(Mat,int*,int*); 399ca44d042SBarry Smith EXTERN int MatGetLocalSize(Mat,int*,int*); 400ca44d042SBarry Smith EXTERN int MatGetOwnershipRange(Mat,int*,int*); 4017b80b807SBarry Smith 402d91e6319SBarry Smith /*E 403d91e6319SBarry Smith MatReuse - Indicates if matrices obtained from a previous call to MatGetSubMatrices() 404d91e6319SBarry Smith or MatGetSubMatrix() are to be reused to store the new matrix values. 405d91e6319SBarry Smith 406d91e6319SBarry Smith Level: beginner 407d91e6319SBarry Smith 408d91e6319SBarry Smith Any additions/changes here MUST also be made in include/finclude/petscmat.h 409d91e6319SBarry Smith 410d91e6319SBarry Smith .seealso: MatGetSubMatrices(), MatGetSubMatrix(), MatDestroyMatrices() 411d91e6319SBarry Smith E*/ 4127b2a1423SBarry Smith typedef enum {MAT_INITIAL_MATRIX,MAT_REUSE_MATRIX} MatReuse; 413ca44d042SBarry Smith EXTERN int MatGetSubMatrices(Mat,int,IS *,IS *,MatReuse,Mat **); 414ca44d042SBarry Smith EXTERN int MatDestroyMatrices(int,Mat **); 415ca44d042SBarry Smith EXTERN int MatGetSubMatrix(Mat,IS,IS,int,MatReuse,Mat *); 4168efafbd8SBarry Smith 417ca44d042SBarry Smith EXTERN int MatIncreaseOverlap(Mat,int,IS *,int); 4187b80b807SBarry Smith 419607cd303SBarry Smith EXTERN int MatAXPY(PetscScalar *,Mat,Mat,MatStructure); 42087828ca2SBarry Smith EXTERN int MatAYPX(PetscScalar *,Mat,Mat); 421ca44d042SBarry Smith EXTERN int MatCompress(Mat); 4227b80b807SBarry Smith 42387828ca2SBarry Smith EXTERN int MatScale(PetscScalar *,Mat); 42487828ca2SBarry Smith EXTERN int MatShift(PetscScalar *,Mat); 425052efed2SBarry Smith 426ca44d042SBarry Smith EXTERN int MatSetLocalToGlobalMapping(Mat,ISLocalToGlobalMapping); 427ca44d042SBarry Smith EXTERN int MatSetLocalToGlobalMappingBlock(Mat,ISLocalToGlobalMapping); 42887828ca2SBarry Smith EXTERN int MatZeroRowsLocal(Mat,IS,PetscScalar*); 42987828ca2SBarry Smith EXTERN int MatSetValuesLocal(Mat,int,int*,int,int*,PetscScalar*,InsertMode); 43087828ca2SBarry Smith EXTERN int MatSetValuesBlockedLocal(Mat,int,int*,int,int*,PetscScalar*,InsertMode); 43190f02eecSBarry Smith 432ca44d042SBarry Smith EXTERN int MatSetStashInitialSize(Mat,int,int); 433649db694SBarry Smith 434ca44d042SBarry Smith EXTERN int MatInterpolateAdd(Mat,Vec,Vec,Vec); 435ca44d042SBarry Smith EXTERN int MatInterpolate(Mat,Vec,Vec); 436ca44d042SBarry Smith EXTERN int MatRestrict(Mat,Vec,Vec); 4377c922b88SBarry Smith 438bd481603SBarry Smith 439bd481603SBarry Smith /*MC 440bd481603SBarry Smith MatPreallocInitialize - Begins the block of code that will count the number of nonzeros per 441bd481603SBarry Smith row in a matrix providing the data that one can use to correctly preallocate the matrix. 442bd481603SBarry Smith 443bd481603SBarry Smith Synopsis: 444bd481603SBarry Smith int MatPreallocateInitialize(MPI_Comm comm, int nrows, int ncols, int *dnz, int *onz) 445bd481603SBarry Smith 446bd481603SBarry Smith Collective on MPI_Comm 447bd481603SBarry Smith 448bd481603SBarry Smith Input Parameters: 449bd481603SBarry Smith + comm - the communicator that will share the eventually allocated matrix 450bd481603SBarry Smith . nrows - the number of rows in the matrix 451bd481603SBarry Smith - ncols - the number of columns in the matrix 452bd481603SBarry Smith 453bd481603SBarry Smith Output Parameters: 454bd481603SBarry Smith + dnz - the array that will be passed to the matrix preallocation routines 455bd481603SBarry Smith - ozn - the other array passed to the matrix preallocation routines 456bd481603SBarry Smith 457bd481603SBarry Smith 458bd481603SBarry Smith Level: intermediate 459bd481603SBarry Smith 460bd481603SBarry Smith Notes: 461bd481603SBarry Smith See the chapter in the users manual on performance for more details 462bd481603SBarry Smith 463bd481603SBarry Smith Do not malloc or free dnz and onz that is handled internally by these routines 464bd481603SBarry Smith 465bd481603SBarry Smith Use MatPreallocateInitializeSymmetric() for symmetric matrices (MPISBAIJ matrices) 466bd481603SBarry Smith 467bd481603SBarry Smith Concepts: preallocation^Matrix 468bd481603SBarry Smith 469bd481603SBarry Smith .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateSetLocal(), 470bd481603SBarry Smith MatPreallocateInitializeSymmetric(), MatPreallocateSymmetricSetLocal() 471bd481603SBarry Smith M*/ 472c4f061fbSSatish Balay #define MatPreallocateInitialize(comm,nrows,ncols,dnz,onz) 0; \ 4737c922b88SBarry Smith { \ 474ef66eb69SBarry Smith int _4_ierr,__tmp = (nrows),__ctmp = (ncols),__rstart,__start,__end; \ 475ef66eb69SBarry Smith _4_ierr = PetscMalloc(2*__tmp*sizeof(int),&dnz);CHKERRQ(_4_ierr);onz = dnz + __tmp;\ 476ef66eb69SBarry Smith _4_ierr = PetscMemzero(dnz,2*__tmp*sizeof(int));CHKERRQ(_4_ierr);\ 477ef66eb69SBarry Smith _4_ierr = MPI_Scan(&__ctmp,&__end,1,MPI_INT,MPI_SUM,comm);CHKERRQ(_4_ierr); __start = __end - __ctmp;\ 478ef66eb69SBarry Smith _4_ierr = MPI_Scan(&__tmp,&__rstart,1,MPI_INT,MPI_SUM,comm);CHKERRQ(_4_ierr); __rstart = __rstart - __tmp; 4797c922b88SBarry Smith 480bd481603SBarry Smith /*MC 481bd481603SBarry Smith MatPreallocSymmetricInitialize - Begins the block of code that will count the number of nonzeros per 482bd481603SBarry Smith row in a matrix providing the data that one can use to correctly preallocate the matrix. 483bd481603SBarry Smith 484bd481603SBarry Smith Synopsis: 485bd481603SBarry Smith int MatPreallocateSymmetricInitialize(MPI_Comm comm, int nrows, int ncols, int *dnz, int *onz) 486bd481603SBarry Smith 487bd481603SBarry Smith Collective on MPI_Comm 488bd481603SBarry Smith 489bd481603SBarry Smith Input Parameters: 490bd481603SBarry Smith + comm - the communicator that will share the eventually allocated matrix 491bd481603SBarry Smith . nrows - the number of rows in the matrix 492bd481603SBarry Smith - ncols - the number of columns in the matrix 493bd481603SBarry Smith 494bd481603SBarry Smith Output Parameters: 495bd481603SBarry Smith + dnz - the array that will be passed to the matrix preallocation routines 496bd481603SBarry Smith - ozn - the other array passed to the matrix preallocation routines 497bd481603SBarry Smith 498bd481603SBarry Smith 499bd481603SBarry Smith Level: intermediate 500bd481603SBarry Smith 501bd481603SBarry Smith Notes: 502bd481603SBarry Smith See the chapter in the users manual on performance for more details 503bd481603SBarry Smith 504bd481603SBarry Smith Do not malloc or free dnz and onz that is handled internally by these routines 505bd481603SBarry Smith 506bd481603SBarry Smith Concepts: preallocation^Matrix 507bd481603SBarry Smith 508bd481603SBarry Smith .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateSetLocal(), 509bd481603SBarry Smith MatPreallocateInitialize(), MatPreallocateSymmetricSetLocal() 510bd481603SBarry Smith M*/ 511222b16d4SBarry Smith #define MatPreallocateSymmetricInitialize(comm,nrows,ncols,dnz,onz) 0; \ 512222b16d4SBarry Smith { \ 513222b16d4SBarry Smith int _4_ierr,__tmp = (nrows),__ctmp = (ncols),__rstart,__end; \ 514222b16d4SBarry Smith _4_ierr = PetscMalloc(2*__tmp*sizeof(int),&dnz);CHKERRQ(_4_ierr);onz = dnz + __tmp;\ 515222b16d4SBarry Smith _4_ierr = PetscMemzero(dnz,2*__tmp*sizeof(int));CHKERRQ(_4_ierr);\ 516222b16d4SBarry Smith _4_ierr = MPI_Scan(&__ctmp,&__end,1,MPI_INT,MPI_SUM,comm);CHKERRQ(_4_ierr);\ 517222b16d4SBarry Smith _4_ierr = MPI_Scan(&__tmp,&__rstart,1,MPI_INT,MPI_SUM,comm);CHKERRQ(_4_ierr); __rstart = __rstart - __tmp; 518222b16d4SBarry Smith 519bd481603SBarry Smith /*MC 520bd481603SBarry Smith MatPreallocateSetLocal - Indicates the locations (rows and columns) in the matrix where nonzeros will be 521bd481603SBarry Smith inserted using a local number of the rows and columns 522bd481603SBarry Smith 523bd481603SBarry Smith Synopsis: 524bd481603SBarry Smith int MatPreallocateSetLocal(ISLocalToGlobalMappping map,int nrows, int *rows,int ncols, int *cols,int *dnz, int *onz) 525bd481603SBarry Smith 526bd481603SBarry Smith Not Collective 527bd481603SBarry Smith 528bd481603SBarry Smith Input Parameters: 529bd481603SBarry Smith + map - the mapping between local numbering and global numbering 530bd481603SBarry Smith . nrows - the number of rows indicated 531bd481603SBarry Smith . rows - the indices of the rows (these will be mapped in the 532bd481603SBarry Smith . ncols - the number of columns in the matrix 533bd481603SBarry Smith . cols - the columns indicated 534bd481603SBarry Smith . dnz - the array that will be passed to the matrix preallocation routines 535bd481603SBarry Smith - ozn - the other array passed to the matrix preallocation routines 536bd481603SBarry Smith 537bd481603SBarry Smith 538bd481603SBarry Smith Level: intermediate 539bd481603SBarry Smith 540bd481603SBarry Smith Notes: 541bd481603SBarry Smith See the chapter in the users manual on performance for more details 542bd481603SBarry Smith 543bd481603SBarry Smith Do not malloc or free dnz and onz that is handled internally by these routines 544bd481603SBarry Smith 545bd481603SBarry Smith Concepts: preallocation^Matrix 546bd481603SBarry Smith 547bd481603SBarry Smith .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateInitialize(), 548bd481603SBarry Smith MatPreallocateInitialize(), MatPreallocateSymmetricSetLocal() 549bd481603SBarry Smith M*/ 550c4f061fbSSatish Balay #define MatPreallocateSetLocal(map,nrows,rows,ncols,cols,dnz,onz) 0;\ 551c4f061fbSSatish Balay {\ 552c4f061fbSSatish Balay int __l;\ 553ef66eb69SBarry Smith _4_ierr = ISLocalToGlobalMappingApply(map,nrows,rows,rows);CHKERRQ(_4_ierr);\ 554ef66eb69SBarry Smith _4_ierr = ISLocalToGlobalMappingApply(map,ncols,cols,cols);CHKERRQ(_4_ierr);\ 555c4f061fbSSatish Balay for (__l=0;__l<nrows;__l++) {\ 556ef66eb69SBarry Smith _4_ierr = MatPreallocateSet((rows)[__l],ncols,cols,dnz,onz);CHKERRQ(_4_ierr);\ 557c4f061fbSSatish Balay }\ 558c4f061fbSSatish Balay } 559c4f061fbSSatish Balay 560bd481603SBarry Smith /*MC 561bd481603SBarry Smith MatPreallocateSymmetricSetLocal - Indicates the locations (rows and columns) in the matrix where nonzeros will be 562bd481603SBarry Smith inserted using a local number of the rows and columns 563bd481603SBarry Smith 564bd481603SBarry Smith Synopsis: 565bd481603SBarry Smith int MatPreallocateSymmetricSetLocal(ISLocalToGlobalMappping map,int nrows, int *rows,int ncols, int *cols,int *dnz, int *onz) 566bd481603SBarry Smith 567bd481603SBarry Smith Not Collective 568bd481603SBarry Smith 569bd481603SBarry Smith Input Parameters: 570bd481603SBarry Smith + map - the mapping between local numbering and global numbering 571bd481603SBarry Smith . nrows - the number of rows indicated 572bd481603SBarry Smith . rows - the indices of the rows (these will be mapped in the 573bd481603SBarry Smith . ncols - the number of columns in the matrix 574bd481603SBarry Smith . cols - the columns indicated 575bd481603SBarry Smith . dnz - the array that will be passed to the matrix preallocation routines 576bd481603SBarry Smith - ozn - the other array passed to the matrix preallocation routines 577bd481603SBarry Smith 578bd481603SBarry Smith 579bd481603SBarry Smith Level: intermediate 580bd481603SBarry Smith 581bd481603SBarry Smith Notes: 582bd481603SBarry Smith See the chapter in the users manual on performance for more details 583bd481603SBarry Smith 584bd481603SBarry Smith Do not malloc or free dnz and onz that is handled internally by these routines 585bd481603SBarry Smith 586bd481603SBarry Smith Concepts: preallocation^Matrix 587bd481603SBarry Smith 588bd481603SBarry Smith .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateInitialize(), 589bd481603SBarry Smith MatPreallocateInitialize(), MatPreallocateSymmetricSetLocal(), MatPreallocateSetLocal() 590bd481603SBarry Smith M*/ 591d3d32019SBarry Smith #define MatPreallocateSymmetricSetLocal(map,nrows,rows,ncols,cols,dnz,onz) 0;\ 592d3d32019SBarry Smith {\ 593d3d32019SBarry Smith int __l;\ 594d3d32019SBarry Smith _4_ierr = ISLocalToGlobalMappingApply(map,nrows,rows,rows);CHKERRQ(_4_ierr);\ 595d3d32019SBarry Smith _4_ierr = ISLocalToGlobalMappingApply(map,ncols,cols,cols);CHKERRQ(_4_ierr);\ 596d3d32019SBarry Smith for (__l=0;__l<nrows;__l++) {\ 597d3d32019SBarry Smith _4_ierr = MatPreallocateSymmetricSet((rows)[__l],ncols,cols,dnz,onz);CHKERRQ(_4_ierr);\ 598d3d32019SBarry Smith }\ 599d3d32019SBarry Smith } 600d3d32019SBarry Smith 601bd481603SBarry Smith /*MC 602bd481603SBarry Smith MatPreallocateSet - Indicates the locations (rows and columns) in the matrix where nonzeros will be 603bd481603SBarry Smith inserted using a local number of the rows and columns 604bd481603SBarry Smith 605bd481603SBarry Smith Synopsis: 606bd481603SBarry Smith int MatPreallocateSet(int nrows, int *rows,int ncols, int *cols,int *dnz, int *onz) 607bd481603SBarry Smith 608bd481603SBarry Smith Not Collective 609bd481603SBarry Smith 610bd481603SBarry Smith Input Parameters: 611bd481603SBarry Smith + nrows - the number of rows indicated 612bd481603SBarry Smith . rows - the indices of the rows (these will be mapped in the 613bd481603SBarry Smith . ncols - the number of columns in the matrix 614bd481603SBarry Smith . cols - the columns indicated 615bd481603SBarry Smith . dnz - the array that will be passed to the matrix preallocation routines 616bd481603SBarry Smith - ozn - the other array passed to the matrix preallocation routines 617bd481603SBarry Smith 618bd481603SBarry Smith 619bd481603SBarry Smith Level: intermediate 620bd481603SBarry Smith 621bd481603SBarry Smith Notes: 622bd481603SBarry Smith See the chapter in the users manual on performance for more details 623bd481603SBarry Smith 624bd481603SBarry Smith Do not malloc or free dnz and onz that is handled internally by these routines 625bd481603SBarry Smith 626bd481603SBarry Smith Concepts: preallocation^Matrix 627bd481603SBarry Smith 628bd481603SBarry Smith .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateInitialize(), 629bd481603SBarry Smith MatPreallocateInitialize(), MatPreallocateSymmetricSetLocal(), MatPreallocateSetLocal() 630bd481603SBarry Smith M*/ 631c4f061fbSSatish Balay #define MatPreallocateSet(row,nc,cols,dnz,onz) 0;\ 6327c922b88SBarry Smith { int __i; \ 6337c922b88SBarry Smith for (__i=0; __i<nc; __i++) {\ 6347c922b88SBarry Smith if (cols[__i] < __start || cols[__i] >= __end) onz[row - __rstart]++; \ 6357c922b88SBarry Smith }\ 6367c922b88SBarry Smith dnz[row - __rstart] = nc - onz[row - __rstart];\ 6377c922b88SBarry Smith } 6387c922b88SBarry Smith 639bd481603SBarry Smith /*MC 640bd481603SBarry Smith MatPreallocateSymmetricSet - Indicates the locations (rows and columns) in the matrix where nonzeros will be 641bd481603SBarry Smith inserted using a local number of the rows and columns 642bd481603SBarry Smith 643bd481603SBarry Smith Synopsis: 644bd481603SBarry Smith int MatPreallocateSymmetricSet(int nrows, int *rows,int ncols, int *cols,int *dnz, int *onz) 645bd481603SBarry Smith 646bd481603SBarry Smith Not Collective 647bd481603SBarry Smith 648bd481603SBarry Smith Input Parameters: 649bd481603SBarry Smith + nrows - the number of rows indicated 650bd481603SBarry Smith . rows - the indices of the rows (these will be mapped in the 651bd481603SBarry Smith . ncols - the number of columns in the matrix 652bd481603SBarry Smith . cols - the columns indicated 653bd481603SBarry Smith . dnz - the array that will be passed to the matrix preallocation routines 654bd481603SBarry Smith - ozn - the other array passed to the matrix preallocation routines 655bd481603SBarry Smith 656bd481603SBarry Smith 657bd481603SBarry Smith Level: intermediate 658bd481603SBarry Smith 659bd481603SBarry Smith Notes: 660bd481603SBarry Smith See the chapter in the users manual on performance for more details 661bd481603SBarry Smith 662bd481603SBarry Smith Do not malloc or free dnz and onz that is handled internally by these routines 663bd481603SBarry Smith 664bd481603SBarry Smith Concepts: preallocation^Matrix 665bd481603SBarry Smith 666bd481603SBarry Smith .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateInitialize(), 667bd481603SBarry Smith MatPreallocateInitialize(), MatPreallocateSymmetricSetLocal(), MatPreallocateSetLocal() 668bd481603SBarry Smith M*/ 669d3d32019SBarry Smith #define MatPreallocateSymmetricSet(row,nc,cols,dnz,onz) 0;\ 670d3d32019SBarry Smith { int __i; \ 671d3d32019SBarry Smith for (__i=0; __i<nc; __i++) {\ 672d3d32019SBarry Smith if (cols[__i] >= __end) onz[row - __rstart]++; \ 673d3d32019SBarry Smith else if (cols[__i] >= row) dnz[row - __rstart]++;\ 674d3d32019SBarry Smith }\ 675d3d32019SBarry Smith } 676d3d32019SBarry Smith 677bd481603SBarry Smith /*MC 678bd481603SBarry Smith MatPreallocFinalize - Ends the block of code that will count the number of nonzeros per 679bd481603SBarry Smith row in a matrix providing the data that one can use to correctly preallocate the matrix. 680bd481603SBarry Smith 681bd481603SBarry Smith Synopsis: 682bd481603SBarry Smith int MatPreallocateFinalize(int *dnz, int *onz) 683bd481603SBarry Smith 684bd481603SBarry Smith Collective on MPI_Comm 685bd481603SBarry Smith 686bd481603SBarry Smith Input Parameters: 687bd481603SBarry Smith + dnz - the array that will be passed to the matrix preallocation routines 688bd481603SBarry Smith - ozn - the other array passed to the matrix preallocation routines 689bd481603SBarry Smith 690bd481603SBarry Smith 691bd481603SBarry Smith Level: intermediate 692bd481603SBarry Smith 693bd481603SBarry Smith Notes: 694bd481603SBarry Smith See the chapter in the users manual on performance for more details 695bd481603SBarry Smith 696bd481603SBarry Smith Do not malloc or free dnz and onz that is handled internally by these routines 697bd481603SBarry Smith 698bd481603SBarry Smith Concepts: preallocation^Matrix 699bd481603SBarry Smith 700bd481603SBarry Smith .seealso: MatPreallocateInitialize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateSetLocal(), 701bd481603SBarry Smith MatPreallocateSymmetricInitialize(), MatPreallocateSymmetricSetLocal() 702bd481603SBarry Smith M*/ 703ef66eb69SBarry Smith #define MatPreallocateFinalize(dnz,onz) 0;_4_ierr = PetscFree(dnz);CHKERRQ(_4_ierr);} 7047c922b88SBarry Smith 705bd481603SBarry Smith 706bd481603SBarry Smith 7077b80b807SBarry Smith /* Routines unique to particular data structures */ 708435da068SBarry Smith EXTERN int MatShellGetContext(Mat,void **); 709435da068SBarry Smith 71087828ca2SBarry Smith EXTERN int MatBDiagGetData(Mat,int*,int*,int**,int**,PetscScalar***); 711ca44d042SBarry Smith EXTERN int MatSeqAIJSetColumnIndices(Mat,int *); 712ca44d042SBarry Smith EXTERN int MatSeqBAIJSetColumnIndices(Mat,int *); 71387828ca2SBarry Smith EXTERN int MatCreateSeqAIJWithArrays(MPI_Comm,int,int,int*,int*,PetscScalar *,Mat*); 7147b80b807SBarry Smith 715273d9f13SBarry Smith EXTERN int MatSeqBAIJSetPreallocation(Mat,int,int,int*); 716273d9f13SBarry Smith EXTERN int MatSeqSBAIJSetPreallocation(Mat,int,int,int*); 717273d9f13SBarry Smith EXTERN int MatSeqAIJSetPreallocation(Mat,int,int*); 71887828ca2SBarry Smith EXTERN int MatSeqDensePreallocation(Mat,PetscScalar*); 71987828ca2SBarry Smith EXTERN int MatSeqBDiagSetPreallocation(Mat,int,int,int*,PetscScalar**); 72087828ca2SBarry Smith EXTERN int MatSeqDenseSetPreallocation(Mat,PetscScalar*); 721273d9f13SBarry Smith 722273d9f13SBarry Smith EXTERN int MatMPIBAIJSetPreallocation(Mat,int,int,int*,int,int*); 723273d9f13SBarry Smith EXTERN int MatMPISBAIJSetPreallocation(Mat,int,int,int*,int,int*); 724273d9f13SBarry Smith EXTERN int MatMPIAIJSetPreallocation(Mat,int,int*,int,int*); 72587828ca2SBarry Smith EXTERN int MatMPIDensePreallocation(Mat,PetscScalar*); 72687828ca2SBarry Smith EXTERN int MatMPIBDiagSetPreallocation(Mat,int,int,int*,PetscScalar**); 727273d9f13SBarry Smith EXTERN int MatMPIAdjSetPreallocation(Mat,int*,int*,int*); 72887828ca2SBarry Smith EXTERN int MatMPIDenseSetPreallocation(Mat,PetscScalar*); 729273d9f13SBarry Smith EXTERN int MatMPIRowbsSetPreallocation(Mat,int,int*); 730435da068SBarry Smith EXTERN int MatMPIAIJGetSeqAIJ(Mat,Mat*,Mat*,int**); 731435da068SBarry Smith EXTERN int MatMPIBAIJGetSeqBAIJ(Mat,Mat*,Mat*,int**); 7323a7fca6bSBarry Smith EXTERN int MatAdicSetLocalFunction(Mat,void (*)(void)); 733273d9f13SBarry Smith 7341b807ce4Svictorle EXTERN int MatSeqDenseSetLDA(Mat,int); 7351b807ce4Svictorle 736ca44d042SBarry Smith EXTERN int MatStoreValues(Mat); 737ca44d042SBarry Smith EXTERN int MatRetrieveValues(Mat); 7382e8a6d31SBarry Smith 7393a7fca6bSBarry Smith EXTERN int MatDAADSetCtx(Mat,void*); 7403a7fca6bSBarry Smith 7417b80b807SBarry Smith /* 7427b80b807SBarry Smith These routines are not usually accessed directly, rather solving is 7437b80b807SBarry Smith done through the SLES, KSP and PC interfaces. 7447b80b807SBarry Smith */ 7457b80b807SBarry Smith 746d9274352SBarry Smith /*E 747d9274352SBarry Smith MatOrderingType - String with the name of a PETSc matrix ordering or the creation function 748d9274352SBarry Smith with an optional dynamic library name, for example 749d9274352SBarry Smith http://www.mcs.anl.gov/petsc/lib.a:orderingcreate() 750d9274352SBarry Smith 751d9274352SBarry Smith Level: beginner 752d9274352SBarry Smith 753d9274352SBarry Smith .seealso: MatGetOrdering() 754d9274352SBarry Smith E*/ 755b12f92e5SBarry Smith typedef char* MatOrderingType; 756b12f92e5SBarry Smith #define MATORDERING_NATURAL "natural" 757b12f92e5SBarry Smith #define MATORDERING_ND "nd" 758b12f92e5SBarry Smith #define MATORDERING_1WD "1wd" 759b12f92e5SBarry Smith #define MATORDERING_RCM "rcm" 760b12f92e5SBarry Smith #define MATORDERING_QMD "qmd" 761b12f92e5SBarry Smith #define MATORDERING_ROWLENGTH "rowlength" 76262152c8bSBarry Smith #define MATORDERING_DSC_ND "dsc_nd" 76362152c8bSBarry Smith #define MATORDERING_DSC_MMD "dsc_mmd" 76462152c8bSBarry Smith #define MATORDERING_DSC_MDF "dsc_mdf" 765c06d978dSMatthew Knepley #define MATORDERING_CONSTRAINED "constrained" 766c06d978dSMatthew Knepley #define MATORDERING_IDENTITY "identity" 767c06d978dSMatthew Knepley #define MATORDERING_REVERSE "reverse" 768b12f92e5SBarry Smith 769ca44d042SBarry Smith EXTERN int MatGetOrdering(Mat,MatOrderingType,IS*,IS*); 770ca44d042SBarry Smith EXTERN int MatOrderingRegister(char*,char*,char*,int(*)(Mat,MatOrderingType,IS*,IS*)); 771*30de9b25SBarry Smith 772*30de9b25SBarry Smith /*MC 773*30de9b25SBarry Smith MatOrderingRegisterDynamic - Adds a new sparse matrix ordering to the 774*30de9b25SBarry Smith matrix package. 775*30de9b25SBarry Smith 776*30de9b25SBarry Smith Synopsis: 777*30de9b25SBarry Smith int MatOrderingRegisterDynamic(char *name_ordering,char *path,char *name_create,int (*routine_create)(MatOrdering)) 778*30de9b25SBarry Smith 779*30de9b25SBarry Smith Not Collective 780*30de9b25SBarry Smith 781*30de9b25SBarry Smith Input Parameters: 782*30de9b25SBarry Smith + sname - name of ordering (for example MATORDERING_ND) 783*30de9b25SBarry Smith . path - location of library where creation routine is 784*30de9b25SBarry Smith . name - name of function that creates the ordering type,a string 785*30de9b25SBarry Smith - function - function pointer that creates the ordering 786*30de9b25SBarry Smith 787*30de9b25SBarry Smith Level: developer 788*30de9b25SBarry Smith 789*30de9b25SBarry Smith If dynamic libraries are used, then the fourth input argument (function) 790*30de9b25SBarry Smith is ignored. 791*30de9b25SBarry Smith 792*30de9b25SBarry Smith Sample usage: 793*30de9b25SBarry Smith .vb 794*30de9b25SBarry Smith MatOrderingRegisterDynamic("my_order",/home/username/my_lib/lib/libO/solaris/mylib.a, 795*30de9b25SBarry Smith "MyOrder",MyOrder); 796*30de9b25SBarry Smith .ve 797*30de9b25SBarry Smith 798*30de9b25SBarry Smith Then, your partitioner can be chosen with the procedural interface via 799*30de9b25SBarry Smith $ MatOrderingSetType(part,"my_order) 800*30de9b25SBarry Smith or at runtime via the option 801*30de9b25SBarry Smith $ -pc_ilu_mat_ordering_type my_order 802*30de9b25SBarry Smith $ -pc_lu_mat_ordering_type my_order 803*30de9b25SBarry Smith 804*30de9b25SBarry Smith ${PETSC_ARCH} and ${BOPT} occuring in pathname will be replaced with appropriate values. 805*30de9b25SBarry Smith 806*30de9b25SBarry Smith .keywords: matrix, ordering, register 807*30de9b25SBarry Smith 808*30de9b25SBarry Smith .seealso: MatOrderingRegisterDestroy(), MatOrderingRegisterAll() 809*30de9b25SBarry Smith M*/ 810aa482453SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 811f1af5d2fSBarry Smith #define MatOrderingRegisterDynamic(a,b,c,d) MatOrderingRegister(a,b,c,0) 812b12f92e5SBarry Smith #else 813f1af5d2fSBarry Smith #define MatOrderingRegisterDynamic(a,b,c,d) MatOrderingRegister(a,b,c,d) 814b12f92e5SBarry Smith #endif 815*30de9b25SBarry Smith 816ca44d042SBarry Smith EXTERN int MatOrderingRegisterDestroy(void); 817ca44d042SBarry Smith EXTERN int MatOrderingRegisterAll(char*); 8182bad1931SBarry Smith extern PetscTruth MatOrderingRegisterAllCalled; 819b0a32e0cSBarry Smith extern PetscFList MatOrderingList; 820d4fbbf0eSBarry Smith 82187828ca2SBarry Smith EXTERN int MatReorderForNonzeroDiagonal(Mat,PetscReal,IS,IS); 822a2ce50c7SBarry Smith 823d91e6319SBarry Smith /*S 82415e8a5b3SHong Zhang MatFactorInfo - Data based into the matrix factorization routines 825b00f7748SHong Zhang 82615e8a5b3SHong Zhang In Fortran these are simply double precision arrays of size MAT_FACTORINFO_SIZE 827b00f7748SHong Zhang 82815e8a5b3SHong Zhang Notes: These are not usually directly used by users, instead use PC type of LU, ILU, CHOLESKY or ICC. 829b00f7748SHong Zhang 830b00f7748SHong Zhang Level: developer 831b00f7748SHong Zhang 832b380c88cSHong Zhang .seealso: MatLUFactorSymbolic(), MatILUFactorSymbolic(), MatCholeskyFactorSymbolic(), MatICCFactorSymbolic(), MatICCFactor() 833b00f7748SHong Zhang 834b00f7748SHong Zhang S*/ 835b00f7748SHong Zhang typedef struct { 83615e8a5b3SHong Zhang PetscReal damping; /* scaling of identity added to matrix to prevent zero pivots */ 8372cea7109SBarry Smith PetscReal shift; /* if true, shift until positive pivots */ 8382cea7109SBarry Smith PetscReal shift_fraction; /* record shift fraction taken */ 83915e8a5b3SHong Zhang PetscReal diagonal_fill; /* force diagonal to fill in if initially not filled */ 84015e8a5b3SHong Zhang PetscReal dt; /* drop tolerance */ 841b00f7748SHong Zhang PetscReal dtcol; /* tolerance for pivoting */ 84215e8a5b3SHong Zhang PetscReal dtcount; /* maximum nonzeros to be allowed per row */ 843f6275e2eSBarry Smith PetscReal fill; /* expected fill; nonzeros in factored matrix/nonzeros in original matrix*/ 844348344bbSBarry Smith PetscReal levels; /* ICC/ILU(levels) */ 845bcd9e38bSBarry Smith PetscReal pivotinblocks; /* for BAIJ and SBAIJ matrices pivot in factorization on blocks, default 1.0 846bcd9e38bSBarry Smith factorization may be faster if do not pivot */ 84715e8a5b3SHong Zhang PetscReal zeropivot; /* pivot is called zero if less than this */ 84815e8a5b3SHong Zhang } MatFactorInfo; 849ffa6d0a5SLois Curfman McInnes 85015e8a5b3SHong Zhang EXTERN int MatCholeskyFactor(Mat,IS,MatFactorInfo*); 85115e8a5b3SHong Zhang EXTERN int MatCholeskyFactorSymbolic(Mat,IS,MatFactorInfo*,Mat*); 85215e8a5b3SHong Zhang EXTERN int MatCholeskyFactorNumeric(Mat,Mat*); 853b380c88cSHong Zhang EXTERN int MatLUFactor(Mat,IS,IS,MatFactorInfo*); 854b380c88cSHong Zhang EXTERN int MatILUFactor(Mat,IS,IS,MatFactorInfo*); 855b380c88cSHong Zhang EXTERN int MatLUFactorSymbolic(Mat,IS,IS,MatFactorInfo*,Mat*); 856b380c88cSHong Zhang EXTERN int MatILUFactorSymbolic(Mat,IS,IS,MatFactorInfo*,Mat*); 85715e8a5b3SHong Zhang EXTERN int MatICCFactorSymbolic(Mat,IS,MatFactorInfo*,Mat*); 85815e8a5b3SHong Zhang EXTERN int MatICCFactor(Mat,IS,MatFactorInfo*); 859ca44d042SBarry Smith EXTERN int MatLUFactorNumeric(Mat,Mat*); 860b380c88cSHong Zhang EXTERN int MatILUDTFactor(Mat,MatFactorInfo*,IS,IS,Mat *); 8613e0d88b5SBarry Smith EXTERN int MatGetInertia(Mat,int*,int*,int*); 862ca44d042SBarry Smith EXTERN int MatSolve(Mat,Vec,Vec); 863ca44d042SBarry Smith EXTERN int MatForwardSolve(Mat,Vec,Vec); 864ca44d042SBarry Smith EXTERN int MatBackwardSolve(Mat,Vec,Vec); 865ca44d042SBarry Smith EXTERN int MatSolveAdd(Mat,Vec,Vec,Vec); 866ca44d042SBarry Smith EXTERN int MatSolveTranspose(Mat,Vec,Vec); 867ca44d042SBarry Smith EXTERN int MatSolveTransposeAdd(Mat,Vec,Vec,Vec); 868d59c15a7SBarry Smith EXTERN int MatSolves(Mat,Vecs,Vecs); 8698ed539a5SBarry Smith 870ca44d042SBarry Smith EXTERN int MatSetUnfactored(Mat); 871bb5a7306SBarry Smith 872bb1eb677SSatish Balay /* MatSORType may be bitwise ORd together, so do not change the numbers */ 873d91e6319SBarry Smith /*E 874d91e6319SBarry Smith MatSORType - What type of (S)SOR to perform 875bb1eb677SSatish Balay 876d91e6319SBarry Smith Level: beginner 877d91e6319SBarry Smith 878d9274352SBarry Smith May be bitwise ORd together 879d9274352SBarry Smith 880d91e6319SBarry Smith Any additions/changes here MUST also be made in include/finclude/petscmat.h 881d91e6319SBarry Smith 882d91e6319SBarry Smith .seealso: MatRelax() 883d91e6319SBarry Smith E*/ 884ee50ffe9SBarry Smith typedef enum {SOR_FORWARD_SWEEP=1,SOR_BACKWARD_SWEEP=2,SOR_SYMMETRIC_SWEEP=3, 885ee50ffe9SBarry Smith SOR_LOCAL_FORWARD_SWEEP=4,SOR_LOCAL_BACKWARD_SWEEP=8, 886ee50ffe9SBarry Smith SOR_LOCAL_SYMMETRIC_SWEEP=12,SOR_ZERO_INITIAL_GUESS=16, 88784cb2905SBarry Smith SOR_EISENSTAT=32,SOR_APPLY_UPPER=64,SOR_APPLY_LOWER=128} MatSORType; 888c14dc6b6SHong Zhang EXTERN int MatRelax(Mat,Vec,PetscReal,MatSORType,PetscReal,int,int,Vec); 8898ed539a5SBarry Smith 890d4fbbf0eSBarry Smith /* 891639f9d9dSBarry Smith These routines are for efficiently computing Jacobians via finite differences. 892639f9d9dSBarry Smith */ 893b12f92e5SBarry Smith 894d9274352SBarry Smith /*E 895d9274352SBarry Smith MatColoringType - String with the name of a PETSc matrix coloring or the creation function 896d9274352SBarry Smith with an optional dynamic library name, for example 897d9274352SBarry Smith http://www.mcs.anl.gov/petsc/lib.a:coloringcreate() 898d9274352SBarry Smith 899d9274352SBarry Smith Level: beginner 900d9274352SBarry Smith 901d9274352SBarry Smith .seealso: MatGetColoring() 902d9274352SBarry Smith E*/ 903b12f92e5SBarry Smith typedef char* MatColoringType; 904b12f92e5SBarry Smith #define MATCOLORING_NATURAL "natural" 905b12f92e5SBarry Smith #define MATCOLORING_SL "sl" 906b12f92e5SBarry Smith #define MATCOLORING_LF "lf" 907b12f92e5SBarry Smith #define MATCOLORING_ID "id" 908b12f92e5SBarry Smith 909ca44d042SBarry Smith EXTERN int MatGetColoring(Mat,MatColoringType,ISColoring*); 910ca44d042SBarry Smith EXTERN int MatColoringRegister(char*,char*,char*,int(*)(Mat,MatColoringType,ISColoring *)); 911*30de9b25SBarry Smith 912*30de9b25SBarry Smith /*MC 913*30de9b25SBarry Smith MatColoringRegisterDynamic - Adds a new sparse matrix coloring to the 914*30de9b25SBarry Smith matrix package. 915*30de9b25SBarry Smith 916*30de9b25SBarry Smith Synopsis: 917*30de9b25SBarry Smith int MatColoringRegisterDynamic(char *name_coloring,char *path,char *name_create,int (*routine_create)(MatColoring)) 918*30de9b25SBarry Smith 919*30de9b25SBarry Smith Not Collective 920*30de9b25SBarry Smith 921*30de9b25SBarry Smith Input Parameters: 922*30de9b25SBarry Smith + sname - name of Coloring (for example MATCOLORING_SL) 923*30de9b25SBarry Smith . path - location of library where creation routine is 924*30de9b25SBarry Smith . name - name of function that creates the Coloring type, a string 925*30de9b25SBarry Smith - function - function pointer that creates the coloring 926*30de9b25SBarry Smith 927*30de9b25SBarry Smith Level: developer 928*30de9b25SBarry Smith 929*30de9b25SBarry Smith If dynamic libraries are used, then the fourth input argument (function) 930*30de9b25SBarry Smith is ignored. 931*30de9b25SBarry Smith 932*30de9b25SBarry Smith Sample usage: 933*30de9b25SBarry Smith .vb 934*30de9b25SBarry Smith MatColoringRegisterDynamic("my_color",/home/username/my_lib/lib/libO/solaris/mylib.a, 935*30de9b25SBarry Smith "MyColor",MyColor); 936*30de9b25SBarry Smith .ve 937*30de9b25SBarry Smith 938*30de9b25SBarry Smith Then, your partitioner can be chosen with the procedural interface via 939*30de9b25SBarry Smith $ MatColoringSetType(part,"my_color") 940*30de9b25SBarry Smith or at runtime via the option 941*30de9b25SBarry Smith $ -mat_coloring_type my_color 942*30de9b25SBarry Smith 943*30de9b25SBarry Smith $PETSC_ARCH and $BOPT occuring in pathname will be replaced with appropriate values. 944*30de9b25SBarry Smith 945*30de9b25SBarry Smith .keywords: matrix, Coloring, register 946*30de9b25SBarry Smith 947*30de9b25SBarry Smith .seealso: MatColoringRegisterDestroy(), MatColoringRegisterAll() 948*30de9b25SBarry Smith M*/ 949aa482453SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 950f1af5d2fSBarry Smith #define MatColoringRegisterDynamic(a,b,c,d) MatColoringRegister(a,b,c,0) 951b12f92e5SBarry Smith #else 952f1af5d2fSBarry Smith #define MatColoringRegisterDynamic(a,b,c,d) MatColoringRegister(a,b,c,d) 953b12f92e5SBarry Smith #endif 954*30de9b25SBarry Smith 955ca44d042SBarry Smith EXTERN int MatColoringRegisterAll(char *); 9562bad1931SBarry Smith extern PetscTruth MatColoringRegisterAllCalled; 957ca44d042SBarry Smith EXTERN int MatColoringRegisterDestroy(void); 95808b6dcc0SBarry Smith EXTERN int MatColoringPatch(Mat,int,int,ISColoringValue *,ISColoring*); 959639f9d9dSBarry Smith 960d9274352SBarry Smith /*S 961d9274352SBarry Smith MatFDColoring - Object for computing a sparse Jacobian via finite differences 962d9274352SBarry Smith and coloring 963639f9d9dSBarry Smith 964d9274352SBarry Smith Level: beginner 965d9274352SBarry Smith 966d9274352SBarry Smith Concepts: coloring, sparse Jacobian, finite differences 967d9274352SBarry Smith 968d9274352SBarry Smith .seealso: MatFDColoringCreate() 969d9274352SBarry Smith S*/ 970e2a1c21fSSatish Balay typedef struct _p_MatFDColoring *MatFDColoring; 971639f9d9dSBarry Smith 972ca44d042SBarry Smith EXTERN int MatFDColoringCreate(Mat,ISColoring,MatFDColoring *); 973ca44d042SBarry Smith EXTERN int MatFDColoringDestroy(MatFDColoring); 974b0a32e0cSBarry Smith EXTERN int MatFDColoringView(MatFDColoring,PetscViewer); 975ca44d042SBarry Smith EXTERN int MatFDColoringSetFunction(MatFDColoring,int (*)(void),void*); 97687828ca2SBarry Smith EXTERN int MatFDColoringSetParameters(MatFDColoring,PetscReal,PetscReal); 977ca44d042SBarry Smith EXTERN int MatFDColoringSetFrequency(MatFDColoring,int); 978ca44d042SBarry Smith EXTERN int MatFDColoringGetFrequency(MatFDColoring,int*); 979ca44d042SBarry Smith EXTERN int MatFDColoringSetFromOptions(MatFDColoring); 980ca44d042SBarry Smith EXTERN int MatFDColoringApply(Mat,MatFDColoring,Vec,MatStructure*,void *); 98187828ca2SBarry Smith EXTERN int MatFDColoringApplyTS(Mat,MatFDColoring,PetscReal,Vec,MatStructure*,void *); 98262152c8bSBarry Smith EXTERN int MatFDColoringSetRecompute(MatFDColoring); 9833a7fca6bSBarry Smith EXTERN int MatFDColoringSetF(MatFDColoring,Vec); 98449b058dcSBarry Smith EXTERN int MatFDColoringGetPerturbedColumns(MatFDColoring,int*,int**); 985639f9d9dSBarry Smith /* 9860752156aSBarry Smith These routines are for partitioning matrices: currently used only 9873eda8832SBarry Smith for adjacency matrix, MatCreateMPIAdj(). 9880752156aSBarry Smith */ 989ca161407SBarry Smith 990d9274352SBarry Smith /*S 991d9274352SBarry Smith MatPartitioning - Object for managing the partitioning of a matrix or graph 992d9274352SBarry Smith 993d9274352SBarry Smith Level: beginner 994d9274352SBarry Smith 995d9274352SBarry Smith Concepts: partitioning 996d9274352SBarry Smith 997743a1026Svictorle .seealso: MatPartitioningCreate(), MatPartitioningType 998d9274352SBarry Smith S*/ 99991e9ee9fSBarry Smith typedef struct _p_MatPartitioning *MatPartitioning; 1000d9274352SBarry Smith 1001d9274352SBarry Smith /*E 10025bc6e7ccSvictorle MatPartitioningType - String with the name of a PETSc matrix partitioning or the creation function 1003d9274352SBarry Smith with an optional dynamic library name, for example 1004d9274352SBarry Smith http://www.mcs.anl.gov/petsc/lib.a:partitioningcreate() 1005d9274352SBarry Smith 1006d9274352SBarry Smith Level: beginner 1007d9274352SBarry Smith 1008b547a13bSvictorle .seealso: MatPartitioningCreate(), MatPartitioning 1009d9274352SBarry Smith E*/ 10102aabb6bbSBarry Smith typedef char* MatPartitioningType; 10118ba1e511SMatthew Knepley #define MAT_PARTITIONING_CURRENT "current" 10128ba1e511SMatthew Knepley #define MAT_PARTITIONING_PARMETIS "parmetis" 1013ca161407SBarry Smith 1014ca44d042SBarry Smith EXTERN int MatPartitioningCreate(MPI_Comm,MatPartitioning*); 1015ca44d042SBarry Smith EXTERN int MatPartitioningSetType(MatPartitioning,MatPartitioningType); 10165bc6e7ccSvictorle EXTERN int MatPartitioningSetNParts(MatPartitioning,int); 1017ca44d042SBarry Smith EXTERN int MatPartitioningSetAdjacency(MatPartitioning,Mat); 1018ca44d042SBarry Smith EXTERN int MatPartitioningSetVertexWeights(MatPartitioning,int*); 1019ca44d042SBarry Smith EXTERN int MatPartitioningApply(MatPartitioning,IS*); 1020ca44d042SBarry Smith EXTERN int MatPartitioningDestroy(MatPartitioning); 10212aabb6bbSBarry Smith 1022ca44d042SBarry Smith EXTERN int MatPartitioningRegister(char*,char*,char*,int(*)(MatPartitioning)); 1023*30de9b25SBarry Smith 1024*30de9b25SBarry Smith /*MC 1025*30de9b25SBarry Smith MatPartitioningRegisterDynamic - Adds a new sparse matrix partitioning to the 1026*30de9b25SBarry Smith matrix package. 1027*30de9b25SBarry Smith 1028*30de9b25SBarry Smith Synopsis: 1029*30de9b25SBarry Smith int MatPartitioningRegisterDynamic(char *name_partitioning,char *path,char *name_create,int (*routine_create)(MatPartitioning)) 1030*30de9b25SBarry Smith 1031*30de9b25SBarry Smith Not Collective 1032*30de9b25SBarry Smith 1033*30de9b25SBarry Smith Input Parameters: 1034*30de9b25SBarry Smith + sname - name of partitioning (for example MAT_PARTITIONING_CURRENT) or parmetis 1035*30de9b25SBarry Smith . path - location of library where creation routine is 1036*30de9b25SBarry Smith . name - name of function that creates the partitioning type, a string 1037*30de9b25SBarry Smith - function - function pointer that creates the partitioning type 1038*30de9b25SBarry Smith 1039*30de9b25SBarry Smith Level: developer 1040*30de9b25SBarry Smith 1041*30de9b25SBarry Smith If dynamic libraries are used, then the fourth input argument (function) 1042*30de9b25SBarry Smith is ignored. 1043*30de9b25SBarry Smith 1044*30de9b25SBarry Smith Sample usage: 1045*30de9b25SBarry Smith .vb 1046*30de9b25SBarry Smith MatPartitioningRegisterDynamic("my_part",/home/username/my_lib/lib/libO/solaris/mylib.a, 1047*30de9b25SBarry Smith "MyPartCreate",MyPartCreate); 1048*30de9b25SBarry Smith .ve 1049*30de9b25SBarry Smith 1050*30de9b25SBarry Smith Then, your partitioner can be chosen with the procedural interface via 1051*30de9b25SBarry Smith $ MatPartitioningSetType(part,"my_part") 1052*30de9b25SBarry Smith or at runtime via the option 1053*30de9b25SBarry Smith $ -mat_partitioning_type my_part 1054*30de9b25SBarry Smith 1055*30de9b25SBarry Smith $PETSC_ARCH and $BOPT occuring in pathname will be replaced with appropriate values. 1056*30de9b25SBarry Smith 1057*30de9b25SBarry Smith .keywords: matrix, partitioning, register 1058*30de9b25SBarry Smith 1059*30de9b25SBarry Smith .seealso: MatPartitioningRegisterDestroy(), MatPartitioningRegisterAll() 1060*30de9b25SBarry Smith M*/ 1061aa482453SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 1062f1af5d2fSBarry Smith #define MatPartitioningRegisterDynamic(a,b,c,d) MatPartitioningRegister(a,b,c,0) 10632aabb6bbSBarry Smith #else 1064f1af5d2fSBarry Smith #define MatPartitioningRegisterDynamic(a,b,c,d) MatPartitioningRegister(a,b,c,d) 10652aabb6bbSBarry Smith #endif 10662aabb6bbSBarry Smith 1067ca44d042SBarry Smith EXTERN int MatPartitioningRegisterAll(char *); 10682bad1931SBarry Smith extern PetscTruth MatPartitioningRegisterAllCalled; 1069ca44d042SBarry Smith EXTERN int MatPartitioningRegisterDestroy(void); 10702bad1931SBarry Smith 1071b0a32e0cSBarry Smith EXTERN int MatPartitioningView(MatPartitioning,PetscViewer); 1072ca44d042SBarry Smith EXTERN int MatPartitioningSetFromOptions(MatPartitioning); 1073ca44d042SBarry Smith EXTERN int MatPartitioningGetType(MatPartitioning,MatPartitioningType*); 1074ca161407SBarry Smith 1075ca44d042SBarry Smith EXTERN int MatPartitioningParmetisSetCoarseSequential(MatPartitioning); 10760752156aSBarry Smith 10770752156aSBarry Smith /* 10780a835dfdSSatish Balay If you add entries here you must also add them to finclude/petscmat.h 1079d4fbbf0eSBarry Smith */ 10801c1c02c0SLois Curfman McInnes typedef enum { MATOP_SET_VALUES=0, 10811c1c02c0SLois Curfman McInnes MATOP_GET_ROW=1, 10821c1c02c0SLois Curfman McInnes MATOP_RESTORE_ROW=2, 10831c1c02c0SLois Curfman McInnes MATOP_MULT=3, 10841c1c02c0SLois Curfman McInnes MATOP_MULT_ADD=4, 10857c922b88SBarry Smith MATOP_MULT_TRANSPOSE=5, 10867c922b88SBarry Smith MATOP_MULT_TRANSPOSE_ADD=6, 10871c1c02c0SLois Curfman McInnes MATOP_SOLVE=7, 10881c1c02c0SLois Curfman McInnes MATOP_SOLVE_ADD=8, 10897c922b88SBarry Smith MATOP_SOLVE_TRANSPOSE=9, 10907c922b88SBarry Smith MATOP_SOLVE_TRANSPOSE_ADD=10, 10911c1c02c0SLois Curfman McInnes MATOP_LUFACTOR=11, 10921c1c02c0SLois Curfman McInnes MATOP_CHOLESKYFACTOR=12, 10931c1c02c0SLois Curfman McInnes MATOP_RELAX=13, 10941c1c02c0SLois Curfman McInnes MATOP_TRANSPOSE=14, 10951c1c02c0SLois Curfman McInnes MATOP_GETINFO=15, 10961c1c02c0SLois Curfman McInnes MATOP_EQUAL=16, 10971c1c02c0SLois Curfman McInnes MATOP_GET_DIAGONAL=17, 10981c1c02c0SLois Curfman McInnes MATOP_DIAGONAL_SCALE=18, 10991c1c02c0SLois Curfman McInnes MATOP_NORM=19, 11001c1c02c0SLois Curfman McInnes MATOP_ASSEMBLY_BEGIN=20, 11011c1c02c0SLois Curfman McInnes MATOP_ASSEMBLY_END=21, 11021c1c02c0SLois Curfman McInnes MATOP_COMPRESS=22, 11031c1c02c0SLois Curfman McInnes MATOP_SET_OPTION=23, 11041c1c02c0SLois Curfman McInnes MATOP_ZERO_ENTRIES=24, 11051c1c02c0SLois Curfman McInnes MATOP_ZERO_ROWS=25, 11061c1c02c0SLois Curfman McInnes MATOP_LUFACTOR_SYMBOLIC=26, 11071c1c02c0SLois Curfman McInnes MATOP_LUFACTOR_NUMERIC=27, 11081c1c02c0SLois Curfman McInnes MATOP_CHOLESKY_FACTOR_SYMBOLIC=28, 11091c1c02c0SLois Curfman McInnes MATOP_CHOLESKY_FACTOR_NUMERIC=29, 1110d643ce63SMatthew Knepley MATOP_SETUP_PREALLOCATION=30, 1111d643ce63SMatthew Knepley MATOP_ILUFACTOR_SYMBOLIC=31, 1112d643ce63SMatthew Knepley MATOP_ICCFACTOR_SYMBOLIC=32, 1113d643ce63SMatthew Knepley MATOP_GET_ARRAY=33, 1114d643ce63SMatthew Knepley MATOP_RESTORE_ARRAY=34, 1115d643ce63SMatthew Knepley MATOP_DUPLCIATE=35, 1116d643ce63SMatthew Knepley MATOP_FORWARD_SOLVE=36, 1117d643ce63SMatthew Knepley MATOP_BACKWARD_SOLVE=37, 1118d643ce63SMatthew Knepley MATOP_ILUFACTOR=38, 1119d643ce63SMatthew Knepley MATOP_ICCFACTOR=39, 1120d643ce63SMatthew Knepley MATOP_AXPY=40, 1121d643ce63SMatthew Knepley MATOP_GET_SUBMATRICES=41, 1122d643ce63SMatthew Knepley MATOP_INCREASE_OVERLAP=42, 1123d643ce63SMatthew Knepley MATOP_GET_VALUES=43, 1124d643ce63SMatthew Knepley MATOP_COPY=44, 1125d643ce63SMatthew Knepley MATOP_PRINT_HELP=45, 1126d643ce63SMatthew Knepley MATOP_SCALE=46, 1127d643ce63SMatthew Knepley MATOP_SHIFT=47, 1128d643ce63SMatthew Knepley MATOP_DIAGONAL_SHIFT=48, 1129d643ce63SMatthew Knepley MATOP_ILUDT_FACTOR=49, 1130d643ce63SMatthew Knepley MATOP_GET_BLOCK_SIZE=50, 1131d643ce63SMatthew Knepley MATOP_GET_ROW_IJ=51, 1132d643ce63SMatthew Knepley MATOP_RESTORE_ROW_IJ=52, 1133d643ce63SMatthew Knepley MATOP_GET_COLUMN_IJ=53, 1134d643ce63SMatthew Knepley MATOP_RESTORE_COLUMN_IJ=54, 1135d643ce63SMatthew Knepley MATOP_FDCOLORING_CREATE=55, 1136d643ce63SMatthew Knepley MATOP_COLORING_PATCH=56, 1137d643ce63SMatthew Knepley MATOP_SET_UNFACTORED=57, 1138d643ce63SMatthew Knepley MATOP_PERMUTE=58, 1139d643ce63SMatthew Knepley MATOP_SET_VALUES_BLOCKED=59, 1140d643ce63SMatthew Knepley MATOP_GET_SUBMATRIX=60, 1141d643ce63SMatthew Knepley MATOP_DESTROY=61, 1142d643ce63SMatthew Knepley MATOP_VIEW=62, 1143d643ce63SMatthew Knepley MATOP_GET_MAPS=63, 1144d643ce63SMatthew Knepley MATOP_USE_SCALED_FORM=64, 1145d643ce63SMatthew Knepley MATOP_SCALE_SYSTEM=65, 1146d643ce63SMatthew Knepley MATOP_UNSCALE_SYSTEM=66, 1147d643ce63SMatthew Knepley MATOP_SET_LOCAL_TO_GLOBAL_MAPPING=67, 1148d643ce63SMatthew Knepley MATOP_SET_VALUES_LOCAL=68, 1149d643ce63SMatthew Knepley MATOP_ZERO_ROWS_LOCAL=69, 1150d643ce63SMatthew Knepley MATOP_GET_ROW_MAX=70, 1151d643ce63SMatthew Knepley MATOP_CONVERT=71, 1152d643ce63SMatthew Knepley MATOP_SET_COLORING=72, 1153d643ce63SMatthew Knepley MATOP_SET_VALUES_ADIC=73, 1154d643ce63SMatthew Knepley MATOP_SET_VALUES_ADIFOR=74, 1155d643ce63SMatthew Knepley MATOP_FD_COLORING_APPLY=75, 1156d643ce63SMatthew Knepley MATOP_SET_FROM_OPTIONS=76, 1157d643ce63SMatthew Knepley MATOP_MULT_CONSTRAINED=77, 1158d643ce63SMatthew Knepley MATOP_MULT_TRANSPOSE_CONSTRAINED=78, 1159d643ce63SMatthew Knepley MATOP_ILU_FACTOR_SYMBOLIC_CONSTRAINED=79, 1160d643ce63SMatthew Knepley MATOP_PERMUTE_SPARSIFY=80, 1161d643ce63SMatthew Knepley MATOP_MULT_MULTIPLE=81, 1162d643ce63SMatthew Knepley MATOP_SOLVE_MULTIPLE=82 1163fae171e0SBarry Smith } MatOperation; 1164ca44d042SBarry Smith EXTERN int MatHasOperation(Mat,MatOperation,PetscTruth*); 1165ff8b7a98SSatish Balay EXTERN int MatShellSetOperation(Mat,MatOperation,void(*)(void)); 1166ff8b7a98SSatish Balay EXTERN int MatShellGetOperation(Mat,MatOperation,void(**)(void)); 1167273d9f13SBarry Smith EXTERN int MatShellSetContext(Mat,void*); 1168112a2221SBarry Smith 116990ace30eSBarry Smith /* 117090ace30eSBarry Smith Codes for matrices stored on disk. By default they are 117190ace30eSBarry Smith stored in a universal format. By changing the format with 1172fb9695e5SSatish Balay PetscViewerSetFormat(viewer,PETSC_VIEWER_BINARY_NATIVE); the matrices will 117390ace30eSBarry Smith be stored in a way natural for the matrix, for example dense matrices 117490ace30eSBarry Smith would be stored as dense. Matrices stored this way may only be 117590ace30eSBarry Smith read into matrices of the same time. 117690ace30eSBarry Smith */ 117790ace30eSBarry Smith #define MATRIX_BINARY_FORMAT_DENSE -1 117890ace30eSBarry Smith 11793f1d51d7SBarry Smith /* 11803f1d51d7SBarry Smith New matrix classes not yet distributed 11813f1d51d7SBarry Smith */ 11823f1d51d7SBarry Smith /* 11833f1d51d7SBarry Smith MatAIJIndices is a data structure for storing the nonzero location information 11843f1d51d7SBarry Smith for sparse matrices. Several matrices with identical nonzero structure can share 11853f1d51d7SBarry Smith the same MatAIJIndices. 11863f1d51d7SBarry Smith */ 1187e2a1c21fSSatish Balay typedef struct _p_MatAIJIndices* MatAIJIndices; 11883f1d51d7SBarry Smith 1189ca44d042SBarry Smith EXTERN int MatCreateAIJIndices(int,int,int*,int*,PetscTruth,MatAIJIndices*); 1190ca44d042SBarry Smith EXTERN int MatCreateAIJIndicesEmpty(int,int,int*,PetscTruth,MatAIJIndices*); 1191ca44d042SBarry Smith EXTERN int MatAttachAIJIndices(MatAIJIndices,MatAIJIndices*); 1192ca44d042SBarry Smith EXTERN int MatDestroyAIJIndices(MatAIJIndices); 1193ca44d042SBarry Smith EXTERN int MatCopyAIJIndices(MatAIJIndices,MatAIJIndices*); 1194ca44d042SBarry Smith EXTERN int MatValidateAIJIndices(int,MatAIJIndices); 1195ca44d042SBarry Smith EXTERN int MatShiftAIJIndices(MatAIJIndices); 1196ca44d042SBarry Smith EXTERN int MatShrinkAIJIndices(MatAIJIndices); 1197ca44d042SBarry Smith EXTERN int MatTransposeAIJIndices(MatAIJIndices,MatAIJIndices*); 11983f1d51d7SBarry Smith 1199ca44d042SBarry Smith EXTERN int MatCreateSeqCSN(MPI_Comm,int,int,int*,int,Mat*); 1200ca44d042SBarry Smith EXTERN int MatCreateSeqCSN_Single(MPI_Comm,int,int,int*,int,Mat*); 120187828ca2SBarry Smith EXTERN int MatCreateSeqCSNWithPrecision(MPI_Comm,int,int,int*,int,PetscScalarPrecision,Mat*); 12023f1d51d7SBarry Smith 1203ca44d042SBarry Smith EXTERN int MatCreateSeqCSNIndices(MPI_Comm,MatAIJIndices,int,Mat *); 1204ca44d042SBarry Smith EXTERN int MatCreateSeqCSNIndices_Single(MPI_Comm,MatAIJIndices,int,Mat *); 120587828ca2SBarry Smith EXTERN int MatCreateSeqCSNIndicesWithPrecision(MPI_Comm,MatAIJIndices,int,PetscScalarPrecision,Mat *); 12063f1d51d7SBarry Smith 12076d053be9SSatish Balay EXTERN int MatMPIBAIJSetHashTableFactor(Mat,PetscReal); 1208ca44d042SBarry Smith EXTERN int MatSeqAIJGetInodeSizes(Mat,int *,int *[],int *); 120908918a0eSSatish Balay EXTERN int MatMPIRowbsGetColor(Mat,ISColoring *); 1210860d1616SSatish Balay 1211d9274352SBarry Smith /*S 1212d9274352SBarry Smith MatNullSpace - Object that removes a null space from a vector, i.e. 1213d9274352SBarry Smith orthogonalizes the vector to a subsapce 1214d9274352SBarry Smith 1215f7a9e4ceSBarry Smith Level: advanced 1216d9274352SBarry Smith 1217d9274352SBarry Smith Concepts: matrix; linear operator, null space 1218d9274352SBarry Smith 12196e1639daSBarry Smith Users manual sections: 12206e1639daSBarry Smith . sec_singular 12216e1639daSBarry Smith 1222d9274352SBarry Smith .seealso: MatNullSpaceCreate() 1223d9274352SBarry Smith S*/ 122474637425SBarry Smith typedef struct _p_MatNullSpace* MatNullSpace; 1225d9274352SBarry Smith 122674637425SBarry Smith EXTERN int MatNullSpaceCreate(MPI_Comm,int,int,Vec *,MatNullSpace*); 122774637425SBarry Smith EXTERN int MatNullSpaceDestroy(MatNullSpace); 122874637425SBarry Smith EXTERN int MatNullSpaceRemove(MatNullSpace,Vec,Vec*); 122974637425SBarry Smith EXTERN int MatNullSpaceAttach(Mat,MatNullSpace); 123074637425SBarry Smith EXTERN int MatNullSpaceTest(MatNullSpace,Mat); 123174637425SBarry Smith 1232273d9f13SBarry Smith EXTERN int MatReorderingSeqSBAIJ(Mat A,IS isp); 1233273d9f13SBarry Smith EXTERN int MatMPISBAIJSetHashTableFactor(Mat,PetscReal); 1234273d9f13SBarry Smith EXTERN int MatSeqSBAIJSetColumnIndices(Mat,int *); 1235273d9f13SBarry Smith 12365c66b693SKris Buschelman EXTERN int MatMatMult(Mat A,Mat B, Mat *C); 12375c66b693SKris Buschelman EXTERN int MatMatMultSymbolic(Mat A,Mat B,Mat *C); 12385c66b693SKris Buschelman EXTERN int MatMatMultNumeric(Mat A,Mat B,Mat C); 12393f1d51d7SBarry Smith 1240f069c275SSatish Balay EXTERN int MatCreateMAIJ(Mat,int,Mat*); 1241c4f061fbSSatish Balay EXTERN int MatMAIJRedimension(Mat,int,Mat*); 1242c4f061fbSSatish Balay EXTERN int MatMAIJGetAIJ(Mat,Mat*); 1243c4f061fbSSatish Balay 1244273d9f13SBarry Smith EXTERN int MatMPIAdjSetValues(Mat,int*,int*,int*); 1245f069c275SSatish Balay 1246b0a32e0cSBarry Smith EXTERN int MatComputeExplicitOperator(Mat,Mat*); 1247b0a32e0cSBarry Smith 124824a595ddSBarry Smith EXTERN int MatESISetType(Mat,char*); 124924a595ddSBarry Smith EXTERN int MatESISetFromOptions(Mat); 125024a595ddSBarry Smith 12512cd6534aSBarry Smith EXTERN int MatDiagonalScaleLocal(Mat,Vec); 125204f1ad80SBarry Smith 12537dbadf16SMatthew Knepley EXTERN int PetscViewerMathematicaPutMatrix(PetscViewer, int, int, PetscReal *); 12547dbadf16SMatthew Knepley EXTERN int PetscViewerMathematicaPutCSRMatrix(PetscViewer, int, int, int *, int *, PetscReal *); 12557dbadf16SMatthew Knepley 1256e82a3eeeSBarry Smith EXTERN int MatUseSpooles_SeqAIJ(Mat); 1257e82a3eeeSBarry Smith EXTERN int MatUseUMFPACK_SeqAIJ(Mat); 1258e82a3eeeSBarry Smith EXTERN int MatUseSuperLU_SeqAIJ(Mat); 1259e82a3eeeSBarry Smith EXTERN int MatUseEssl_SeqAIJ(Mat); 1260e82a3eeeSBarry Smith EXTERN int MatUseLUSOL_SeqAIJ(Mat); 1261e82a3eeeSBarry Smith EXTERN int MatUseMatlab_SeqAIJ(Mat); 1262e82a3eeeSBarry Smith EXTERN int MatUseDXML_SeqAIJ(Mat); 12630889b5dcSvictorle EXTERN int MatUsePETSc_SeqAIJ(Mat); 1264e82a3eeeSBarry Smith EXTERN int MatUseSuperLU_DIST_MPIAIJ(Mat); 1265e82a3eeeSBarry Smith EXTERN int MatUseSpooles_MPIAIJ(Mat); 1266e82a3eeeSBarry Smith EXTERN int MatUseSpooles_SeqSBAIJ(Mat); 1267eee76cafSHong Zhang EXTERN int MatUseSpooles_MPISBAIJ(Mat); 1268eee76cafSHong Zhang EXTERN int MatUseMUMPS_MPIAIJ(Mat); 1269e82a3eeeSBarry Smith 12702eac72dbSBarry Smith #endif 12712eac72dbSBarry Smith 12722eac72dbSBarry Smith 12739d00d63dSBarry Smith 1274