12eac72dbSBarry Smith /* 22eac72dbSBarry Smith Include file for the matrix component of PETSc 32eac72dbSBarry Smith */ 40a835dfdSSatish Balay #ifndef __PETSCMAT_H 50a835dfdSSatish Balay #define __PETSCMAT_H 60a835dfdSSatish Balay #include "petscvec.h" 7e9fa29b7SSatish Balay PETSC_EXTERN_CXX_BEGIN 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" 32209238afSKris Buschelman #define MATMAIJ "maij" 33273d9f13SBarry Smith #define MATIS "is" 34273d9f13SBarry Smith #define MATMPIROWBS "mpirowbs" 35273d9f13SBarry Smith #define MATSEQAIJ "seqaij" 36273d9f13SBarry Smith #define MATMPIAIJ "mpiaij" 37209238afSKris Buschelman #define MATAIJ "aij" 38273d9f13SBarry Smith #define MATSHELL "shell" 39273d9f13SBarry Smith #define MATSEQBDIAG "seqbdiag" 40273d9f13SBarry Smith #define MATMPIBDIAG "mpibdiag" 41209238afSKris Buschelman #define MATBDIAG "bdiag" 42209238afSKris Buschelman #define MATSEQDENSE "seqdense" 43273d9f13SBarry Smith #define MATMPIDENSE "mpidense" 44209238afSKris Buschelman #define MATDENSE "dense" 45273d9f13SBarry Smith #define MATSEQBAIJ "seqbaij" 46273d9f13SBarry Smith #define MATMPIBAIJ "mpibaij" 47209238afSKris Buschelman #define MATBAIJ "baij" 48273d9f13SBarry Smith #define MATMPIADJ "mpiadj" 49273d9f13SBarry Smith #define MATSEQSBAIJ "seqsbaij" 50273d9f13SBarry Smith #define MATMPISBAIJ "mpisbaij" 51209238afSKris Buschelman #define MATSBAIJ "sbaij" 52cebc7f6cSBarry Smith #define MATDAAD "daad" 53cebc7f6cSBarry Smith #define MATMFFD "mffd" 54c8a8475eSBarry Smith #define MATNORMAL "normal" 55b3a1e11cSKris Buschelman #define MATSEQAIJSPOOLES "seqaijspooles" 56d10c748bSKris Buschelman #define MATMPIAIJSPOOLES "mpiaijspooles" 579abb65ffSKris Buschelman #define MATSEQSBAIJSPOOLES "seqsbaijspooles" 5822191285SKris Buschelman #define MATMPISBAIJSPOOLES "mpisbaijspooles" 59bb4d4166SHong Zhang #define MATAIJSPOOLES "aijspooles" 60bb4d4166SHong Zhang #define MATSBAIJSPOOLES "sbaijspooles" 6114b396bbSKris Buschelman #define MATSUPERLU "superlu" 621d96aa28SKris Buschelman #define MATSUPERLU_DIST "superlu_dist" 631677d0b8SKris Buschelman #define MATUMFPACK "umfpack" 64e8aa55a4SKris Buschelman #define MATESSL "essl" 654eb8e494SKris Buschelman #define MATLUSOL "lusol" 66397b6df1SKris Buschelman #define MATAIJMUMPS "aijmumps" 67397b6df1SKris Buschelman #define MATSBAIJMUMPS "sbaijmumps" 688da957c5SKris Buschelman #define MATDSCPACK "dscpack" 697065e2aaSKris Buschelman #define MATMATLAB "matlab" 7049773a63SBarry Smith #define MatType char* 71d91e6319SBarry Smith 72c06d978dSMatthew Knepley /* Logging support */ 73552e946dSBarry Smith #define MAT_FILE_COOKIE 1211216 /* used to indicate matrices in binary files */ 74be1d678aSKris Buschelman extern PetscCookie PETSCMAT_DLLEXPORT MAT_COOKIE; 75be1d678aSKris Buschelman extern PetscCookie PETSCMAT_DLLEXPORT MAT_FDCOLORING_COOKIE; 76be1d678aSKris Buschelman extern PetscCookie PETSCMAT_DLLEXPORT MAT_PARTITIONING_COOKIE; 77be1d678aSKris Buschelman extern PetscCookie PETSCMAT_DLLEXPORT MAT_NULLSPACE_COOKIE; 786849ba73SBarry Smith extern PetscEvent MAT_Mult, MAT_MultMatrixFree, MAT_Mults, MAT_MultConstrained, MAT_MultAdd, MAT_MultTranspose; 796849ba73SBarry Smith extern PetscEvent MAT_MultTransposeConstrained, MAT_MultTransposeAdd, MAT_Solve, MAT_Solves, MAT_SolveAdd, MAT_SolveTranspose; 806849ba73SBarry Smith extern PetscEvent MAT_SolveTransposeAdd, MAT_Relax, MAT_ForwardSolve, MAT_BackwardSolve, MAT_LUFactor, MAT_LUFactorSymbolic; 816849ba73SBarry Smith extern PetscEvent MAT_LUFactorNumeric, MAT_CholeskyFactor, MAT_CholeskyFactorSymbolic, MAT_CholeskyFactorNumeric, MAT_ILUFactor; 826849ba73SBarry Smith extern PetscEvent MAT_ILUFactorSymbolic, MAT_ICCFactorSymbolic, MAT_Copy, MAT_Convert, MAT_Scale, MAT_AssemblyBegin; 836849ba73SBarry Smith extern PetscEvent MAT_AssemblyEnd, MAT_SetValues, MAT_GetValues, MAT_GetRow, MAT_GetSubMatrices, MAT_GetColoring, MAT_GetOrdering; 846849ba73SBarry Smith extern PetscEvent MAT_IncreaseOverlap, MAT_Partitioning, MAT_ZeroEntries, MAT_Load, MAT_View, MAT_AXPY, MAT_FDColoringCreate; 856849ba73SBarry Smith extern PetscEvent MAT_FDColoringApply, MAT_Transpose, MAT_FDColoringFunction; 86cb00f407SKris Buschelman extern PetscEvent MAT_MatMult, MAT_MatMultSymbolic, MAT_MatMultNumeric; 87534c1384SKris Buschelman extern PetscEvent MAT_PtAP, MAT_PtAPSymbolic, MAT_PtAPNumeric; 88bc011b1eSHong Zhang extern PetscEvent MAT_MatMultTranspose, MAT_MatMultTransposeSymbolic, MAT_MatMultTransposeNumeric; 89c06d978dSMatthew Knepley 90ceb03754SKris Buschelman /*E 91ceb03754SKris Buschelman MatReuse - Indicates if matrices obtained from a previous call to MatGetSubMatrices() 92ceb03754SKris Buschelman or MatGetSubMatrix() are to be reused to store the new matrix values. 93ceb03754SKris Buschelman 94ceb03754SKris Buschelman Level: beginner 95ceb03754SKris Buschelman 96ceb03754SKris Buschelman Any additions/changes here MUST also be made in include/finclude/petscmat.h 97ceb03754SKris Buschelman 98ceb03754SKris Buschelman .seealso: MatGetSubMatrices(), MatGetSubMatrix(), MatDestroyMatrices() 99ceb03754SKris Buschelman E*/ 100ceb03754SKris Buschelman typedef enum {MAT_INITIAL_MATRIX,MAT_REUSE_MATRIX} MatReuse; 101ceb03754SKris Buschelman 102be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatInitializePackage(char *); 103c06d978dSMatthew Knepley 104be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreate(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,Mat*); 105be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetType(Mat,const MatType); 106be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetFromOptions(Mat); 107be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetUpPreallocation(Mat); 108be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatRegisterAll(const char[]); 109be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatRegister(const char[],const char[],const char[],PetscErrorCode(*)(Mat)); 11030de9b25SBarry Smith 11130de9b25SBarry Smith /*MC 11230de9b25SBarry Smith MatRegisterDynamic - Adds a new matrix type 11330de9b25SBarry Smith 11430de9b25SBarry Smith Synopsis: 115c1ac3661SBarry Smith PetscErrorCode MatRegisterDynamic(char *name,char *path,char *name_create,PetscErrorCode (*routine_create)(Mat)) 11630de9b25SBarry Smith 11730de9b25SBarry Smith Not Collective 11830de9b25SBarry Smith 11930de9b25SBarry Smith Input Parameters: 12030de9b25SBarry Smith + name - name of a new user-defined matrix type 12130de9b25SBarry Smith . path - path (either absolute or relative) the library containing this solver 12230de9b25SBarry Smith . name_create - name of routine to create method context 12330de9b25SBarry Smith - routine_create - routine to create method context 12430de9b25SBarry Smith 12530de9b25SBarry Smith Notes: 12630de9b25SBarry Smith MatRegisterDynamic() may be called multiple times to add several user-defined solvers. 12730de9b25SBarry Smith 12830de9b25SBarry Smith If dynamic libraries are used, then the fourth input argument (routine_create) 12930de9b25SBarry Smith is ignored. 13030de9b25SBarry Smith 13130de9b25SBarry Smith Sample usage: 13230de9b25SBarry Smith .vb 13330de9b25SBarry Smith MatRegisterDynamic("my_mat",/home/username/my_lib/lib/libO/solaris/mylib.a, 13430de9b25SBarry Smith "MyMatCreate",MyMatCreate); 13530de9b25SBarry Smith .ve 13630de9b25SBarry Smith 13730de9b25SBarry Smith Then, your solver can be chosen with the procedural interface via 13830de9b25SBarry Smith $ MatSetType(Mat,"my_mat") 13930de9b25SBarry Smith or at runtime via the option 14030de9b25SBarry Smith $ -mat_type my_mat 14130de9b25SBarry Smith 14230de9b25SBarry Smith Level: advanced 14330de9b25SBarry Smith 144ab901514SBarry Smith Notes: ${PETSC_ARCH} occuring in pathname will be replaced with appropriate values. 14530de9b25SBarry Smith If your function is not being put into a shared library then use VecRegister() instead 14630de9b25SBarry Smith 14730de9b25SBarry Smith .keywords: Mat, register 14830de9b25SBarry Smith 14930de9b25SBarry Smith .seealso: MatRegisterAll(), MatRegisterDestroy() 15030de9b25SBarry Smith 15130de9b25SBarry Smith M*/ 152273d9f13SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 153273d9f13SBarry Smith #define MatRegisterDynamic(a,b,c,d) MatRegister(a,b,c,0) 154273d9f13SBarry Smith #else 155273d9f13SBarry Smith #define MatRegisterDynamic(a,b,c,d) MatRegister(a,b,c,d) 15630de9b25SBarry Smith #endif 15730de9b25SBarry Smith 158273d9f13SBarry Smith extern PetscTruth MatRegisterAllCalled; 159b0a32e0cSBarry Smith extern PetscFList MatList; 16028988994SBarry Smith 161be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateSeqDense(MPI_Comm,PetscInt,PetscInt,PetscScalar[],Mat*); 162be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateMPIDense(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,PetscScalar[],Mat*); 163be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateSeqAIJ(MPI_Comm,PetscInt,PetscInt,PetscInt,const PetscInt[],Mat*); 164be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateMPIAIJ(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],PetscInt,const PetscInt[],Mat*); 165be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateMPIRowbs(MPI_Comm,PetscInt,PetscInt,PetscInt,const PetscInt[],Mat*); 166be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateSeqBDiag(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],PetscScalar*[],Mat*); 167be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateMPIBDiag(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],PetscScalar*[],Mat*); 168be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateSeqBAIJ(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],Mat*); 169be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateMPIBAIJ(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],PetscInt,const PetscInt[],Mat*); 170be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateMPIAdj(MPI_Comm,PetscInt,PetscInt,PetscInt[],PetscInt[],PetscInt[],Mat*); 171be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateSeqSBAIJ(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],Mat*); 172be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateMPISBAIJ(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,const PetscInt[],PetscInt,const PetscInt[],Mat*); 173be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateShell(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,void *,Mat*); 174be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateAdic(MPI_Comm,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,void (*)(void),Mat*); 175be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateNormal(Mat,Mat*); 176be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatDestroy(Mat); 17721c89e3eSBarry Smith 178be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPrintHelp(Mat); 179be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetPetscMaps(Mat,PetscMap*,PetscMap*); 180ec0117caSBarry Smith 1818ed539a5SBarry Smith /* ------------------------------------------------------------*/ 182be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetValues(Mat,PetscInt,const PetscInt[],PetscInt,const PetscInt[],const PetscScalar[],InsertMode); 183be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetValuesBlocked(Mat,PetscInt,const PetscInt[],PetscInt,const PetscInt[],const PetscScalar[],InsertMode); 18484cb2905SBarry Smith 1852ef4de8bSBarry Smith /*S 1862ef4de8bSBarry Smith MatStencil - Data structure (C struct) for storing information about a single row or 1872ef4de8bSBarry Smith column of a matrix as index on an associated grid. 1882ef4de8bSBarry Smith 1892ef4de8bSBarry Smith Level: beginner 1902ef4de8bSBarry Smith 1912ef4de8bSBarry Smith Concepts: matrix; linear operator 1922ef4de8bSBarry Smith 193d7bd93baSBarry Smith .seealso: MatSetValuesStencil(), MatSetStencil(), MatSetValuesBlockStencil() 1942ef4de8bSBarry Smith S*/ 195435da068SBarry Smith typedef struct { 196c1ac3661SBarry Smith PetscInt k,j,i,c; 197435da068SBarry Smith } MatStencil; 1982ef4de8bSBarry Smith 199be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetValuesStencil(Mat,PetscInt,const MatStencil[],PetscInt,const MatStencil[],const PetscScalar[],InsertMode); 200be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetValuesBlockedStencil(Mat,PetscInt,const MatStencil[],PetscInt,const MatStencil[],const PetscScalar[],InsertMode); 201be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetStencil(Mat,PetscInt,const PetscInt[],const PetscInt[],PetscInt); 202435da068SBarry Smith 203be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetColoring(Mat,ISColoring); 204be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetValuesAdic(Mat,void*); 205be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetValuesAdifor(Mat,PetscInt,void*); 2063a7fca6bSBarry Smith 207d91e6319SBarry Smith /*E 208d91e6319SBarry Smith MatAssemblyType - Indicates if the matrix is now to be used, or if you plan 209d91e6319SBarry Smith to continue to add values to it 210d91e6319SBarry Smith 211d91e6319SBarry Smith Level: beginner 212d91e6319SBarry Smith 213d91e6319SBarry Smith .seealso: MatAssemblyBegin(), MatAssemblyEnd() 214d91e6319SBarry Smith E*/ 2156d4a8577SBarry Smith typedef enum {MAT_FLUSH_ASSEMBLY=1,MAT_FINAL_ASSEMBLY=0} MatAssemblyType; 216be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatAssemblyBegin(Mat,MatAssemblyType); 217be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatAssemblyEnd(Mat,MatAssemblyType); 218be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatAssembled(Mat,PetscTruth*); 2194f9c727eSBarry Smith 220be1d678aSKris Buschelman extern PETSCMAT_DLLEXPORT PetscInt MatSetValue_Row; 221be1d678aSKris Buschelman extern PETSCMAT_DLLEXPORT PetscInt MatSetValue_Column; 222be1d678aSKris Buschelman extern PETSCMAT_DLLEXPORT PetscScalar MatSetValue_Value; 2231d73ed98SBarry Smith 22430de9b25SBarry Smith /*MC 22530de9b25SBarry Smith MatSetValue - Set a single entry into a matrix. 22630de9b25SBarry Smith 22730de9b25SBarry Smith Synopsis: 228c1ac3661SBarry Smith PetscErrorCode MatSetValue(Mat m,PetscInt row,PetscInt col,PetscScalar value,InsertMode mode); 22930de9b25SBarry Smith 23030de9b25SBarry Smith Not collective 23130de9b25SBarry Smith 23230de9b25SBarry Smith Input Parameters: 23330de9b25SBarry Smith + m - the matrix 23430de9b25SBarry Smith . row - the row location of the entry 23530de9b25SBarry Smith . col - the column location of the entry 23630de9b25SBarry Smith . value - the value to insert 23730de9b25SBarry Smith - mode - either INSERT_VALUES or ADD_VALUES 23830de9b25SBarry Smith 23930de9b25SBarry Smith Notes: 24030de9b25SBarry Smith For efficiency one should use MatSetValues() and set several or many 24130de9b25SBarry Smith values simultaneously if possible. 24230de9b25SBarry Smith 24330de9b25SBarry Smith Level: beginner 24430de9b25SBarry Smith 24530de9b25SBarry Smith .seealso: MatSetValues(), MatSetValueLocal() 24630de9b25SBarry Smith M*/ 247b951964fSBarry Smith #define MatSetValue(v,i,j,va,mode) \ 248f1144a30SSatish Balay ((MatSetValue_Row = i,MatSetValue_Column = j,MatSetValue_Value = va,0) || \ 2491d73ed98SBarry Smith MatSetValues(v,1,&MatSetValue_Row,1,&MatSetValue_Column,&MatSetValue_Value,mode)) 25030de9b25SBarry Smith 251ea06a074SBarry Smith #define MatGetValue(v,i,j,va) \ 252f1144a30SSatish Balay ((MatSetValue_Row = i,MatSetValue_Column = j,0) || \ 2531d73ed98SBarry Smith MatGetValues(v,1,&MatSetValue_Row,1,&MatSetValue_Column,&va)) 25430de9b25SBarry Smith 255d91e6319SBarry Smith #define MatSetValueLocal(v,i,j,va,mode) \ 256f1144a30SSatish Balay ((MatSetValue_Row = i,MatSetValue_Column = j,MatSetValue_Value = va,0) || \ 2571d73ed98SBarry Smith MatSetValuesLocal(v,1,&MatSetValue_Row,1,&MatSetValue_Column,&MatSetValue_Value,mode)) 25830de9b25SBarry Smith 259d91e6319SBarry Smith /*E 260d91e6319SBarry Smith MatOption - Options that may be set for a matrix and its behavior or storage 261d91e6319SBarry Smith 262d91e6319SBarry Smith Level: beginner 263d91e6319SBarry Smith 2640a835dfdSSatish Balay Any additions/changes here MUST also be made in include/finclude/petscmat.h 265d91e6319SBarry Smith 266d91e6319SBarry Smith .seealso: MatSetOption() 267d91e6319SBarry Smith E*/ 2686d4a8577SBarry Smith typedef enum {MAT_ROW_ORIENTED=1,MAT_COLUMN_ORIENTED=2,MAT_ROWS_SORTED=4, 2696d4a8577SBarry Smith MAT_COLUMNS_SORTED=8,MAT_NO_NEW_NONZERO_LOCATIONS=16, 2706d4a8577SBarry Smith MAT_YES_NEW_NONZERO_LOCATIONS=32,MAT_SYMMETRIC=64, 2716ca9ecd3SBarry Smith MAT_STRUCTURALLY_SYMMETRIC=65,MAT_NO_NEW_DIAGONALS=66, 2726ca9ecd3SBarry Smith MAT_YES_NEW_DIAGONALS=67,MAT_INODE_LIMIT_1=68,MAT_INODE_LIMIT_2=69, 2736ca9ecd3SBarry Smith MAT_INODE_LIMIT_3=70,MAT_INODE_LIMIT_4=71,MAT_INODE_LIMIT_5=72, 2746ca9ecd3SBarry Smith MAT_IGNORE_OFF_PROC_ENTRIES=73,MAT_ROWS_UNSORTED=74, 2754787f768SSatish Balay MAT_COLUMNS_UNSORTED=75,MAT_NEW_NONZERO_LOCATION_ERR=76, 2767c922b88SBarry Smith MAT_NEW_NONZERO_ALLOCATION_ERR=77,MAT_USE_HASH_TABLE=78, 2772bad1931SBarry Smith MAT_KEEP_ZEROED_ROWS=79,MAT_IGNORE_ZERO_ENTRIES=80,MAT_USE_INODES=81, 278efcf0fc3SBarry Smith MAT_DO_NOT_USE_INODES=82,MAT_NOT_SYMMETRIC=83,MAT_HERMITIAN=84, 2799a4540c5SBarry Smith MAT_NOT_STRUCTURALLY_SYMMETRIC=85,MAT_NOT_HERMITIAN=86, 280d487561eSHong Zhang MAT_SYMMETRY_ETERNAL=87,MAT_NOT_SYMMETRY_ETERNAL=88, 281941593c8SHong Zhang MAT_USE_COMPRESSEDROW=89,MAT_DO_NOT_USE_COMPRESSEDROW=90, 282941593c8SHong Zhang MAT_IGNORE_LOWER_TRIANGULAR=91,MAT_ERROR_LOWER_TRIANGULAR=92} MatOption; 283be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetOption(Mat,MatOption); 284be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetType(Mat,MatType*); 28584cb2905SBarry Smith 286be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetValues(Mat,PetscInt,const PetscInt[],PetscInt,const PetscInt[],PetscScalar[]); 287be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetRow(Mat,PetscInt,PetscInt *,const PetscInt *[],const PetscScalar*[]); 288be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatRestoreRow(Mat,PetscInt,PetscInt *,const PetscInt *[],const PetscScalar*[]); 289be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetColumn(Mat,PetscInt,PetscInt *,const PetscInt *[],const PetscScalar*[]); 290be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatRestoreColumn(Mat,PetscInt,PetscInt *,const PetscInt *[],const PetscScalar*[]); 291be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetColumnVector(Mat,Vec,PetscInt); 292be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetArray(Mat,PetscScalar *[]); 293be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatRestoreArray(Mat,PetscScalar *[]); 294be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetBlockSize(Mat,PetscInt *); 295be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetBlockSize(Mat,PetscInt); 2967b80b807SBarry Smith 297be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMult(Mat,Vec,Vec); 298be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMultAdd(Mat,Vec,Vec,Vec); 299be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMultTranspose(Mat,Vec,Vec); 300be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatIsTranspose(Mat,Mat,PetscReal,PetscTruth*); 301be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMultTransposeAdd(Mat,Vec,Vec,Vec); 302be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMultConstrained(Mat,Vec,Vec); 303be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMultTransposeConstrained(Mat,Vec,Vec); 3042eac72dbSBarry Smith 305d91e6319SBarry Smith /*E 306d91e6319SBarry Smith MatDuplicateOption - Indicates if a duplicated sparse matrix should have 307d91e6319SBarry Smith its numerical values copied over or just its nonzero structure. 308d91e6319SBarry Smith 309d91e6319SBarry Smith Level: beginner 310d91e6319SBarry Smith 311d91e6319SBarry Smith Any additions/changes here MUST also be made in include/finclude/petscmat.h 312d91e6319SBarry Smith 313d91e6319SBarry Smith .seealso: MatDuplicate() 314d91e6319SBarry Smith E*/ 3152e8a6d31SBarry Smith typedef enum {MAT_DO_NOT_COPY_VALUES,MAT_COPY_VALUES} MatDuplicateOption; 3162e8a6d31SBarry Smith 317be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatConvertRegister(const char[],const char[],const char[],PetscErrorCode (*)(Mat,MatType,MatReuse,Mat*)); 318273d9f13SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 319273d9f13SBarry Smith #define MatConvertRegisterDynamic(a,b,c,d) MatConvertRegister(a,b,c,0) 320273d9f13SBarry Smith #else 321273d9f13SBarry Smith #define MatConvertRegisterDynamic(a,b,c,d) MatConvertRegister(a,b,c,d) 322273d9f13SBarry Smith #endif 323be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatConvertRegisterAll(const char[]); 324be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatConvertRegisterDestroy(void); 325273d9f13SBarry Smith extern PetscTruth MatConvertRegisterAllCalled; 326b0a32e0cSBarry Smith extern PetscFList MatConvertList; 327be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatConvert(Mat,const MatType,MatReuse,Mat*); 328be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatDuplicate(Mat,MatDuplicateOption,Mat*); 32994a9d846SBarry Smith 330d91e6319SBarry Smith /*E 331d91e6319SBarry Smith MatStructure - Indicates if the matrix has the same nonzero structure 332d91e6319SBarry Smith 333d91e6319SBarry Smith Level: beginner 334d91e6319SBarry Smith 335d91e6319SBarry Smith Any additions/changes here MUST also be made in include/finclude/petscmat.h 336d91e6319SBarry Smith 33794b7f48cSBarry Smith .seealso: MatCopy(), KSPSetOperators(), PCSetOperators() 338d91e6319SBarry Smith E*/ 339c537a176SHong Zhang typedef enum {SAME_NONZERO_PATTERN,DIFFERENT_NONZERO_PATTERN,SAME_PRECONDITIONER,SUBSET_NONZERO_PATTERN} MatStructure; 340cb5b572fSBarry Smith 341be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCopy(Mat,Mat,MatStructure); 342be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatView(Mat,PetscViewer); 343be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatIsSymmetric(Mat,PetscReal,PetscTruth*); 344be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatIsStructurallySymmetric(Mat,PetscTruth*); 345be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatIsHermitian(Mat,PetscTruth*); 346be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatIsSymmetricKnown(Mat,PetscTruth*,PetscTruth*); 347be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatIsHermitianKnown(Mat,PetscTruth*,PetscTruth*); 348be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatLoad(PetscViewer,const MatType,Mat*); 3497b80b807SBarry Smith 350be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetRowIJ(Mat,PetscInt,PetscTruth,PetscInt*,PetscInt *[],PetscInt *[],PetscTruth *); 351be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatRestoreRowIJ(Mat,PetscInt,PetscTruth,PetscInt *,PetscInt *[],PetscInt *[],PetscTruth *); 352be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetColumnIJ(Mat,PetscInt,PetscTruth,PetscInt*,PetscInt *[],PetscInt *[],PetscTruth *); 353be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatRestoreColumnIJ(Mat,PetscInt,PetscTruth,PetscInt *,PetscInt *[],PetscInt *[],PetscTruth *); 354d4fbbf0eSBarry Smith 355d91e6319SBarry Smith /*S 356d91e6319SBarry Smith MatInfo - Context of matrix information, used with MatGetInfo() 357d91e6319SBarry Smith 358d91e6319SBarry Smith In Fortran this is simply a double precision array of dimension MAT_INFO_SIZE 359d91e6319SBarry Smith 360d91e6319SBarry Smith Level: intermediate 361d91e6319SBarry Smith 362d91e6319SBarry Smith Concepts: matrix^nonzero information 363d91e6319SBarry Smith 364d9274352SBarry Smith .seealso: MatGetInfo(), MatInfoType 365d91e6319SBarry Smith S*/ 3664e220ebcSLois Curfman McInnes typedef struct { 367b0a32e0cSBarry Smith PetscLogDouble rows_global,columns_global; /* number of global rows and columns */ 368b0a32e0cSBarry Smith PetscLogDouble rows_local,columns_local; /* number of local rows and columns */ 369b0a32e0cSBarry Smith PetscLogDouble block_size; /* block size */ 370b0a32e0cSBarry Smith PetscLogDouble nz_allocated,nz_used,nz_unneeded; /* number of nonzeros */ 371b0a32e0cSBarry Smith PetscLogDouble memory; /* memory allocated */ 372b0a32e0cSBarry Smith PetscLogDouble assemblies; /* number of matrix assemblies called */ 373b0a32e0cSBarry Smith PetscLogDouble mallocs; /* number of mallocs during MatSetValues() */ 374b0a32e0cSBarry Smith PetscLogDouble fill_ratio_given,fill_ratio_needed; /* fill ratio for LU/ILU */ 375b0a32e0cSBarry Smith PetscLogDouble factor_mallocs; /* number of mallocs during factorization */ 3764e220ebcSLois Curfman McInnes } MatInfo; 3774e220ebcSLois Curfman McInnes 378d9274352SBarry Smith /*E 379d9274352SBarry Smith MatInfoType - Indicates if you want information about the local part of the matrix, 380d9274352SBarry Smith the entire parallel matrix or the maximum over all the local parts. 381d9274352SBarry Smith 382d9274352SBarry Smith Level: beginner 383d9274352SBarry Smith 384d9274352SBarry Smith Any additions/changes here MUST also be made in include/finclude/petscmat.h 385d9274352SBarry Smith 386d9274352SBarry Smith .seealso: MatGetInfo(), MatInfo 387d9274352SBarry Smith E*/ 3887b80b807SBarry Smith typedef enum {MAT_LOCAL=1,MAT_GLOBAL_MAX=2,MAT_GLOBAL_SUM=3} MatInfoType; 389be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetInfo(Mat,MatInfoType,MatInfo*); 390be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatValid(Mat,PetscTruth*); 391be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetDiagonal(Mat,Vec); 392be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetRowMax(Mat,Vec); 393be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatTranspose(Mat,Mat*); 394be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPermute(Mat,IS,IS,Mat *); 395be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPermuteSparsify(Mat,PetscInt,PetscReal,PetscReal,IS,IS,Mat *); 396be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatDiagonalScale(Mat,Vec,Vec); 397be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatDiagonalSet(Mat,Vec,InsertMode); 398be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatEqual(Mat,Mat,PetscTruth*); 399be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMultEqual(Mat,Mat,PetscInt,PetscTruth*); 400be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMultAddEqual(Mat,Mat,PetscInt,PetscTruth*); 401be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMultTransposeEqual(Mat,Mat,PetscInt,PetscTruth*); 402be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMultTransposeAddEqual(Mat,Mat,PetscInt,PetscTruth*); 4037b80b807SBarry Smith 404be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatNorm(Mat,NormType,PetscReal *); 405be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatZeroEntries(Mat); 406be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatZeroRows(Mat,IS,const PetscScalar*); 407be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatZeroColumns(Mat,IS,const PetscScalar*); 4087b80b807SBarry Smith 409be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatUseScaledForm(Mat,PetscTruth); 410be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatScaleSystem(Mat,Vec,Vec); 411be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatUnScaleSystem(Mat,Vec,Vec); 4125ef9f2a5SBarry Smith 413be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetSize(Mat,PetscInt*,PetscInt*); 414be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetLocalSize(Mat,PetscInt*,PetscInt*); 415be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetOwnershipRange(Mat,PetscInt*,PetscInt*); 4167b80b807SBarry Smith 417be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetSubMatrices(Mat,PetscInt,const IS[],const IS[],MatReuse,Mat *[]); 418be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatDestroyMatrices(PetscInt,Mat *[]); 419be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetSubMatrix(Mat,IS,IS,PetscInt,MatReuse,Mat *); 420be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMerge(MPI_Comm,Mat,PetscInt,MatReuse,Mat*); 421be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMerge_SeqsToMPI(MPI_Comm,Mat,PetscInt,PetscInt,MatReuse,Mat*); 422be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMerge_SeqsToMPISymbolic(MPI_Comm,Mat,PetscInt,PetscInt,Mat*); 423be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMerge_SeqsToMPINumeric(Mat,Mat); 424be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatDestroy_MPIAIJ_SeqsToMPI(Mat); 425be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetLocalMat(Mat,MatReuse,Mat*); 426be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetLocalMatCondensed(Mat,MatReuse,IS*,IS*,Mat*); 427be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetBrowsOfAcols(Mat,Mat,MatReuse,IS*,IS*,PetscInt*,Mat*); 428be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetBrowsOfAoCols(Mat,Mat,MatReuse,PetscInt**,PetscScalar**,Mat*); 4298efafbd8SBarry Smith 430be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatIncreaseOverlap(Mat,PetscInt,IS[],PetscInt); 4317b80b807SBarry Smith 432be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMatMult(Mat,Mat,MatReuse,PetscReal,Mat*); 433be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMatMultSymbolic(Mat,Mat,PetscReal,Mat*); 434be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMatMultNumeric(Mat,Mat,Mat); 43522440eb1SKris Buschelman 436be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPtAP(Mat,Mat,MatReuse,PetscReal,Mat*); 437be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPtAPSymbolic(Mat,Mat,PetscReal,Mat*); 438be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPtAPNumeric(Mat,Mat,Mat); 43922440eb1SKris Buschelman 440be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMatMultTranspose(Mat,Mat,MatReuse,PetscReal,Mat*); 441be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMatMultTransposeSymbolic(Mat,Mat,PetscReal,Mat*); 442be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMatMultTransposeNumeric(Mat,Mat,Mat); 443bc011b1eSHong Zhang 444be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatAXPY(const PetscScalar *,Mat,Mat,MatStructure); 445be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatAYPX(const PetscScalar *,Mat,Mat); 446be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCompress(Mat); 4471c741599SHong Zhang 448be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatScale(const PetscScalar *,Mat); 449be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatShift(const PetscScalar *,Mat); 4507b80b807SBarry Smith 451be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetLocalToGlobalMapping(Mat,ISLocalToGlobalMapping); 452be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetLocalToGlobalMappingBlock(Mat,ISLocalToGlobalMapping); 453be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatZeroRowsLocal(Mat,IS,const PetscScalar*); 454be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetValuesLocal(Mat,PetscInt,const PetscInt[],PetscInt,const PetscInt[],const PetscScalar[],InsertMode); 455be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetValuesBlockedLocal(Mat,PetscInt,const PetscInt[],PetscInt,const PetscInt[],const PetscScalar[],InsertMode); 456052efed2SBarry Smith 457be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatStashSetInitialSize(Mat,PetscInt,PetscInt); 458be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatStashGetInfo(Mat,PetscInt*,PetscInt*,PetscInt*,PetscInt*); 45990f02eecSBarry Smith 460be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatInterpolateAdd(Mat,Vec,Vec,Vec); 461be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatInterpolate(Mat,Vec,Vec); 462be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatRestrict(Mat,Vec,Vec); 463be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetVecs(Mat,Vec*,Vec*); 464bd481603SBarry Smith 465bd481603SBarry Smith /*MC 466bd481603SBarry Smith MatPreallocInitialize - Begins the block of code that will count the number of nonzeros per 467bd481603SBarry Smith row in a matrix providing the data that one can use to correctly preallocate the matrix. 468bd481603SBarry Smith 469bd481603SBarry Smith Synopsis: 470c1ac3661SBarry Smith PetscErrorCode MatPreallocateInitialize(MPI_Comm comm, PetscInt nrows, PetscInt ncols, PetscInt *dnz, PetscInt *onz) 471bd481603SBarry Smith 472bd481603SBarry Smith Collective on MPI_Comm 473bd481603SBarry Smith 474bd481603SBarry Smith Input Parameters: 475bd481603SBarry Smith + comm - the communicator that will share the eventually allocated matrix 476859fcb39SBarry Smith . nrows - the number of LOCAL rows in the matrix 477859fcb39SBarry Smith - ncols - the number of LOCAL columns in the matrix 478bd481603SBarry Smith 479bd481603SBarry Smith Output Parameters: 480bd481603SBarry Smith + dnz - the array that will be passed to the matrix preallocation routines 481bd481603SBarry Smith - ozn - the other array passed to the matrix preallocation routines 482bd481603SBarry Smith 483bd481603SBarry Smith 484bd481603SBarry Smith Level: intermediate 485bd481603SBarry Smith 486bd481603SBarry Smith Notes: 487bd481603SBarry Smith See the chapter in the users manual on performance for more details 488bd481603SBarry Smith 4891d73ed98SBarry Smith Do not malloc or free dnz and onz, that is handled internally by these routines 490bd481603SBarry Smith 491bd481603SBarry Smith Use MatPreallocateInitializeSymmetric() for symmetric matrices (MPISBAIJ matrices) 492bd481603SBarry Smith 493bd481603SBarry Smith Concepts: preallocation^Matrix 494bd481603SBarry Smith 495bd481603SBarry Smith .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateSetLocal(), 496bd481603SBarry Smith MatPreallocateInitializeSymmetric(), MatPreallocateSymmetricSetLocal() 497bd481603SBarry Smith M*/ 498c4f061fbSSatish Balay #define MatPreallocateInitialize(comm,nrows,ncols,dnz,onz) 0; \ 4997c922b88SBarry Smith { \ 500c1ac3661SBarry Smith PetscErrorCode _4_ierr; PetscInt __tmp = (nrows),__ctmp = (ncols),__rstart,__start,__end; \ 501c1ac3661SBarry Smith _4_ierr = PetscMalloc(2*__tmp*sizeof(PetscInt),&dnz);CHKERRQ(_4_ierr);onz = dnz + __tmp;\ 502c1ac3661SBarry Smith _4_ierr = PetscMemzero(dnz,2*__tmp*sizeof(PetscInt));CHKERRQ(_4_ierr);\ 503c1ac3661SBarry Smith _4_ierr = MPI_Scan(&__ctmp,&__end,1,MPIU_INT,MPI_SUM,comm);CHKERRQ(_4_ierr); __start = __end - __ctmp;\ 504c1ac3661SBarry Smith _4_ierr = MPI_Scan(&__tmp,&__rstart,1,MPIU_INT,MPI_SUM,comm);CHKERRQ(_4_ierr); __rstart = __rstart - __tmp; 5057c922b88SBarry Smith 506bd481603SBarry Smith /*MC 507bd481603SBarry Smith MatPreallocSymmetricInitialize - Begins the block of code that will count the number of nonzeros per 508bd481603SBarry Smith row in a matrix providing the data that one can use to correctly preallocate the matrix. 509bd481603SBarry Smith 510bd481603SBarry Smith Synopsis: 511c1ac3661SBarry Smith PetscErrorCode MatPreallocateSymmetricInitialize(MPI_Comm comm, PetscInt nrows, PetscInt ncols, PetscInt *dnz, PetscInt *onz) 512bd481603SBarry Smith 513bd481603SBarry Smith Collective on MPI_Comm 514bd481603SBarry Smith 515bd481603SBarry Smith Input Parameters: 516bd481603SBarry Smith + comm - the communicator that will share the eventually allocated matrix 517859fcb39SBarry Smith . nrows - the number of LOCAL rows in the matrix 518859fcb39SBarry Smith - ncols - the number of LOCAL columns in the matrix 519bd481603SBarry Smith 520bd481603SBarry Smith Output Parameters: 521bd481603SBarry Smith + dnz - the array that will be passed to the matrix preallocation routines 522bd481603SBarry Smith - ozn - the other array passed to the matrix preallocation routines 523bd481603SBarry Smith 524bd481603SBarry Smith 525bd481603SBarry Smith Level: intermediate 526bd481603SBarry Smith 527bd481603SBarry Smith Notes: 528bd481603SBarry Smith See the chapter in the users manual on performance for more details 529bd481603SBarry Smith 5301d73ed98SBarry Smith Do not malloc or free dnz and onz, that is handled internally by these routines 531bd481603SBarry Smith 532bd481603SBarry Smith Concepts: preallocation^Matrix 533bd481603SBarry Smith 534bd481603SBarry Smith .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateSetLocal(), 535bd481603SBarry Smith MatPreallocateInitialize(), MatPreallocateSymmetricSetLocal() 536bd481603SBarry Smith M*/ 537222b16d4SBarry Smith #define MatPreallocateSymmetricInitialize(comm,nrows,ncols,dnz,onz) 0; \ 538222b16d4SBarry Smith { \ 539c1ac3661SBarry Smith PetscErrorCode _4_ierr; PetscInt __tmp = (nrows),__ctmp = (ncols),__rstart,__end; \ 540c1ac3661SBarry Smith _4_ierr = PetscMalloc(2*__tmp*sizeof(PetscInt),&dnz);CHKERRQ(_4_ierr);onz = dnz + __tmp;\ 541c1ac3661SBarry Smith _4_ierr = PetscMemzero(dnz,2*__tmp*sizeof(PetscInt));CHKERRQ(_4_ierr);\ 542c1ac3661SBarry Smith _4_ierr = MPI_Scan(&__ctmp,&__end,1,MPIU_INT,MPI_SUM,comm);CHKERRQ(_4_ierr);\ 543c1ac3661SBarry Smith _4_ierr = MPI_Scan(&__tmp,&__rstart,1,MPIU_INT,MPI_SUM,comm);CHKERRQ(_4_ierr); __rstart = __rstart - __tmp; 544222b16d4SBarry Smith 545bd481603SBarry Smith /*MC 546bd481603SBarry Smith MatPreallocateSetLocal - Indicates the locations (rows and columns) in the matrix where nonzeros will be 547bd481603SBarry Smith inserted using a local number of the rows and columns 548bd481603SBarry Smith 549bd481603SBarry Smith Synopsis: 550c1ac3661SBarry Smith PetscErrorCode MatPreallocateSetLocal(ISLocalToGlobalMappping map,PetscInt nrows, PetscInt *rows,PetscInt ncols, PetscInt *cols,PetscInt *dnz, PetscInt *onz) 551bd481603SBarry Smith 552bd481603SBarry Smith Not Collective 553bd481603SBarry Smith 554bd481603SBarry Smith Input Parameters: 555bd481603SBarry Smith + map - the mapping between local numbering and global numbering 556bd481603SBarry Smith . nrows - the number of rows indicated 5571d73ed98SBarry Smith . rows - the indices of the rows 558bd481603SBarry Smith . ncols - the number of columns in the matrix 559bd481603SBarry Smith . cols - the columns indicated 560bd481603SBarry Smith . dnz - the array that will be passed to the matrix preallocation routines 561bd481603SBarry Smith - ozn - the other array passed to the matrix preallocation routines 562bd481603SBarry Smith 563bd481603SBarry Smith 564bd481603SBarry Smith Level: intermediate 565bd481603SBarry Smith 566bd481603SBarry Smith Notes: 567bd481603SBarry Smith See the chapter in the users manual on performance for more details 568bd481603SBarry Smith 5691d73ed98SBarry Smith Do not malloc or free dnz and onz, that is handled internally by these routines 570bd481603SBarry Smith 571bd481603SBarry Smith Concepts: preallocation^Matrix 572bd481603SBarry Smith 573bd481603SBarry Smith .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateInitialize(), 574bd481603SBarry Smith MatPreallocateInitialize(), MatPreallocateSymmetricSetLocal() 575bd481603SBarry Smith M*/ 576c4f061fbSSatish Balay #define MatPreallocateSetLocal(map,nrows,rows,ncols,cols,dnz,onz) 0;\ 577c4f061fbSSatish Balay {\ 578c1ac3661SBarry Smith PetscInt __l;\ 579ef66eb69SBarry Smith _4_ierr = ISLocalToGlobalMappingApply(map,nrows,rows,rows);CHKERRQ(_4_ierr);\ 580ef66eb69SBarry Smith _4_ierr = ISLocalToGlobalMappingApply(map,ncols,cols,cols);CHKERRQ(_4_ierr);\ 581c4f061fbSSatish Balay for (__l=0;__l<nrows;__l++) {\ 582ef66eb69SBarry Smith _4_ierr = MatPreallocateSet((rows)[__l],ncols,cols,dnz,onz);CHKERRQ(_4_ierr);\ 583c4f061fbSSatish Balay }\ 584c4f061fbSSatish Balay } 585c4f061fbSSatish Balay 586bd481603SBarry Smith /*MC 587bd481603SBarry Smith MatPreallocateSymmetricSetLocal - Indicates the locations (rows and columns) in the matrix where nonzeros will be 588bd481603SBarry Smith inserted using a local number of the rows and columns 589bd481603SBarry Smith 590bd481603SBarry Smith Synopsis: 591c1ac3661SBarry Smith PetscErrorCode MatPreallocateSymmetricSetLocal(ISLocalToGlobalMappping map,PetscInt nrows, PetscInt *rows,PetscInt ncols, PetscInt *cols,PetscInt *dnz, PetscInt *onz) 592bd481603SBarry Smith 593bd481603SBarry Smith Not Collective 594bd481603SBarry Smith 595bd481603SBarry Smith Input Parameters: 596bd481603SBarry Smith + map - the mapping between local numbering and global numbering 597bd481603SBarry Smith . nrows - the number of rows indicated 5981d73ed98SBarry Smith . rows - the indices of the rows 599bd481603SBarry Smith . ncols - the number of columns in the matrix 600bd481603SBarry Smith . cols - the columns indicated 601bd481603SBarry Smith . dnz - the array that will be passed to the matrix preallocation routines 602bd481603SBarry Smith - ozn - the other array passed to the matrix preallocation routines 603bd481603SBarry Smith 604bd481603SBarry Smith 605bd481603SBarry Smith Level: intermediate 606bd481603SBarry Smith 607bd481603SBarry Smith Notes: 608bd481603SBarry Smith See the chapter in the users manual on performance for more details 609bd481603SBarry Smith 610bd481603SBarry Smith Do not malloc or free dnz and onz that is handled internally by these routines 611bd481603SBarry Smith 612bd481603SBarry Smith Concepts: preallocation^Matrix 613bd481603SBarry Smith 614bd481603SBarry Smith .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateInitialize(), 615bd481603SBarry Smith MatPreallocateInitialize(), MatPreallocateSymmetricSetLocal(), MatPreallocateSetLocal() 616bd481603SBarry Smith M*/ 617d3d32019SBarry Smith #define MatPreallocateSymmetricSetLocal(map,nrows,rows,ncols,cols,dnz,onz) 0;\ 618d3d32019SBarry Smith {\ 619c1ac3661SBarry Smith PetscInt __l;\ 620d3d32019SBarry Smith _4_ierr = ISLocalToGlobalMappingApply(map,nrows,rows,rows);CHKERRQ(_4_ierr);\ 621d3d32019SBarry Smith _4_ierr = ISLocalToGlobalMappingApply(map,ncols,cols,cols);CHKERRQ(_4_ierr);\ 622d3d32019SBarry Smith for (__l=0;__l<nrows;__l++) {\ 623d3d32019SBarry Smith _4_ierr = MatPreallocateSymmetricSet((rows)[__l],ncols,cols,dnz,onz);CHKERRQ(_4_ierr);\ 624d3d32019SBarry Smith }\ 625d3d32019SBarry Smith } 626d3d32019SBarry Smith 627bd481603SBarry Smith /*MC 628bd481603SBarry Smith MatPreallocateSet - Indicates the locations (rows and columns) in the matrix where nonzeros will be 629bd481603SBarry Smith inserted using a local number of the rows and columns 630bd481603SBarry Smith 631bd481603SBarry Smith Synopsis: 632c1ac3661SBarry Smith PetscErrorCode MatPreallocateSet(PetscInt nrows, PetscInt *rows,PetscInt ncols, PetscInt *cols,PetscInt *dnz, PetscInt *onz) 633bd481603SBarry Smith 634bd481603SBarry Smith Not Collective 635bd481603SBarry Smith 636bd481603SBarry Smith Input Parameters: 637bd481603SBarry Smith + nrows - the number of rows indicated 6381d73ed98SBarry Smith . rows - the indices of the rows 639bd481603SBarry Smith . ncols - the number of columns in the matrix 640a50f8bf6SHong Zhang - cols - the columns indicated 641a50f8bf6SHong Zhang 642a50f8bf6SHong Zhang Output Parameters: 643a50f8bf6SHong Zhang + dnz - the array that will be passed to the matrix preallocation routines 644bd481603SBarry Smith - ozn - the other array passed to the matrix preallocation routines 645bd481603SBarry Smith 646bd481603SBarry Smith 647bd481603SBarry Smith Level: intermediate 648bd481603SBarry Smith 649bd481603SBarry Smith Notes: 650bd481603SBarry Smith See the chapter in the users manual on performance for more details 651bd481603SBarry Smith 652bd481603SBarry Smith Do not malloc or free dnz and onz that is handled internally by these routines 653bd481603SBarry Smith 654bd481603SBarry Smith Concepts: preallocation^Matrix 655bd481603SBarry Smith 656bd481603SBarry Smith .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateInitialize(), 657bd481603SBarry Smith MatPreallocateInitialize(), MatPreallocateSymmetricSetLocal(), MatPreallocateSetLocal() 658bd481603SBarry Smith M*/ 659c4f061fbSSatish Balay #define MatPreallocateSet(row,nc,cols,dnz,onz) 0;\ 660c1ac3661SBarry Smith { PetscInt __i; \ 6617c922b88SBarry Smith for (__i=0; __i<nc; __i++) {\ 6627c922b88SBarry Smith if (cols[__i] < __start || cols[__i] >= __end) onz[row - __rstart]++; \ 6637c922b88SBarry Smith }\ 6647c922b88SBarry Smith dnz[row - __rstart] = nc - onz[row - __rstart];\ 6657c922b88SBarry Smith } 6667c922b88SBarry Smith 667bd481603SBarry Smith /*MC 668bd481603SBarry Smith MatPreallocateSymmetricSet - Indicates the locations (rows and columns) in the matrix where nonzeros will be 669bd481603SBarry Smith inserted using a local number of the rows and columns 670bd481603SBarry Smith 671bd481603SBarry Smith Synopsis: 672c1ac3661SBarry Smith PetscErrorCode MatPreallocateSymmetricSet(PetscInt nrows, PetscInt *rows,PetscInt ncols, PetscInt *cols,PetscInt *dnz, PetscInt *onz) 673bd481603SBarry Smith 674bd481603SBarry Smith Not Collective 675bd481603SBarry Smith 676bd481603SBarry Smith Input Parameters: 677bd481603SBarry Smith + nrows - the number of rows indicated 6781d73ed98SBarry Smith . rows - the indices of the rows 679bd481603SBarry Smith . ncols - the number of columns in the matrix 680bd481603SBarry Smith . cols - the columns indicated 681bd481603SBarry Smith . dnz - the array that will be passed to the matrix preallocation routines 682bd481603SBarry Smith - ozn - the other array passed to the matrix preallocation routines 683bd481603SBarry Smith 684bd481603SBarry Smith 685bd481603SBarry Smith Level: intermediate 686bd481603SBarry Smith 687bd481603SBarry Smith Notes: 688bd481603SBarry Smith See the chapter in the users manual on performance for more details 689bd481603SBarry Smith 690bd481603SBarry Smith Do not malloc or free dnz and onz that is handled internally by these routines 691bd481603SBarry Smith 692bd481603SBarry Smith Concepts: preallocation^Matrix 693bd481603SBarry Smith 694bd481603SBarry Smith .seealso: MatPreallocateFinalize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateInitialize(), 695bd481603SBarry Smith MatPreallocateInitialize(), MatPreallocateSymmetricSetLocal(), MatPreallocateSetLocal() 696bd481603SBarry Smith M*/ 697d3d32019SBarry Smith #define MatPreallocateSymmetricSet(row,nc,cols,dnz,onz) 0;\ 698c1ac3661SBarry Smith { PetscInt __i; \ 699d3d32019SBarry Smith for (__i=0; __i<nc; __i++) {\ 700d3d32019SBarry Smith if (cols[__i] >= __end) onz[row - __rstart]++; \ 701d3d32019SBarry Smith else if (cols[__i] >= row) dnz[row - __rstart]++;\ 702d3d32019SBarry Smith }\ 703d3d32019SBarry Smith } 704d3d32019SBarry Smith 705bd481603SBarry Smith /*MC 706bd481603SBarry Smith MatPreallocFinalize - Ends the block of code that will count the number of nonzeros per 707bd481603SBarry Smith row in a matrix providing the data that one can use to correctly preallocate the matrix. 708bd481603SBarry Smith 709bd481603SBarry Smith Synopsis: 710c1ac3661SBarry Smith PetscErrorCode MatPreallocateFinalize(PetscInt *dnz, PetscInt *onz) 711bd481603SBarry Smith 712bd481603SBarry Smith Collective on MPI_Comm 713bd481603SBarry Smith 714bd481603SBarry Smith Input Parameters: 715bd481603SBarry Smith + dnz - the array that will be passed to the matrix preallocation routines 716bd481603SBarry Smith - ozn - the other array passed to the matrix preallocation routines 717bd481603SBarry Smith 718bd481603SBarry Smith 719bd481603SBarry Smith Level: intermediate 720bd481603SBarry Smith 721bd481603SBarry Smith Notes: 722bd481603SBarry Smith See the chapter in the users manual on performance for more details 723bd481603SBarry Smith 724bd481603SBarry Smith Do not malloc or free dnz and onz that is handled internally by these routines 725bd481603SBarry Smith 726bd481603SBarry Smith Concepts: preallocation^Matrix 727bd481603SBarry Smith 728bd481603SBarry Smith .seealso: MatPreallocateInitialize(), MatPreallocateSet(), MatPreallocateSymmetricSet(), MatPreallocateSetLocal(), 729bd481603SBarry Smith MatPreallocateSymmetricInitialize(), MatPreallocateSymmetricSetLocal() 730bd481603SBarry Smith M*/ 731ef66eb69SBarry Smith #define MatPreallocateFinalize(dnz,onz) 0;_4_ierr = PetscFree(dnz);CHKERRQ(_4_ierr);} 7327c922b88SBarry Smith 733bd481603SBarry Smith 734bd481603SBarry Smith 7357b80b807SBarry Smith /* Routines unique to particular data structures */ 736be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatShellGetContext(Mat,void **); 737435da068SBarry Smith 738be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatBDiagGetData(Mat,PetscInt*,PetscInt*,PetscInt*[],PetscInt*[],PetscScalar***); 739698d4c6aSKris Buschelman 740be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatInodeAdjustForInodes(Mat,IS*,IS*); 741be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatInodeGetInodeSizes(Mat,PetscInt *,PetscInt *[],PetscInt *); 742698d4c6aSKris Buschelman 743be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSeqAIJSetColumnIndices(Mat,PetscInt[]); 744be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSeqBAIJSetColumnIndices(Mat,PetscInt[]); 745be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateSeqAIJWithArrays(MPI_Comm,PetscInt,PetscInt,PetscInt[],PetscInt[],PetscScalar[],Mat*); 7467b80b807SBarry Smith 747be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSeqBAIJSetPreallocation(Mat,PetscInt,PetscInt,const PetscInt[]); 748be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSeqSBAIJSetPreallocation(Mat,PetscInt,PetscInt,const PetscInt[]); 749be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSeqAIJSetPreallocation(Mat,PetscInt,const PetscInt[]); 750be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSeqDensePreallocation(Mat,PetscScalar[]); 751be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSeqBDiagSetPreallocation(Mat,PetscInt,PetscInt,const PetscInt[],PetscScalar*[]); 752be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSeqDenseSetPreallocation(Mat,PetscScalar[]); 753273d9f13SBarry Smith 754be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPIBAIJSetPreallocation(Mat,PetscInt,PetscInt,const PetscInt[],PetscInt,const PetscInt[]); 755be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPISBAIJSetPreallocation(Mat,PetscInt,PetscInt,const PetscInt[],PetscInt,const PetscInt[]); 756be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPIAIJSetPreallocation(Mat,PetscInt,const PetscInt[],PetscInt,const PetscInt[]); 757be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPIAIJSetPreallocationCSR(Mat,const PetscInt[],const PetscInt[],const PetscScalar[]); 758be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPIBAIJSetPreallocationCSR(Mat,PetscInt,const PetscInt[],const PetscInt[],const PetscScalar[]); 759be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPIDensePreallocation(Mat,PetscScalar[]); 760be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPIBDiagSetPreallocation(Mat,PetscInt,PetscInt,const PetscInt[],PetscScalar*[]); 761be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPIAdjSetPreallocation(Mat,PetscInt[],PetscInt[],PetscInt[]); 762be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPIDenseSetPreallocation(Mat,PetscScalar[]); 763be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPIRowbsSetPreallocation(Mat,PetscInt,const PetscInt[]); 764be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPIAIJGetSeqAIJ(Mat,Mat*,Mat*,PetscInt*[]); 765be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPIBAIJGetSeqBAIJ(Mat,Mat*,Mat*,PetscInt*[]); 766be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatAdicSetLocalFunction(Mat,void (*)(void)); 767273d9f13SBarry Smith 768be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSeqDenseSetLDA(Mat,PetscInt); 7691b807ce4Svictorle 770be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatStoreValues(Mat); 771be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatRetrieveValues(Mat); 7722e8a6d31SBarry Smith 773be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatDAADSetCtx(Mat,void*); 7743a7fca6bSBarry Smith 7757b80b807SBarry Smith /* 7767b80b807SBarry Smith These routines are not usually accessed directly, rather solving is 77794b7f48cSBarry Smith done through the KSP and PC interfaces. 7787b80b807SBarry Smith */ 7797b80b807SBarry Smith 780d9274352SBarry Smith /*E 781d9274352SBarry Smith MatOrderingType - String with the name of a PETSc matrix ordering or the creation function 782d9274352SBarry Smith with an optional dynamic library name, for example 783d9274352SBarry Smith http://www.mcs.anl.gov/petsc/lib.a:orderingcreate() 784d9274352SBarry Smith 785d9274352SBarry Smith Level: beginner 786d9274352SBarry Smith 787d9274352SBarry Smith .seealso: MatGetOrdering() 788d9274352SBarry Smith E*/ 78949773a63SBarry Smith #define MatOrderingType char* 790b12f92e5SBarry Smith #define MATORDERING_NATURAL "natural" 791b12f92e5SBarry Smith #define MATORDERING_ND "nd" 792b12f92e5SBarry Smith #define MATORDERING_1WD "1wd" 793b12f92e5SBarry Smith #define MATORDERING_RCM "rcm" 794b12f92e5SBarry Smith #define MATORDERING_QMD "qmd" 795b12f92e5SBarry Smith #define MATORDERING_ROWLENGTH "rowlength" 79662152c8bSBarry Smith #define MATORDERING_DSC_ND "dsc_nd" 79762152c8bSBarry Smith #define MATORDERING_DSC_MMD "dsc_mmd" 79862152c8bSBarry Smith #define MATORDERING_DSC_MDF "dsc_mdf" 799c06d978dSMatthew Knepley #define MATORDERING_CONSTRAINED "constrained" 800c06d978dSMatthew Knepley #define MATORDERING_IDENTITY "identity" 801c06d978dSMatthew Knepley #define MATORDERING_REVERSE "reverse" 802b12f92e5SBarry Smith 803be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetOrdering(Mat,const MatOrderingType,IS*,IS*); 804be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetOrderingList(PetscFList *list); 805be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatOrderingRegister(const char[],const char[],const char[],PetscErrorCode(*)(Mat,const MatOrderingType,IS*,IS*)); 80630de9b25SBarry Smith 80730de9b25SBarry Smith /*MC 80830de9b25SBarry Smith MatOrderingRegisterDynamic - Adds a new sparse matrix ordering to the 80930de9b25SBarry Smith matrix package. 81030de9b25SBarry Smith 81130de9b25SBarry Smith Synopsis: 812c1ac3661SBarry Smith PetscErrorCode MatOrderingRegisterDynamic(char *name_ordering,char *path,char *name_create,PetscErrorCode (*routine_create)(MatOrdering)) 81330de9b25SBarry Smith 81430de9b25SBarry Smith Not Collective 81530de9b25SBarry Smith 81630de9b25SBarry Smith Input Parameters: 81730de9b25SBarry Smith + sname - name of ordering (for example MATORDERING_ND) 81830de9b25SBarry Smith . path - location of library where creation routine is 81930de9b25SBarry Smith . name - name of function that creates the ordering type,a string 82030de9b25SBarry Smith - function - function pointer that creates the ordering 82130de9b25SBarry Smith 82230de9b25SBarry Smith Level: developer 82330de9b25SBarry Smith 82430de9b25SBarry Smith If dynamic libraries are used, then the fourth input argument (function) 82530de9b25SBarry Smith is ignored. 82630de9b25SBarry Smith 82730de9b25SBarry Smith Sample usage: 82830de9b25SBarry Smith .vb 82930de9b25SBarry Smith MatOrderingRegisterDynamic("my_order",/home/username/my_lib/lib/libO/solaris/mylib.a, 83030de9b25SBarry Smith "MyOrder",MyOrder); 83130de9b25SBarry Smith .ve 83230de9b25SBarry Smith 83330de9b25SBarry Smith Then, your partitioner can be chosen with the procedural interface via 83430de9b25SBarry Smith $ MatOrderingSetType(part,"my_order) 83530de9b25SBarry Smith or at runtime via the option 83630de9b25SBarry Smith $ -pc_ilu_mat_ordering_type my_order 83730de9b25SBarry Smith $ -pc_lu_mat_ordering_type my_order 83830de9b25SBarry Smith 839ab901514SBarry Smith ${PETSC_ARCH} occuring in pathname will be replaced with appropriate values. 84030de9b25SBarry Smith 84130de9b25SBarry Smith .keywords: matrix, ordering, register 84230de9b25SBarry Smith 84330de9b25SBarry Smith .seealso: MatOrderingRegisterDestroy(), MatOrderingRegisterAll() 84430de9b25SBarry Smith M*/ 845aa482453SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 846f1af5d2fSBarry Smith #define MatOrderingRegisterDynamic(a,b,c,d) MatOrderingRegister(a,b,c,0) 847b12f92e5SBarry Smith #else 848f1af5d2fSBarry Smith #define MatOrderingRegisterDynamic(a,b,c,d) MatOrderingRegister(a,b,c,d) 849b12f92e5SBarry Smith #endif 85030de9b25SBarry Smith 851be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatOrderingRegisterDestroy(void); 852be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatOrderingRegisterAll(const char[]); 8532bad1931SBarry Smith extern PetscTruth MatOrderingRegisterAllCalled; 854b0a32e0cSBarry Smith extern PetscFList MatOrderingList; 855d4fbbf0eSBarry Smith 856be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatReorderForNonzeroDiagonal(Mat,PetscReal,IS,IS); 857a2ce50c7SBarry Smith 858d91e6319SBarry Smith /*S 85915e8a5b3SHong Zhang MatFactorInfo - Data based into the matrix factorization routines 860b00f7748SHong Zhang 86115e8a5b3SHong Zhang In Fortran these are simply double precision arrays of size MAT_FACTORINFO_SIZE 862b00f7748SHong Zhang 86315e8a5b3SHong Zhang Notes: These are not usually directly used by users, instead use PC type of LU, ILU, CHOLESKY or ICC. 864b00f7748SHong Zhang 865b00f7748SHong Zhang Level: developer 866b00f7748SHong Zhang 867d7d82daaSBarry Smith .seealso: MatLUFactorSymbolic(), MatILUFactorSymbolic(), MatCholeskyFactorSymbolic(), MatICCFactorSymbolic(), MatICCFactor(), 868d7d82daaSBarry Smith MatFactorInfoInitialize() 869b00f7748SHong Zhang 870b00f7748SHong Zhang S*/ 871b00f7748SHong Zhang typedef struct { 8720a29876aSHong Zhang PetscReal shiftnz; /* scaling of identity added to matrix to prevent zero pivots */ 8730a29876aSHong Zhang PetscTruth shiftpd; /* if true, shift until positive pivots */ 8742cea7109SBarry Smith PetscReal shift_fraction; /* record shift fraction taken */ 87515e8a5b3SHong Zhang PetscReal diagonal_fill; /* force diagonal to fill in if initially not filled */ 87615e8a5b3SHong Zhang PetscReal dt; /* drop tolerance */ 877b00f7748SHong Zhang PetscReal dtcol; /* tolerance for pivoting */ 87815e8a5b3SHong Zhang PetscReal dtcount; /* maximum nonzeros to be allowed per row */ 879f6275e2eSBarry Smith PetscReal fill; /* expected fill; nonzeros in factored matrix/nonzeros in original matrix*/ 880348344bbSBarry Smith PetscReal levels; /* ICC/ILU(levels) */ 881bcd9e38bSBarry Smith PetscReal pivotinblocks; /* for BAIJ and SBAIJ matrices pivot in factorization on blocks, default 1.0 882bcd9e38bSBarry Smith factorization may be faster if do not pivot */ 88315e8a5b3SHong Zhang PetscReal zeropivot; /* pivot is called zero if less than this */ 88415e8a5b3SHong Zhang } MatFactorInfo; 885ffa6d0a5SLois Curfman McInnes 886be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFactorInfoInitialize(MatFactorInfo*); 887be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCholeskyFactor(Mat,IS,MatFactorInfo*); 888be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCholeskyFactorSymbolic(Mat,IS,MatFactorInfo*,Mat*); 889be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCholeskyFactorNumeric(Mat,MatFactorInfo*,Mat*); 890be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatLUFactor(Mat,IS,IS,MatFactorInfo*); 891be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatILUFactor(Mat,IS,IS,MatFactorInfo*); 892be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatLUFactorSymbolic(Mat,IS,IS,MatFactorInfo*,Mat*); 893be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatILUFactorSymbolic(Mat,IS,IS,MatFactorInfo*,Mat*); 894be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatICCFactorSymbolic(Mat,IS,MatFactorInfo*,Mat*); 895be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatICCFactor(Mat,IS,MatFactorInfo*); 896be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatLUFactorNumeric(Mat,MatFactorInfo*,Mat*); 897be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatILUDTFactor(Mat,IS,IS,MatFactorInfo*,Mat *); 898be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetInertia(Mat,PetscInt*,PetscInt*,PetscInt*); 899be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSolve(Mat,Vec,Vec); 900be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatForwardSolve(Mat,Vec,Vec); 901be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatBackwardSolve(Mat,Vec,Vec); 902be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSolveAdd(Mat,Vec,Vec,Vec); 903be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSolveTranspose(Mat,Vec,Vec); 904be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSolveTransposeAdd(Mat,Vec,Vec,Vec); 905be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSolves(Mat,Vecs,Vecs); 9068ed539a5SBarry Smith 907be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSetUnfactored(Mat); 908bb5a7306SBarry Smith 909d91e6319SBarry Smith /*E 910d91e6319SBarry Smith MatSORType - What type of (S)SOR to perform 911bb1eb677SSatish Balay 912d91e6319SBarry Smith Level: beginner 913d91e6319SBarry Smith 914d9274352SBarry Smith May be bitwise ORd together 915d9274352SBarry Smith 916d91e6319SBarry Smith Any additions/changes here MUST also be made in include/finclude/petscmat.h 917d91e6319SBarry Smith 9184e7234bfSBarry Smith MatSORType may be bitwise ORd together, so do not change the numbers 9194e7234bfSBarry Smith 920a1d92eedSBarry Smith .seealso: MatRelax(), MatPBRelax() 921d91e6319SBarry Smith E*/ 922ee50ffe9SBarry Smith typedef enum {SOR_FORWARD_SWEEP=1,SOR_BACKWARD_SWEEP=2,SOR_SYMMETRIC_SWEEP=3, 923ee50ffe9SBarry Smith SOR_LOCAL_FORWARD_SWEEP=4,SOR_LOCAL_BACKWARD_SWEEP=8, 924ee50ffe9SBarry Smith SOR_LOCAL_SYMMETRIC_SWEEP=12,SOR_ZERO_INITIAL_GUESS=16, 92584cb2905SBarry Smith SOR_EISENSTAT=32,SOR_APPLY_UPPER=64,SOR_APPLY_LOWER=128} MatSORType; 926be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatRelax(Mat,Vec,PetscReal,MatSORType,PetscReal,PetscInt,PetscInt,Vec); 927be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPBRelax(Mat,Vec,PetscReal,MatSORType,PetscReal,PetscInt,PetscInt,Vec); 9288ed539a5SBarry Smith 929d4fbbf0eSBarry Smith /* 930639f9d9dSBarry Smith These routines are for efficiently computing Jacobians via finite differences. 931639f9d9dSBarry Smith */ 932b12f92e5SBarry Smith 933d9274352SBarry Smith /*E 934d9274352SBarry Smith MatColoringType - String with the name of a PETSc matrix coloring or the creation function 935d9274352SBarry Smith with an optional dynamic library name, for example 936d9274352SBarry Smith http://www.mcs.anl.gov/petsc/lib.a:coloringcreate() 937d9274352SBarry Smith 938d9274352SBarry Smith Level: beginner 939d9274352SBarry Smith 940d9274352SBarry Smith .seealso: MatGetColoring() 941d9274352SBarry Smith E*/ 94249773a63SBarry Smith #define MatColoringType char* 943b12f92e5SBarry Smith #define MATCOLORING_NATURAL "natural" 944b12f92e5SBarry Smith #define MATCOLORING_SL "sl" 945b12f92e5SBarry Smith #define MATCOLORING_LF "lf" 946b12f92e5SBarry Smith #define MATCOLORING_ID "id" 947b12f92e5SBarry Smith 948be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetColoring(Mat,const MatColoringType,ISColoring*); 949be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatColoringRegister(const char[],const char[],const char[],PetscErrorCode(*)(Mat,const MatColoringType,ISColoring *)); 95030de9b25SBarry Smith 95130de9b25SBarry Smith /*MC 95230de9b25SBarry Smith MatColoringRegisterDynamic - Adds a new sparse matrix coloring to the 95330de9b25SBarry Smith matrix package. 95430de9b25SBarry Smith 95530de9b25SBarry Smith Synopsis: 956c1ac3661SBarry Smith PetscErrorCode MatColoringRegisterDynamic(char *name_coloring,char *path,char *name_create,PetscErrorCode (*routine_create)(MatColoring)) 95730de9b25SBarry Smith 95830de9b25SBarry Smith Not Collective 95930de9b25SBarry Smith 96030de9b25SBarry Smith Input Parameters: 96130de9b25SBarry Smith + sname - name of Coloring (for example MATCOLORING_SL) 96230de9b25SBarry Smith . path - location of library where creation routine is 96330de9b25SBarry Smith . name - name of function that creates the Coloring type, a string 96430de9b25SBarry Smith - function - function pointer that creates the coloring 96530de9b25SBarry Smith 96630de9b25SBarry Smith Level: developer 96730de9b25SBarry Smith 96830de9b25SBarry Smith If dynamic libraries are used, then the fourth input argument (function) 96930de9b25SBarry Smith is ignored. 97030de9b25SBarry Smith 97130de9b25SBarry Smith Sample usage: 97230de9b25SBarry Smith .vb 97330de9b25SBarry Smith MatColoringRegisterDynamic("my_color",/home/username/my_lib/lib/libO/solaris/mylib.a, 97430de9b25SBarry Smith "MyColor",MyColor); 97530de9b25SBarry Smith .ve 97630de9b25SBarry Smith 97730de9b25SBarry Smith Then, your partitioner can be chosen with the procedural interface via 97830de9b25SBarry Smith $ MatColoringSetType(part,"my_color") 97930de9b25SBarry Smith or at runtime via the option 98030de9b25SBarry Smith $ -mat_coloring_type my_color 98130de9b25SBarry Smith 982ab901514SBarry Smith $PETSC_ARCH occuring in pathname will be replaced with appropriate values. 98330de9b25SBarry Smith 98430de9b25SBarry Smith .keywords: matrix, Coloring, register 98530de9b25SBarry Smith 98630de9b25SBarry Smith .seealso: MatColoringRegisterDestroy(), MatColoringRegisterAll() 98730de9b25SBarry Smith M*/ 988aa482453SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 989f1af5d2fSBarry Smith #define MatColoringRegisterDynamic(a,b,c,d) MatColoringRegister(a,b,c,0) 990b12f92e5SBarry Smith #else 991f1af5d2fSBarry Smith #define MatColoringRegisterDynamic(a,b,c,d) MatColoringRegister(a,b,c,d) 992b12f92e5SBarry Smith #endif 99330de9b25SBarry Smith 9942bad1931SBarry Smith extern PetscTruth MatColoringRegisterAllCalled; 995f1144a30SSatish Balay 996be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatColoringRegisterAll(const char[]); 997be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatColoringRegisterDestroy(void); 998be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatColoringPatch(Mat,PetscInt,PetscInt,ISColoringValue[],ISColoring*); 999639f9d9dSBarry Smith 1000d9274352SBarry Smith /*S 1001d9274352SBarry Smith MatFDColoring - Object for computing a sparse Jacobian via finite differences 1002d9274352SBarry Smith and coloring 1003639f9d9dSBarry Smith 1004d9274352SBarry Smith Level: beginner 1005d9274352SBarry Smith 1006d9274352SBarry Smith Concepts: coloring, sparse Jacobian, finite differences 1007d9274352SBarry Smith 1008d9274352SBarry Smith .seealso: MatFDColoringCreate() 1009d9274352SBarry Smith S*/ 1010e2a1c21fSSatish Balay typedef struct _p_MatFDColoring *MatFDColoring; 1011639f9d9dSBarry Smith 1012be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFDColoringCreate(Mat,ISColoring,MatFDColoring *); 1013be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFDColoringDestroy(MatFDColoring); 1014be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFDColoringView(MatFDColoring,PetscViewer); 1015be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFDColoringSetFunction(MatFDColoring,PetscErrorCode (*)(void),void*); 1016be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFDColoringSetParameters(MatFDColoring,PetscReal,PetscReal); 1017be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFDColoringSetFrequency(MatFDColoring,PetscInt); 1018be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFDColoringGetFrequency(MatFDColoring,PetscInt*); 1019be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFDColoringSetFromOptions(MatFDColoring); 1020be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFDColoringApply(Mat,MatFDColoring,Vec,MatStructure*,void *); 1021be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFDColoringApplyTS(Mat,MatFDColoring,PetscReal,Vec,MatStructure*,void *); 1022be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFDColoringSetRecompute(MatFDColoring); 1023be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFDColoringSetF(MatFDColoring,Vec); 1024be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatFDColoringGetPerturbedColumns(MatFDColoring,PetscInt*,PetscInt*[]); 1025639f9d9dSBarry Smith /* 10260752156aSBarry Smith These routines are for partitioning matrices: currently used only 10273eda8832SBarry Smith for adjacency matrix, MatCreateMPIAdj(). 10280752156aSBarry Smith */ 1029ca161407SBarry Smith 1030d9274352SBarry Smith /*S 1031d9274352SBarry Smith MatPartitioning - Object for managing the partitioning of a matrix or graph 1032d9274352SBarry Smith 1033d9274352SBarry Smith Level: beginner 1034d9274352SBarry Smith 1035d9274352SBarry Smith Concepts: partitioning 1036d9274352SBarry Smith 1037743a1026Svictorle .seealso: MatPartitioningCreate(), MatPartitioningType 1038d9274352SBarry Smith S*/ 103991e9ee9fSBarry Smith typedef struct _p_MatPartitioning *MatPartitioning; 1040d9274352SBarry Smith 1041d9274352SBarry Smith /*E 10425bc6e7ccSvictorle MatPartitioningType - String with the name of a PETSc matrix partitioning or the creation function 1043d9274352SBarry Smith with an optional dynamic library name, for example 1044d9274352SBarry Smith http://www.mcs.anl.gov/petsc/lib.a:partitioningcreate() 1045d9274352SBarry Smith 1046d9274352SBarry Smith Level: beginner 1047d9274352SBarry Smith 1048b547a13bSvictorle .seealso: MatPartitioningCreate(), MatPartitioning 1049d9274352SBarry Smith E*/ 105049773a63SBarry Smith #define MatPartitioningType char* 10518ba1e511SMatthew Knepley #define MAT_PARTITIONING_CURRENT "current" 1052c2ec2a73SHong Zhang #define MAT_PARTITIONING_SQUARE "square" 10538ba1e511SMatthew Knepley #define MAT_PARTITIONING_PARMETIS "parmetis" 105471306c60Sjroman #define MAT_PARTITIONING_CHACO "chaco" 105571306c60Sjroman #define MAT_PARTITIONING_JOSTLE "jostle" 105671306c60Sjroman #define MAT_PARTITIONING_PARTY "party" 105771306c60Sjroman #define MAT_PARTITIONING_SCOTCH "scotch" 105871306c60Sjroman 1059ca161407SBarry Smith 1060be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningCreate(MPI_Comm,MatPartitioning*); 1061be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningSetType(MatPartitioning,const MatPartitioningType); 1062be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningSetNParts(MatPartitioning,PetscInt); 1063be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningSetAdjacency(MatPartitioning,Mat); 1064be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningSetVertexWeights(MatPartitioning,const PetscInt[]); 1065be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningSetPartitionWeights(MatPartitioning,const PetscReal []); 1066be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningApply(MatPartitioning,IS*); 1067be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningDestroy(MatPartitioning); 10682aabb6bbSBarry Smith 1069be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningRegister(const char[],const char[],const char[],PetscErrorCode (*)(MatPartitioning)); 107030de9b25SBarry Smith 107130de9b25SBarry Smith /*MC 107230de9b25SBarry Smith MatPartitioningRegisterDynamic - Adds a new sparse matrix partitioning to the 107330de9b25SBarry Smith matrix package. 107430de9b25SBarry Smith 107530de9b25SBarry Smith Synopsis: 1076c1ac3661SBarry Smith PetscErrorCode MatPartitioningRegisterDynamic(char *name_partitioning,char *path,char *name_create,PetscErrorCode (*routine_create)(MatPartitioning)) 107730de9b25SBarry Smith 107830de9b25SBarry Smith Not Collective 107930de9b25SBarry Smith 108030de9b25SBarry Smith Input Parameters: 108130de9b25SBarry Smith + sname - name of partitioning (for example MAT_PARTITIONING_CURRENT) or parmetis 108230de9b25SBarry Smith . path - location of library where creation routine is 108330de9b25SBarry Smith . name - name of function that creates the partitioning type, a string 108430de9b25SBarry Smith - function - function pointer that creates the partitioning type 108530de9b25SBarry Smith 108630de9b25SBarry Smith Level: developer 108730de9b25SBarry Smith 108830de9b25SBarry Smith If dynamic libraries are used, then the fourth input argument (function) 108930de9b25SBarry Smith is ignored. 109030de9b25SBarry Smith 109130de9b25SBarry Smith Sample usage: 109230de9b25SBarry Smith .vb 109330de9b25SBarry Smith MatPartitioningRegisterDynamic("my_part",/home/username/my_lib/lib/libO/solaris/mylib.a, 109430de9b25SBarry Smith "MyPartCreate",MyPartCreate); 109530de9b25SBarry Smith .ve 109630de9b25SBarry Smith 109730de9b25SBarry Smith Then, your partitioner can be chosen with the procedural interface via 109830de9b25SBarry Smith $ MatPartitioningSetType(part,"my_part") 109930de9b25SBarry Smith or at runtime via the option 110030de9b25SBarry Smith $ -mat_partitioning_type my_part 110130de9b25SBarry Smith 1102ab901514SBarry Smith $PETSC_ARCH occuring in pathname will be replaced with appropriate values. 110330de9b25SBarry Smith 110430de9b25SBarry Smith .keywords: matrix, partitioning, register 110530de9b25SBarry Smith 110630de9b25SBarry Smith .seealso: MatPartitioningRegisterDestroy(), MatPartitioningRegisterAll() 110730de9b25SBarry Smith M*/ 1108aa482453SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 1109f1af5d2fSBarry Smith #define MatPartitioningRegisterDynamic(a,b,c,d) MatPartitioningRegister(a,b,c,0) 11102aabb6bbSBarry Smith #else 1111f1af5d2fSBarry Smith #define MatPartitioningRegisterDynamic(a,b,c,d) MatPartitioningRegister(a,b,c,d) 11122aabb6bbSBarry Smith #endif 11132aabb6bbSBarry Smith 11142bad1931SBarry Smith extern PetscTruth MatPartitioningRegisterAllCalled; 1115f1144a30SSatish Balay 1116be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningRegisterAll(const char[]); 1117be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningRegisterDestroy(void); 11182bad1931SBarry Smith 1119be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningView(MatPartitioning,PetscViewer); 1120be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningSetFromOptions(MatPartitioning); 1121be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningGetType(MatPartitioning,MatPartitioningType*); 1122ca161407SBarry Smith 1123be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningParmetisSetCoarseSequential(MatPartitioning); 11240752156aSBarry Smith 1125be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningJostleSetCoarseLevel(MatPartitioning,PetscReal); 1126be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningJostleSetCoarseSequential(MatPartitioning); 112771306c60Sjroman 112871306c60Sjroman typedef enum { MP_CHACO_MULTILEVEL_KL, MP_CHACO_SPECTRAL, MP_CHACO_LINEAR, 112971306c60Sjroman MP_CHACO_RANDOM, MP_CHACO_SCATTERED } MPChacoGlobalType; 1130be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningChacoSetGlobal(MatPartitioning, MPChacoGlobalType); 113171306c60Sjroman typedef enum { MP_CHACO_KERNIGHAN_LIN, MP_CHACO_NONE } MPChacoLocalType; 1132be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningChacoSetLocal(MatPartitioning, MPChacoLocalType); 1133be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningChacoSetCoarseLevel(MatPartitioning,PetscReal); 113471306c60Sjroman typedef enum { MP_CHACO_LANCZOS, MP_CHACO_RQI_SYMMLQ } MPChacoEigenType; 1135be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningChacoSetEigenSolver(MatPartitioning,MPChacoEigenType); 1136be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningChacoSetEigenTol(MatPartitioning, PetscReal); 1137be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningChacoSetEigenNumber(MatPartitioning, PetscInt); 113871306c60Sjroman 113971306c60Sjroman #define MP_PARTY_OPT "opt" 114071306c60Sjroman #define MP_PARTY_LIN "lin" 114171306c60Sjroman #define MP_PARTY_SCA "sca" 114271306c60Sjroman #define MP_PARTY_RAN "ran" 114371306c60Sjroman #define MP_PARTY_GBF "gbf" 114471306c60Sjroman #define MP_PARTY_GCF "gcf" 114571306c60Sjroman #define MP_PARTY_BUB "bub" 114671306c60Sjroman #define MP_PARTY_DEF "def" 1147be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningPartySetGlobal(MatPartitioning, const char*); 114871306c60Sjroman #define MP_PARTY_HELPFUL_SETS "hs" 114971306c60Sjroman #define MP_PARTY_KERNIGHAN_LIN "kl" 115071306c60Sjroman #define MP_PARTY_NONE "no" 1151be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningPartySetLocal(MatPartitioning, const char*); 1152be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningPartySetCoarseLevel(MatPartitioning,PetscReal); 1153be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningPartySetBipart(MatPartitioning,PetscTruth); 1154be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningPartySetMatchOptimization(MatPartitioning,PetscTruth); 115571306c60Sjroman 115671306c60Sjroman typedef enum { MP_SCOTCH_GREEDY, MP_SCOTCH_GPS, MP_SCOTCH_GR_GPS } MPScotchGlobalType; 1157be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningScotchSetArch(MatPartitioning,const char*); 1158be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningScotchSetMultilevel(MatPartitioning); 1159be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningScotchSetGlobal(MatPartitioning,MPScotchGlobalType); 1160be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningScotchSetCoarseLevel(MatPartitioning,PetscReal); 1161be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningScotchSetHostList(MatPartitioning,const char*); 116271306c60Sjroman typedef enum { MP_SCOTCH_KERNIGHAN_LIN, MP_SCOTCH_NONE } MPScotchLocalType; 1163be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningScotchSetLocal(MatPartitioning,MPScotchLocalType); 1164be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningScotchSetMapping(MatPartitioning); 1165be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatPartitioningScotchSetStrategy(MatPartitioning,char*); 116671306c60Sjroman 11670752156aSBarry Smith /* 11680a835dfdSSatish Balay If you add entries here you must also add them to finclude/petscmat.h 1169d4fbbf0eSBarry Smith */ 11701c1c02c0SLois Curfman McInnes typedef enum { MATOP_SET_VALUES=0, 11711c1c02c0SLois Curfman McInnes MATOP_GET_ROW=1, 11721c1c02c0SLois Curfman McInnes MATOP_RESTORE_ROW=2, 11731c1c02c0SLois Curfman McInnes MATOP_MULT=3, 11741c1c02c0SLois Curfman McInnes MATOP_MULT_ADD=4, 11757c922b88SBarry Smith MATOP_MULT_TRANSPOSE=5, 11767c922b88SBarry Smith MATOP_MULT_TRANSPOSE_ADD=6, 11771c1c02c0SLois Curfman McInnes MATOP_SOLVE=7, 11781c1c02c0SLois Curfman McInnes MATOP_SOLVE_ADD=8, 11797c922b88SBarry Smith MATOP_SOLVE_TRANSPOSE=9, 11807c922b88SBarry Smith MATOP_SOLVE_TRANSPOSE_ADD=10, 11811c1c02c0SLois Curfman McInnes MATOP_LUFACTOR=11, 11821c1c02c0SLois Curfman McInnes MATOP_CHOLESKYFACTOR=12, 11831c1c02c0SLois Curfman McInnes MATOP_RELAX=13, 11841c1c02c0SLois Curfman McInnes MATOP_TRANSPOSE=14, 11851c1c02c0SLois Curfman McInnes MATOP_GETINFO=15, 11861c1c02c0SLois Curfman McInnes MATOP_EQUAL=16, 11871c1c02c0SLois Curfman McInnes MATOP_GET_DIAGONAL=17, 11881c1c02c0SLois Curfman McInnes MATOP_DIAGONAL_SCALE=18, 11891c1c02c0SLois Curfman McInnes MATOP_NORM=19, 11901c1c02c0SLois Curfman McInnes MATOP_ASSEMBLY_BEGIN=20, 11911c1c02c0SLois Curfman McInnes MATOP_ASSEMBLY_END=21, 11921c1c02c0SLois Curfman McInnes MATOP_COMPRESS=22, 11931c1c02c0SLois Curfman McInnes MATOP_SET_OPTION=23, 11941c1c02c0SLois Curfman McInnes MATOP_ZERO_ENTRIES=24, 11951c1c02c0SLois Curfman McInnes MATOP_ZERO_ROWS=25, 11961c1c02c0SLois Curfman McInnes MATOP_LUFACTOR_SYMBOLIC=26, 11971c1c02c0SLois Curfman McInnes MATOP_LUFACTOR_NUMERIC=27, 11981c1c02c0SLois Curfman McInnes MATOP_CHOLESKY_FACTOR_SYMBOLIC=28, 11991c1c02c0SLois Curfman McInnes MATOP_CHOLESKY_FACTOR_NUMERIC=29, 1200d643ce63SMatthew Knepley MATOP_SETUP_PREALLOCATION=30, 1201d643ce63SMatthew Knepley MATOP_ILUFACTOR_SYMBOLIC=31, 1202d643ce63SMatthew Knepley MATOP_ICCFACTOR_SYMBOLIC=32, 1203d643ce63SMatthew Knepley MATOP_GET_ARRAY=33, 1204d643ce63SMatthew Knepley MATOP_RESTORE_ARRAY=34, 1205d643ce63SMatthew Knepley MATOP_DUPLCIATE=35, 1206d643ce63SMatthew Knepley MATOP_FORWARD_SOLVE=36, 1207d643ce63SMatthew Knepley MATOP_BACKWARD_SOLVE=37, 1208d643ce63SMatthew Knepley MATOP_ILUFACTOR=38, 1209d643ce63SMatthew Knepley MATOP_ICCFACTOR=39, 1210d643ce63SMatthew Knepley MATOP_AXPY=40, 1211d643ce63SMatthew Knepley MATOP_GET_SUBMATRICES=41, 1212d643ce63SMatthew Knepley MATOP_INCREASE_OVERLAP=42, 1213d643ce63SMatthew Knepley MATOP_GET_VALUES=43, 1214d643ce63SMatthew Knepley MATOP_COPY=44, 1215d643ce63SMatthew Knepley MATOP_PRINT_HELP=45, 1216d643ce63SMatthew Knepley MATOP_SCALE=46, 1217d643ce63SMatthew Knepley MATOP_SHIFT=47, 1218d643ce63SMatthew Knepley MATOP_DIAGONAL_SHIFT=48, 1219d643ce63SMatthew Knepley MATOP_ILUDT_FACTOR=49, 1220d643ce63SMatthew Knepley MATOP_GET_BLOCK_SIZE=50, 1221d643ce63SMatthew Knepley MATOP_GET_ROW_IJ=51, 1222d643ce63SMatthew Knepley MATOP_RESTORE_ROW_IJ=52, 1223d643ce63SMatthew Knepley MATOP_GET_COLUMN_IJ=53, 1224d643ce63SMatthew Knepley MATOP_RESTORE_COLUMN_IJ=54, 1225d643ce63SMatthew Knepley MATOP_FDCOLORING_CREATE=55, 1226d643ce63SMatthew Knepley MATOP_COLORING_PATCH=56, 1227d643ce63SMatthew Knepley MATOP_SET_UNFACTORED=57, 1228d643ce63SMatthew Knepley MATOP_PERMUTE=58, 1229d643ce63SMatthew Knepley MATOP_SET_VALUES_BLOCKED=59, 1230d643ce63SMatthew Knepley MATOP_GET_SUBMATRIX=60, 1231d643ce63SMatthew Knepley MATOP_DESTROY=61, 1232d643ce63SMatthew Knepley MATOP_VIEW=62, 1233d643ce63SMatthew Knepley MATOP_GET_MAPS=63, 1234d643ce63SMatthew Knepley MATOP_USE_SCALED_FORM=64, 1235d643ce63SMatthew Knepley MATOP_SCALE_SYSTEM=65, 1236d643ce63SMatthew Knepley MATOP_UNSCALE_SYSTEM=66, 1237ba16a8cbSKris Buschelman MATOP_SET_LOCAL_TO_GLOBAL_MAP=67, 1238d643ce63SMatthew Knepley MATOP_SET_VALUES_LOCAL=68, 1239d643ce63SMatthew Knepley MATOP_ZERO_ROWS_LOCAL=69, 1240d643ce63SMatthew Knepley MATOP_GET_ROW_MAX=70, 1241d643ce63SMatthew Knepley MATOP_CONVERT=71, 1242d643ce63SMatthew Knepley MATOP_SET_COLORING=72, 1243d643ce63SMatthew Knepley MATOP_SET_VALUES_ADIC=73, 1244d643ce63SMatthew Knepley MATOP_SET_VALUES_ADIFOR=74, 1245d643ce63SMatthew Knepley MATOP_FD_COLORING_APPLY=75, 1246d643ce63SMatthew Knepley MATOP_SET_FROM_OPTIONS=76, 1247ba16a8cbSKris Buschelman MATOP_MULT_CON=77, 1248ba16a8cbSKris Buschelman MATOP_MULT_TRANSPOSE_CON=78, 1249ba16a8cbSKris Buschelman MATOP_ILU_FACTOR_SYMBOLIC_CON=79, 1250d643ce63SMatthew Knepley MATOP_PERMUTE_SPARSIFY=80, 1251d643ce63SMatthew Knepley MATOP_MULT_MULTIPLE=81, 125241acf15aSKris Buschelman MATOP_SOLVE_MULTIPLE=82, 125341acf15aSKris Buschelman MATOP_GET_INERTIA=83, 125441acf15aSKris Buschelman MATOP_LOAD=84, 125541acf15aSKris Buschelman MATOP_IS_SYMMETRIC=85, 125641acf15aSKris Buschelman MATOP_IS_HERMITIAN=86, 125741acf15aSKris Buschelman MATOP_IS_STRUCTURALLY_SYMMETRIC=87, 125841acf15aSKris Buschelman MATOP_PB_RELAX=88, 125941acf15aSKris Buschelman MATOP_GET_VECS=89, 126041acf15aSKris Buschelman MATOP_MAT_MULT=90, 126141acf15aSKris Buschelman MATOP_MAT_MULT_SYMBOLIC=91, 126241acf15aSKris Buschelman MATOP_MAT_MULT_NUMERIC=92, 126341acf15aSKris Buschelman MATOP_PTAP=93, 126441acf15aSKris Buschelman MATOP_PTAP_SYMBOLIC=94, 1265bc011b1eSHong Zhang MATOP_PTAP_NUMERIC=95, 1266bc011b1eSHong Zhang MATOP_MAT_MULTTRANSPOSE=96, 1267bc011b1eSHong Zhang MATOP_MAT_MULTTRANSPOSE_SYMBOLIC=97, 12687ba1a0bfSKris Buschelman MATOP_MAT_MULTTRANSPOSE_NUMERIC=98, 12697ba1a0bfSKris Buschelman MATOP_PTAP_SYMBOLIC_SEQAIJ=99, 12707ba1a0bfSKris Buschelman MATOP_PTAP_NUMERIC_SEQAIJ=100, 12717ba1a0bfSKris Buschelman MATOP_PTAP_SYMBOLIC_MPIAIJ=101, 12727ba1a0bfSKris Buschelman MATOP_PTAP_NUMERIC_MPIAIJ=102 1273fae171e0SBarry Smith } MatOperation; 1274be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatHasOperation(Mat,MatOperation,PetscTruth*); 1275be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatShellSetOperation(Mat,MatOperation,void(*)(void)); 1276be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatShellGetOperation(Mat,MatOperation,void(**)(void)); 1277be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatShellSetContext(Mat,void*); 1278112a2221SBarry Smith 127990ace30eSBarry Smith /* 128090ace30eSBarry Smith Codes for matrices stored on disk. By default they are 128190ace30eSBarry Smith stored in a universal format. By changing the format with 1282fb9695e5SSatish Balay PetscViewerSetFormat(viewer,PETSC_VIEWER_BINARY_NATIVE); the matrices will 128390ace30eSBarry Smith be stored in a way natural for the matrix, for example dense matrices 128490ace30eSBarry Smith would be stored as dense. Matrices stored this way may only be 128590ace30eSBarry Smith read into matrices of the same time. 128690ace30eSBarry Smith */ 128790ace30eSBarry Smith #define MATRIX_BINARY_FORMAT_DENSE -1 128890ace30eSBarry Smith 1289be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPIBAIJSetHashTableFactor(Mat,PetscReal); 1290be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPIRowbsGetColor(Mat,ISColoring *); 1291860d1616SSatish Balay 1292be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatISGetLocalMat(Mat,Mat*); 12931f4e1ec7SBarry Smith 1294d9274352SBarry Smith /*S 1295d9274352SBarry Smith MatNullSpace - Object that removes a null space from a vector, i.e. 1296d9274352SBarry Smith orthogonalizes the vector to a subsapce 1297d9274352SBarry Smith 1298f7a9e4ceSBarry Smith Level: advanced 1299d9274352SBarry Smith 1300d9274352SBarry Smith Concepts: matrix; linear operator, null space 1301d9274352SBarry Smith 13026e1639daSBarry Smith Users manual sections: 13036e1639daSBarry Smith . sec_singular 13046e1639daSBarry Smith 1305d9274352SBarry Smith .seealso: MatNullSpaceCreate() 1306d9274352SBarry Smith S*/ 130774637425SBarry Smith typedef struct _p_MatNullSpace* MatNullSpace; 1308d9274352SBarry Smith 1309be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatNullSpaceCreate(MPI_Comm,PetscTruth,PetscInt,const Vec[],MatNullSpace*); 1310be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatNullSpaceDestroy(MatNullSpace); 1311be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatNullSpaceRemove(MatNullSpace,Vec,Vec*); 1312be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatNullSpaceAttach(Mat,MatNullSpace); 1313be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatNullSpaceTest(MatNullSpace,Mat); 131474637425SBarry Smith 1315be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatReorderingSeqSBAIJ(Mat,IS); 1316be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMPISBAIJSetHashTableFactor(Mat,PetscReal); 1317be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSeqSBAIJSetColumnIndices(Mat,PetscInt *); 1318*46129b97SKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatSeqBAIJInvertBlockDiagonal(Mat); 13193f1d51d7SBarry Smith 1320be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatCreateMAIJ(Mat,PetscInt,Mat*); 1321be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMAIJRedimension(Mat,PetscInt,Mat*); 1322be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatMAIJGetAIJ(Mat,Mat*); 1323c4f061fbSSatish Balay 1324be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatComputeExplicitOperator(Mat,Mat*); 1325b0a32e0cSBarry Smith 1326be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatDiagonalScaleLocal(Mat,Vec); 132704f1ad80SBarry Smith 1328be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT PetscViewerMathematicaPutMatrix(PetscViewer, PetscInt, PetscInt, PetscReal *); 1329be1d678aSKris Buschelman EXTERN PetscErrorCode PETSCMAT_DLLEXPORT PetscViewerMathematicaPutCSRMatrix(PetscViewer, PetscInt, PetscInt, PetscInt *, PetscInt *, PetscReal *); 13307dbadf16SMatthew Knepley 1331e9fa29b7SSatish Balay PETSC_EXTERN_CXX_END 13322eac72dbSBarry Smith #endif 1333