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)); 82273d9f13SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 83273d9f13SBarry Smith #define MatRegisterDynamic(a,b,c,d) MatRegister(a,b,c,0) 84c06d978dSMatthew Knepley #define MatSerializeRegisterDynamic(a,b,c,d) MatSerializeRegister(a,b,c,0) 85273d9f13SBarry Smith #else 86273d9f13SBarry Smith #define MatRegisterDynamic(a,b,c,d) MatRegister(a,b,c,d) 87c06d978dSMatthew Knepley #define MatSerializeRegisterDynamic(a,b,c,d) MatSerializeRegister(a,b,c,d) 88273d9f13SBarry Smith #endif 89273d9f13SBarry Smith extern PetscTruth MatRegisterAllCalled; 90b0a32e0cSBarry Smith extern PetscFList MatList; 9128988994SBarry Smith 92c06d978dSMatthew Knepley EXTERN PetscFList MatSerializeList; 93c06d978dSMatthew Knepley EXTERN int MatSerializeRegisterAll(const char []); 9465804fbbSSatish Balay EXTERN int MatSerializeRegisterDestroy(void); 95c06d978dSMatthew Knepley EXTERN int MatSerializeRegisterAllCalled; 96c06d978dSMatthew Knepley EXTERN int MatSerialize(MPI_Comm, Mat *, PetscViewer, PetscTruth); 97c06d978dSMatthew Knepley EXTERN int MatSetSerializeType(Mat, MatSerializeType); 98c06d978dSMatthew Knepley 9987828ca2SBarry Smith EXTERN int MatCreateSeqDense(MPI_Comm,int,int,PetscScalar*,Mat*); 10087828ca2SBarry Smith EXTERN int MatCreateMPIDense(MPI_Comm,int,int,int,int,PetscScalar*,Mat*); 101ca44d042SBarry Smith EXTERN int MatCreateSeqAIJ(MPI_Comm,int,int,int,int*,Mat*); 102ca44d042SBarry Smith EXTERN int MatCreateMPIAIJ(MPI_Comm,int,int,int,int,int,int*,int,int*,Mat*); 103c4f061fbSSatish Balay EXTERN int MatCreateMPIRowbs(MPI_Comm,int,int,int,int*,Mat*); 10487828ca2SBarry Smith EXTERN int MatCreateSeqBDiag(MPI_Comm,int,int,int,int,int*,PetscScalar**,Mat*); 10587828ca2SBarry Smith EXTERN int MatCreateMPIBDiag(MPI_Comm,int,int,int,int,int,int*,PetscScalar**,Mat*); 106ca44d042SBarry Smith EXTERN int MatCreateSeqBAIJ(MPI_Comm,int,int,int,int,int*,Mat*); 107ca44d042SBarry Smith EXTERN int MatCreateMPIBAIJ(MPI_Comm,int,int,int,int,int,int,int*,int,int*,Mat*); 108ca44d042SBarry Smith EXTERN int MatCreateMPIAdj(MPI_Comm,int,int,int*,int*,int *,Mat*); 109ca44d042SBarry Smith EXTERN int MatCreateSeqSBAIJ(MPI_Comm,int,int,int,int,int*,Mat*); 110ca44d042SBarry Smith EXTERN int MatCreateMPISBAIJ(MPI_Comm,int,int,int,int,int,int,int*,int,int*,Mat*); 111ca44d042SBarry Smith EXTERN int MatCreateShell(MPI_Comm,int,int,int,int,void *,Mat*); 1123a7fca6bSBarry Smith EXTERN int MatCreateAdic(MPI_Comm,int,int,int,int,int,void (*)(void),Mat*); 113c8a8475eSBarry Smith EXTERN int MatCreateNormal(Mat,Mat*); 114435da068SBarry Smith EXTERN int MatDestroy(Mat); 11521c89e3eSBarry Smith 116ca44d042SBarry Smith EXTERN int MatPrintHelp(Mat); 1178a124369SBarry Smith EXTERN int MatGetPetscMaps(Mat,PetscMap*,PetscMap*); 118ec0117caSBarry Smith 1198ed539a5SBarry Smith /* ------------------------------------------------------------*/ 12087828ca2SBarry Smith EXTERN int MatSetValues(Mat,int,int*,int,int*,PetscScalar*,InsertMode); 12187828ca2SBarry Smith EXTERN int MatSetValuesBlocked(Mat,int,int*,int,int*,PetscScalar*,InsertMode); 12284cb2905SBarry Smith 1232ef4de8bSBarry Smith /*S 1242ef4de8bSBarry Smith MatStencil - Data structure (C struct) for storing information about a single row or 1252ef4de8bSBarry Smith column of a matrix as index on an associated grid. 1262ef4de8bSBarry Smith 1272ef4de8bSBarry Smith Level: beginner 1282ef4de8bSBarry Smith 1292ef4de8bSBarry Smith Concepts: matrix; linear operator 1302ef4de8bSBarry Smith 1312ef4de8bSBarry Smith .seealso: MatSetValuesStencil(), MatSetStencil() 1322ef4de8bSBarry Smith S*/ 133435da068SBarry Smith typedef struct { 134435da068SBarry Smith int k,j,i,c; 135435da068SBarry Smith } MatStencil; 1362ef4de8bSBarry Smith 13787828ca2SBarry Smith EXTERN int MatSetValuesStencil(Mat,int,MatStencil*,int,MatStencil*,PetscScalar*,InsertMode); 13887828ca2SBarry Smith EXTERN int MatSetValuesBlockedStencil(Mat,int,MatStencil*,int,MatStencil*,PetscScalar*,InsertMode); 139435da068SBarry Smith EXTERN int MatSetStencil(Mat,int,int*,int*,int); 140435da068SBarry Smith 1413a7fca6bSBarry Smith EXTERN int MatSetColoring(Mat,ISColoring); 1423a7fca6bSBarry Smith EXTERN int MatSetValuesAdic(Mat,void*); 1433a7fca6bSBarry Smith EXTERN int MatSetValuesAdifor(Mat,int,void*); 1443a7fca6bSBarry Smith 145d91e6319SBarry Smith /*E 146d91e6319SBarry Smith MatAssemblyType - Indicates if the matrix is now to be used, or if you plan 147d91e6319SBarry Smith to continue to add values to it 148d91e6319SBarry Smith 149d91e6319SBarry Smith Level: beginner 150d91e6319SBarry Smith 151d91e6319SBarry Smith .seealso: MatAssemblyBegin(), MatAssemblyEnd() 152d91e6319SBarry Smith E*/ 1536d4a8577SBarry Smith typedef enum {MAT_FLUSH_ASSEMBLY=1,MAT_FINAL_ASSEMBLY=0} MatAssemblyType; 154ca44d042SBarry Smith EXTERN int MatAssemblyBegin(Mat,MatAssemblyType); 155ca44d042SBarry Smith EXTERN int MatAssemblyEnd(Mat,MatAssemblyType); 156ca44d042SBarry Smith EXTERN int MatAssembled(Mat,PetscTruth*); 1574f9c727eSBarry Smith 158b951964fSBarry Smith #define MatSetValue(v,i,j,va,mode) \ 159ea709b57SSatish Balay 0; {int _ierr,_row = i,_col = j; PetscScalar _va = va; \ 160b951964fSBarry Smith _ierr = MatSetValues(v,1,&_row,1,&_col,&_va,mode);CHKERRQ(_ierr); \ 161b951964fSBarry Smith } 162ea06a074SBarry Smith #define MatGetValue(v,i,j,va) \ 163d91e6319SBarry Smith 0; {int _ierr,_row = i,_col = j; \ 164ea06a074SBarry Smith _ierr = MatGetValues(v,1,&_row,1,&_col,&va);CHKERRQ(_ierr); \ 165ea06a074SBarry Smith } 166d91e6319SBarry Smith #define MatSetValueLocal(v,i,j,va,mode) \ 167ea709b57SSatish Balay 0; {int _ierr,_row = i,_col = j; PetscScalar _va = va; \ 168d91e6319SBarry Smith _ierr = MatSetValuesLocal(v,1,&_row,1,&_col,&_va,mode);CHKERRQ(_ierr); \ 169d91e6319SBarry Smith } 170d91e6319SBarry Smith /*E 171d91e6319SBarry Smith MatOption - Options that may be set for a matrix and its behavior or storage 172d91e6319SBarry Smith 173d91e6319SBarry Smith Level: beginner 174d91e6319SBarry Smith 1750a835dfdSSatish Balay Any additions/changes here MUST also be made in include/finclude/petscmat.h 176d91e6319SBarry Smith 177d91e6319SBarry Smith .seealso: MatSetOption() 178d91e6319SBarry Smith E*/ 1796d4a8577SBarry Smith typedef enum {MAT_ROW_ORIENTED=1,MAT_COLUMN_ORIENTED=2,MAT_ROWS_SORTED=4, 1806d4a8577SBarry Smith MAT_COLUMNS_SORTED=8,MAT_NO_NEW_NONZERO_LOCATIONS=16, 1816d4a8577SBarry Smith MAT_YES_NEW_NONZERO_LOCATIONS=32,MAT_SYMMETRIC=64, 1826ca9ecd3SBarry Smith MAT_STRUCTURALLY_SYMMETRIC=65,MAT_NO_NEW_DIAGONALS=66, 1836ca9ecd3SBarry Smith MAT_YES_NEW_DIAGONALS=67,MAT_INODE_LIMIT_1=68,MAT_INODE_LIMIT_2=69, 1846ca9ecd3SBarry Smith MAT_INODE_LIMIT_3=70,MAT_INODE_LIMIT_4=71,MAT_INODE_LIMIT_5=72, 1856ca9ecd3SBarry Smith MAT_IGNORE_OFF_PROC_ENTRIES=73,MAT_ROWS_UNSORTED=74, 1864787f768SSatish Balay MAT_COLUMNS_UNSORTED=75,MAT_NEW_NONZERO_LOCATION_ERR=76, 1877c922b88SBarry Smith MAT_NEW_NONZERO_ALLOCATION_ERR=77,MAT_USE_HASH_TABLE=78, 1882bad1931SBarry Smith MAT_KEEP_ZEROED_ROWS=79,MAT_IGNORE_ZERO_ENTRIES=80,MAT_USE_INODES=81, 189123145dfSKris Buschelman MAT_DO_NOT_USE_INODES=82} MatOption; 190ca44d042SBarry Smith EXTERN int MatSetOption(Mat,MatOption); 191273d9f13SBarry Smith EXTERN int MatGetType(Mat,MatType*); 19284cb2905SBarry Smith 19387828ca2SBarry Smith EXTERN int MatGetValues(Mat,int,int*,int,int*,PetscScalar*); 19487828ca2SBarry Smith EXTERN int MatGetRow(Mat,int,int *,int **,PetscScalar**); 19587828ca2SBarry Smith EXTERN int MatRestoreRow(Mat,int,int *,int **,PetscScalar**); 19687828ca2SBarry Smith EXTERN int MatGetColumn(Mat,int,int *,int **,PetscScalar**); 19787828ca2SBarry Smith EXTERN int MatRestoreColumn(Mat,int,int *,int **,PetscScalar**); 198ca44d042SBarry Smith EXTERN int MatGetColumnVector(Mat,Vec,int); 19987828ca2SBarry Smith EXTERN int MatGetArray(Mat,PetscScalar **); 20087828ca2SBarry Smith EXTERN int MatRestoreArray(Mat,PetscScalar **); 201ca44d042SBarry Smith EXTERN int MatGetBlockSize(Mat,int *); 2027b80b807SBarry Smith 203ca44d042SBarry Smith EXTERN int MatMult(Mat,Vec,Vec); 204ca44d042SBarry Smith EXTERN int MatMultAdd(Mat,Vec,Vec,Vec); 205ca44d042SBarry Smith EXTERN int MatMultTranspose(Mat,Vec,Vec); 206ca44d042SBarry Smith EXTERN int MatMultTransposeAdd(Mat,Vec,Vec,Vec); 207c06d978dSMatthew Knepley EXTERN int MatMultConstrained(Mat,Vec,Vec); 2086d0dc95fSMatthew Knepley EXTERN int MatMultTransposeConstrained(Mat,Vec,Vec); 2092eac72dbSBarry Smith 210d91e6319SBarry Smith /*E 211d91e6319SBarry Smith MatDuplicateOption - Indicates if a duplicated sparse matrix should have 212d91e6319SBarry Smith its numerical values copied over or just its nonzero structure. 213d91e6319SBarry Smith 214d91e6319SBarry Smith Level: beginner 215d91e6319SBarry Smith 216d91e6319SBarry Smith Any additions/changes here MUST also be made in include/finclude/petscmat.h 217d91e6319SBarry Smith 218d91e6319SBarry Smith .seealso: MatDuplicate() 219d91e6319SBarry Smith E*/ 2202e8a6d31SBarry Smith typedef enum {MAT_DO_NOT_COPY_VALUES,MAT_COPY_VALUES} MatDuplicateOption; 2212e8a6d31SBarry Smith 222273d9f13SBarry Smith EXTERN int MatConvertRegister(char*,char*,char*,int (*)(Mat,MatType,Mat*)); 223273d9f13SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 224273d9f13SBarry Smith #define MatConvertRegisterDynamic(a,b,c,d) MatConvertRegister(a,b,c,0) 225273d9f13SBarry Smith #else 226273d9f13SBarry Smith #define MatConvertRegisterDynamic(a,b,c,d) MatConvertRegister(a,b,c,d) 227273d9f13SBarry Smith #endif 228273d9f13SBarry Smith EXTERN int MatConvertRegisterAll(char*); 229273d9f13SBarry Smith EXTERN int MatConvertRegisterDestroy(void); 230273d9f13SBarry Smith extern PetscTruth MatConvertRegisterAllCalled; 231b0a32e0cSBarry Smith extern PetscFList MatConvertList; 232ca44d042SBarry Smith EXTERN int MatConvert(Mat,MatType,Mat*); 233ca44d042SBarry Smith EXTERN int MatDuplicate(Mat,MatDuplicateOption,Mat*); 23494a9d846SBarry Smith 235d91e6319SBarry Smith /*E 236d91e6319SBarry Smith MatStructure - Indicates if the matrix has the same nonzero structure 237d91e6319SBarry Smith 238d91e6319SBarry Smith Level: beginner 239d91e6319SBarry Smith 240d91e6319SBarry Smith Any additions/changes here MUST also be made in include/finclude/petscmat.h 241d91e6319SBarry Smith 242d91e6319SBarry Smith .seealso: MatCopy(), SLESSetOperators(), PCSetOperators() 243d91e6319SBarry Smith E*/ 244cb5b572fSBarry Smith typedef enum {SAME_NONZERO_PATTERN,DIFFERENT_NONZERO_PATTERN,SAME_PRECONDITIONER} MatStructure; 245cb5b572fSBarry Smith 246ca44d042SBarry Smith EXTERN int MatCopy(Mat,Mat,MatStructure); 247b0a32e0cSBarry Smith EXTERN int MatView(Mat,PetscViewer); 248273d9f13SBarry Smith 249b0a32e0cSBarry Smith EXTERN int MatLoadRegister(char*,char*,char*,int (*)(PetscViewer,MatType,Mat*)); 250273d9f13SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 251273d9f13SBarry Smith #define MatLoadRegisterDynamic(a,b,c,d) MatLoadRegister(a,b,c,0) 252273d9f13SBarry Smith #else 253273d9f13SBarry Smith #define MatLoadRegisterDynamic(a,b,c,d) MatLoadRegister(a,b,c,d) 254273d9f13SBarry Smith #endif 255273d9f13SBarry Smith EXTERN int MatLoadRegisterAll(char*); 256273d9f13SBarry Smith EXTERN int MatLoadRegisterDestroy(void); 257273d9f13SBarry Smith extern PetscTruth MatLoadRegisterAllCalled; 258b0a32e0cSBarry Smith extern PetscFList MatLoadList; 259b0a32e0cSBarry Smith EXTERN int MatLoad(PetscViewer,MatType,Mat*); 26051dd7536SBarry Smith EXTERN int MatMerge(MPI_Comm,Mat,Mat*); 2617b80b807SBarry Smith 262ca44d042SBarry Smith EXTERN int MatGetRowIJ(Mat,int,PetscTruth,int*,int **,int **,PetscTruth *); 263ca44d042SBarry Smith EXTERN int MatRestoreRowIJ(Mat,int,PetscTruth,int *,int **,int **,PetscTruth *); 264ca44d042SBarry Smith EXTERN int MatGetColumnIJ(Mat,int,PetscTruth,int*,int **,int **,PetscTruth *); 265ca44d042SBarry Smith EXTERN int MatRestoreColumnIJ(Mat,int,PetscTruth,int *,int **,int **,PetscTruth *); 266d4fbbf0eSBarry Smith 267d91e6319SBarry Smith /*S 268d91e6319SBarry Smith MatInfo - Context of matrix information, used with MatGetInfo() 269d91e6319SBarry Smith 270d91e6319SBarry Smith In Fortran this is simply a double precision array of dimension MAT_INFO_SIZE 271d91e6319SBarry Smith 272d91e6319SBarry Smith Level: intermediate 273d91e6319SBarry Smith 274d91e6319SBarry Smith Concepts: matrix^nonzero information 275d91e6319SBarry Smith 276d9274352SBarry Smith .seealso: MatGetInfo(), MatInfoType 277d91e6319SBarry Smith S*/ 2784e220ebcSLois Curfman McInnes typedef struct { 279b0a32e0cSBarry Smith PetscLogDouble rows_global,columns_global; /* number of global rows and columns */ 280b0a32e0cSBarry Smith PetscLogDouble rows_local,columns_local; /* number of local rows and columns */ 281b0a32e0cSBarry Smith PetscLogDouble block_size; /* block size */ 282b0a32e0cSBarry Smith PetscLogDouble nz_allocated,nz_used,nz_unneeded; /* number of nonzeros */ 283b0a32e0cSBarry Smith PetscLogDouble memory; /* memory allocated */ 284b0a32e0cSBarry Smith PetscLogDouble assemblies; /* number of matrix assemblies called */ 285b0a32e0cSBarry Smith PetscLogDouble mallocs; /* number of mallocs during MatSetValues() */ 286b0a32e0cSBarry Smith PetscLogDouble fill_ratio_given,fill_ratio_needed; /* fill ratio for LU/ILU */ 287b0a32e0cSBarry Smith PetscLogDouble factor_mallocs; /* number of mallocs during factorization */ 2884e220ebcSLois Curfman McInnes } MatInfo; 2894e220ebcSLois Curfman McInnes 290d9274352SBarry Smith /*E 291d9274352SBarry Smith MatInfoType - Indicates if you want information about the local part of the matrix, 292d9274352SBarry Smith the entire parallel matrix or the maximum over all the local parts. 293d9274352SBarry Smith 294d9274352SBarry Smith Level: beginner 295d9274352SBarry Smith 296d9274352SBarry Smith Any additions/changes here MUST also be made in include/finclude/petscmat.h 297d9274352SBarry Smith 298d9274352SBarry Smith .seealso: MatGetInfo(), MatInfo 299d9274352SBarry Smith E*/ 3007b80b807SBarry Smith typedef enum {MAT_LOCAL=1,MAT_GLOBAL_MAX=2,MAT_GLOBAL_SUM=3} MatInfoType; 301ca44d042SBarry Smith EXTERN int MatGetInfo(Mat,MatInfoType,MatInfo*); 302ca44d042SBarry Smith EXTERN int MatValid(Mat,PetscTruth*); 303ca44d042SBarry Smith EXTERN int MatGetDiagonal(Mat,Vec); 304273d9f13SBarry Smith EXTERN int MatGetRowMax(Mat,Vec); 305ca44d042SBarry Smith EXTERN int MatTranspose(Mat,Mat*); 306ca44d042SBarry Smith EXTERN int MatPermute(Mat,IS,IS,Mat *); 307bf1d55d4SSatish Balay EXTERN int MatPermuteSparsify(Mat,int,PetscReal,PetscReal,IS,IS,Mat *); 308ca44d042SBarry Smith EXTERN int MatDiagonalScale(Mat,Vec,Vec); 30906ef90c2SBarry Smith EXTERN int MatDiagonalSet(Mat,Vec,InsertMode); 310ca44d042SBarry Smith EXTERN int MatEqual(Mat,Mat,PetscTruth*); 3117b80b807SBarry Smith 31287828ca2SBarry Smith EXTERN int MatNorm(Mat,NormType,PetscReal *); 313ca44d042SBarry Smith EXTERN int MatZeroEntries(Mat); 31487828ca2SBarry Smith EXTERN int MatZeroRows(Mat,IS,PetscScalar*); 31587828ca2SBarry Smith EXTERN int MatZeroColumns(Mat,IS,PetscScalar*); 3167b80b807SBarry Smith 317ca44d042SBarry Smith EXTERN int MatUseScaledForm(Mat,PetscTruth); 318ca44d042SBarry Smith EXTERN int MatScaleSystem(Mat,Vec,Vec); 319ca44d042SBarry Smith EXTERN int MatUnScaleSystem(Mat,Vec,Vec); 3205ef9f2a5SBarry Smith 321ca44d042SBarry Smith EXTERN int MatGetSize(Mat,int*,int*); 322ca44d042SBarry Smith EXTERN int MatGetLocalSize(Mat,int*,int*); 323ca44d042SBarry Smith EXTERN int MatGetOwnershipRange(Mat,int*,int*); 3247b80b807SBarry Smith 325d91e6319SBarry Smith /*E 326d91e6319SBarry Smith MatReuse - Indicates if matrices obtained from a previous call to MatGetSubMatrices() 327d91e6319SBarry Smith or MatGetSubMatrix() are to be reused to store the new matrix values. 328d91e6319SBarry Smith 329d91e6319SBarry Smith Level: beginner 330d91e6319SBarry Smith 331d91e6319SBarry Smith Any additions/changes here MUST also be made in include/finclude/petscmat.h 332d91e6319SBarry Smith 333d91e6319SBarry Smith .seealso: MatGetSubMatrices(), MatGetSubMatrix(), MatDestroyMatrices() 334d91e6319SBarry Smith E*/ 3357b2a1423SBarry Smith typedef enum {MAT_INITIAL_MATRIX,MAT_REUSE_MATRIX} MatReuse; 336ca44d042SBarry Smith EXTERN int MatGetSubMatrices(Mat,int,IS *,IS *,MatReuse,Mat **); 337ca44d042SBarry Smith EXTERN int MatDestroyMatrices(int,Mat **); 338ca44d042SBarry Smith EXTERN int MatGetSubMatrix(Mat,IS,IS,int,MatReuse,Mat *); 3398efafbd8SBarry Smith 340ca44d042SBarry Smith EXTERN int MatIncreaseOverlap(Mat,int,IS *,int); 3417b80b807SBarry Smith 342607cd303SBarry Smith EXTERN int MatAXPY(PetscScalar *,Mat,Mat,MatStructure); 34387828ca2SBarry Smith EXTERN int MatAYPX(PetscScalar *,Mat,Mat); 344ca44d042SBarry Smith EXTERN int MatCompress(Mat); 3457b80b807SBarry Smith 34687828ca2SBarry Smith EXTERN int MatScale(PetscScalar *,Mat); 34787828ca2SBarry Smith EXTERN int MatShift(PetscScalar *,Mat); 348052efed2SBarry Smith 349ca44d042SBarry Smith EXTERN int MatSetLocalToGlobalMapping(Mat,ISLocalToGlobalMapping); 350ca44d042SBarry Smith EXTERN int MatSetLocalToGlobalMappingBlock(Mat,ISLocalToGlobalMapping); 35187828ca2SBarry Smith EXTERN int MatZeroRowsLocal(Mat,IS,PetscScalar*); 35287828ca2SBarry Smith EXTERN int MatSetValuesLocal(Mat,int,int*,int,int*,PetscScalar*,InsertMode); 35387828ca2SBarry Smith EXTERN int MatSetValuesBlockedLocal(Mat,int,int*,int,int*,PetscScalar*,InsertMode); 35490f02eecSBarry Smith 355ca44d042SBarry Smith EXTERN int MatSetStashInitialSize(Mat,int,int); 356649db694SBarry Smith 357ca44d042SBarry Smith EXTERN int MatInterpolateAdd(Mat,Vec,Vec,Vec); 358ca44d042SBarry Smith EXTERN int MatInterpolate(Mat,Vec,Vec); 359ca44d042SBarry Smith EXTERN int MatRestrict(Mat,Vec,Vec); 3607c922b88SBarry Smith 3617c922b88SBarry Smith /* 362c4f061fbSSatish Balay These three (or four) macros MUST be used together. The third one closes the open { of the first one 3637c922b88SBarry Smith */ 364c4f061fbSSatish Balay #define MatPreallocateInitialize(comm,nrows,ncols,dnz,onz) 0; \ 3657c922b88SBarry Smith { \ 366ef66eb69SBarry Smith int _4_ierr,__tmp = (nrows),__ctmp = (ncols),__rstart,__start,__end; \ 367ef66eb69SBarry Smith _4_ierr = PetscMalloc(2*__tmp*sizeof(int),&dnz);CHKERRQ(_4_ierr);onz = dnz + __tmp;\ 368ef66eb69SBarry Smith _4_ierr = PetscMemzero(dnz,2*__tmp*sizeof(int));CHKERRQ(_4_ierr);\ 369ef66eb69SBarry Smith _4_ierr = MPI_Scan(&__ctmp,&__end,1,MPI_INT,MPI_SUM,comm);CHKERRQ(_4_ierr); __start = __end - __ctmp;\ 370ef66eb69SBarry Smith _4_ierr = MPI_Scan(&__tmp,&__rstart,1,MPI_INT,MPI_SUM,comm);CHKERRQ(_4_ierr); __rstart = __rstart - __tmp; 3717c922b88SBarry Smith 372222b16d4SBarry Smith #define MatPreallocateSymmetricInitialize(comm,nrows,ncols,dnz,onz) 0; \ 373222b16d4SBarry Smith { \ 374222b16d4SBarry Smith int _4_ierr,__tmp = (nrows),__ctmp = (ncols),__rstart,__end; \ 375222b16d4SBarry Smith _4_ierr = PetscMalloc(2*__tmp*sizeof(int),&dnz);CHKERRQ(_4_ierr);onz = dnz + __tmp;\ 376222b16d4SBarry Smith _4_ierr = PetscMemzero(dnz,2*__tmp*sizeof(int));CHKERRQ(_4_ierr);\ 377222b16d4SBarry Smith _4_ierr = MPI_Scan(&__ctmp,&__end,1,MPI_INT,MPI_SUM,comm);CHKERRQ(_4_ierr);\ 378222b16d4SBarry Smith _4_ierr = MPI_Scan(&__tmp,&__rstart,1,MPI_INT,MPI_SUM,comm);CHKERRQ(_4_ierr); __rstart = __rstart - __tmp; 379222b16d4SBarry Smith 380c4f061fbSSatish Balay #define MatPreallocateSetLocal(map,nrows,rows,ncols,cols,dnz,onz) 0;\ 381c4f061fbSSatish Balay {\ 382c4f061fbSSatish Balay int __l;\ 383ef66eb69SBarry Smith _4_ierr = ISLocalToGlobalMappingApply(map,nrows,rows,rows);CHKERRQ(_4_ierr);\ 384ef66eb69SBarry Smith _4_ierr = ISLocalToGlobalMappingApply(map,ncols,cols,cols);CHKERRQ(_4_ierr);\ 385c4f061fbSSatish Balay for (__l=0;__l<nrows;__l++) {\ 386ef66eb69SBarry Smith _4_ierr = MatPreallocateSet((rows)[__l],ncols,cols,dnz,onz);CHKERRQ(_4_ierr);\ 387c4f061fbSSatish Balay }\ 388c4f061fbSSatish Balay } 389c4f061fbSSatish Balay 390d3d32019SBarry Smith #define MatPreallocateSymmetricSetLocal(map,nrows,rows,ncols,cols,dnz,onz) 0;\ 391d3d32019SBarry Smith {\ 392d3d32019SBarry Smith int __l;\ 393d3d32019SBarry Smith _4_ierr = ISLocalToGlobalMappingApply(map,nrows,rows,rows);CHKERRQ(_4_ierr);\ 394d3d32019SBarry Smith _4_ierr = ISLocalToGlobalMappingApply(map,ncols,cols,cols);CHKERRQ(_4_ierr);\ 395d3d32019SBarry Smith for (__l=0;__l<nrows;__l++) {\ 396d3d32019SBarry Smith _4_ierr = MatPreallocateSymmetricSet((rows)[__l],ncols,cols,dnz,onz);CHKERRQ(_4_ierr);\ 397d3d32019SBarry Smith }\ 398d3d32019SBarry Smith } 399d3d32019SBarry Smith 400c4f061fbSSatish Balay #define MatPreallocateSet(row,nc,cols,dnz,onz) 0;\ 4017c922b88SBarry Smith { int __i; \ 4027c922b88SBarry Smith for (__i=0; __i<nc; __i++) {\ 4037c922b88SBarry Smith if (cols[__i] < __start || cols[__i] >= __end) onz[row - __rstart]++; \ 4047c922b88SBarry Smith }\ 4057c922b88SBarry Smith dnz[row - __rstart] = nc - onz[row - __rstart];\ 4067c922b88SBarry Smith } 4077c922b88SBarry Smith 408d3d32019SBarry Smith #define MatPreallocateSymmetricSet(row,nc,cols,dnz,onz) 0;\ 409d3d32019SBarry Smith { int __i; \ 410d3d32019SBarry Smith for (__i=0; __i<nc; __i++) {\ 411d3d32019SBarry Smith if (cols[__i] >= __end) onz[row - __rstart]++; \ 412d3d32019SBarry Smith else if (cols[__i] >= row) dnz[row - __rstart]++;\ 413d3d32019SBarry Smith }\ 414d3d32019SBarry Smith } 415d3d32019SBarry Smith 416ef66eb69SBarry Smith #define MatPreallocateFinalize(dnz,onz) 0;_4_ierr = PetscFree(dnz);CHKERRQ(_4_ierr);} 4177c922b88SBarry Smith 4187b80b807SBarry Smith /* Routines unique to particular data structures */ 419435da068SBarry Smith EXTERN int MatShellGetContext(Mat,void **); 420435da068SBarry Smith 42187828ca2SBarry Smith EXTERN int MatBDiagGetData(Mat,int*,int*,int**,int**,PetscScalar***); 422ca44d042SBarry Smith EXTERN int MatSeqAIJSetColumnIndices(Mat,int *); 423ca44d042SBarry Smith EXTERN int MatSeqBAIJSetColumnIndices(Mat,int *); 42487828ca2SBarry Smith EXTERN int MatCreateSeqAIJWithArrays(MPI_Comm,int,int,int*,int*,PetscScalar *,Mat*); 4257b80b807SBarry Smith 426273d9f13SBarry Smith EXTERN int MatSeqBAIJSetPreallocation(Mat,int,int,int*); 427273d9f13SBarry Smith EXTERN int MatSeqSBAIJSetPreallocation(Mat,int,int,int*); 428273d9f13SBarry Smith EXTERN int MatSeqAIJSetPreallocation(Mat,int,int*); 42987828ca2SBarry Smith EXTERN int MatSeqDensePreallocation(Mat,PetscScalar*); 43087828ca2SBarry Smith EXTERN int MatSeqBDiagSetPreallocation(Mat,int,int,int*,PetscScalar**); 43187828ca2SBarry Smith EXTERN int MatSeqDenseSetPreallocation(Mat,PetscScalar*); 432273d9f13SBarry Smith 433273d9f13SBarry Smith EXTERN int MatMPIBAIJSetPreallocation(Mat,int,int,int*,int,int*); 434273d9f13SBarry Smith EXTERN int MatMPISBAIJSetPreallocation(Mat,int,int,int*,int,int*); 435273d9f13SBarry Smith EXTERN int MatMPIAIJSetPreallocation(Mat,int,int*,int,int*); 43687828ca2SBarry Smith EXTERN int MatMPIDensePreallocation(Mat,PetscScalar*); 43787828ca2SBarry Smith EXTERN int MatMPIBDiagSetPreallocation(Mat,int,int,int*,PetscScalar**); 438273d9f13SBarry Smith EXTERN int MatMPIAdjSetPreallocation(Mat,int*,int*,int*); 43987828ca2SBarry Smith EXTERN int MatMPIDenseSetPreallocation(Mat,PetscScalar*); 440273d9f13SBarry Smith EXTERN int MatMPIRowbsSetPreallocation(Mat,int,int*); 441435da068SBarry Smith EXTERN int MatMPIAIJGetSeqAIJ(Mat,Mat*,Mat*,int**); 442435da068SBarry Smith EXTERN int MatMPIBAIJGetSeqBAIJ(Mat,Mat*,Mat*,int**); 4433a7fca6bSBarry Smith EXTERN int MatAdicSetLocalFunction(Mat,void (*)(void)); 444273d9f13SBarry Smith 445ca44d042SBarry Smith EXTERN int MatStoreValues(Mat); 446ca44d042SBarry Smith EXTERN int MatRetrieveValues(Mat); 4472e8a6d31SBarry Smith 4483a7fca6bSBarry Smith EXTERN int MatDAADSetCtx(Mat,void*); 4493a7fca6bSBarry Smith 4507b80b807SBarry Smith /* 4517b80b807SBarry Smith These routines are not usually accessed directly, rather solving is 4527b80b807SBarry Smith done through the SLES, KSP and PC interfaces. 4537b80b807SBarry Smith */ 4547b80b807SBarry Smith 455d9274352SBarry Smith /*E 456d9274352SBarry Smith MatOrderingType - String with the name of a PETSc matrix ordering or the creation function 457d9274352SBarry Smith with an optional dynamic library name, for example 458d9274352SBarry Smith http://www.mcs.anl.gov/petsc/lib.a:orderingcreate() 459d9274352SBarry Smith 460d9274352SBarry Smith Level: beginner 461d9274352SBarry Smith 462d9274352SBarry Smith .seealso: MatGetOrdering() 463d9274352SBarry Smith E*/ 464b12f92e5SBarry Smith typedef char* MatOrderingType; 465b12f92e5SBarry Smith #define MATORDERING_NATURAL "natural" 466b12f92e5SBarry Smith #define MATORDERING_ND "nd" 467b12f92e5SBarry Smith #define MATORDERING_1WD "1wd" 468b12f92e5SBarry Smith #define MATORDERING_RCM "rcm" 469b12f92e5SBarry Smith #define MATORDERING_QMD "qmd" 470b12f92e5SBarry Smith #define MATORDERING_ROWLENGTH "rowlength" 47162152c8bSBarry Smith #define MATORDERING_DSC_ND "dsc_nd" 47262152c8bSBarry Smith #define MATORDERING_DSC_MMD "dsc_mmd" 47362152c8bSBarry Smith #define MATORDERING_DSC_MDF "dsc_mdf" 474c06d978dSMatthew Knepley #define MATORDERING_CONSTRAINED "constrained" 475c06d978dSMatthew Knepley #define MATORDERING_IDENTITY "identity" 476c06d978dSMatthew Knepley #define MATORDERING_REVERSE "reverse" 477b12f92e5SBarry Smith 478ca44d042SBarry Smith EXTERN int MatGetOrdering(Mat,MatOrderingType,IS*,IS*); 479ca44d042SBarry Smith EXTERN int MatOrderingRegister(char*,char*,char*,int(*)(Mat,MatOrderingType,IS*,IS*)); 480aa482453SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 481f1af5d2fSBarry Smith #define MatOrderingRegisterDynamic(a,b,c,d) MatOrderingRegister(a,b,c,0) 482b12f92e5SBarry Smith #else 483f1af5d2fSBarry Smith #define MatOrderingRegisterDynamic(a,b,c,d) MatOrderingRegister(a,b,c,d) 484b12f92e5SBarry Smith #endif 485ca44d042SBarry Smith EXTERN int MatOrderingRegisterDestroy(void); 486ca44d042SBarry Smith EXTERN int MatOrderingRegisterAll(char*); 4872bad1931SBarry Smith extern PetscTruth MatOrderingRegisterAllCalled; 488b0a32e0cSBarry Smith extern PetscFList MatOrderingList; 489d4fbbf0eSBarry Smith 49087828ca2SBarry Smith EXTERN int MatReorderForNonzeroDiagonal(Mat,PetscReal,IS,IS); 491a2ce50c7SBarry Smith 49287828ca2SBarry Smith EXTERN int MatCholeskyFactor(Mat,IS,PetscReal); 49387828ca2SBarry Smith EXTERN int MatCholeskyFactorSymbolic(Mat,IS,PetscReal,Mat*); 494ca44d042SBarry Smith EXTERN int MatCholeskyFactorNumeric(Mat,Mat*); 495a2ce50c7SBarry Smith 496d91e6319SBarry Smith /*S 497d91e6319SBarry Smith MatILUInfo - Data based into the matrix ILU factorization routines 4985ef9f2a5SBarry Smith 499d91e6319SBarry Smith In Fortran these are simply double precision arrays of size MAT_ILUINFO_SIZE 50014822f30SBarry Smith 501d91e6319SBarry Smith Notes: These are not usually directly used by users, instead use the PC type of ILU 502d91e6319SBarry Smith All entries are double precision. 503d91e6319SBarry Smith 504d91e6319SBarry Smith Level: developer 505d91e6319SBarry Smith 506d91e6319SBarry Smith .seealso: MatILUFactorSymbolic(), MatILUFactor(), MatLUInfo, MatCholeskyInfo 507d91e6319SBarry Smith 508d91e6319SBarry Smith S*/ 5095ef9f2a5SBarry Smith typedef struct { 510f6275e2eSBarry Smith PetscReal levels; /* ILU(levels) */ 511f6275e2eSBarry Smith PetscReal fill; /* expected fill; nonzeros in factored matrix/nonzeros in original matrix*/ 512f6275e2eSBarry Smith PetscReal diagonal_fill; /* force diagonal to fill in if initially not filled */ 513f6275e2eSBarry Smith PetscReal dt; /* drop tolerance */ 514f6275e2eSBarry Smith PetscReal dtcol; /* tolerance for pivoting */ 515f6275e2eSBarry Smith PetscReal dtcount; /* maximum nonzeros to be allowed per row */ 516f6275e2eSBarry Smith PetscReal damping; /* scaling of identity added to matrix to prevent zero pivots */ 517f6275e2eSBarry Smith PetscReal damp; /* if is 1.0 and factorization fails, damp until successful */ 518f6275e2eSBarry Smith PetscReal zeropivot; /* pivot is called zero if less than this */ 519bcd9e38bSBarry Smith PetscReal pivotinblocks; /* for BAIJ and SBAIJ matrices pivot in factorization on blocks, default 1.0 520bcd9e38bSBarry Smith factorization may be faster if do not pivot */ 5215ef9f2a5SBarry Smith } MatILUInfo; 5225ef9f2a5SBarry Smith 523d91e6319SBarry Smith /*S 524d91e6319SBarry Smith MatLUInfo - Data based into the matrix LU factorization routines 525d91e6319SBarry Smith 526d91e6319SBarry Smith In Fortran these are simply double precision arrays of size MAT_LUINFO_SIZE 527d91e6319SBarry Smith 528d91e6319SBarry Smith Notes: These are not usually directly used by users, instead use the PC type of LU 529d91e6319SBarry Smith All entries are double precision. 530d91e6319SBarry Smith 531d91e6319SBarry Smith Level: developer 532d91e6319SBarry Smith 533d91e6319SBarry Smith .seealso: MatLUFactorSymbolic(), MatILUInfo, MatCholeskyInfo 534d91e6319SBarry Smith 535d91e6319SBarry Smith S*/ 53614822f30SBarry Smith typedef struct { 537f6275e2eSBarry Smith PetscReal fill; /* expected fill; nonzeros in factored matrix/nonzeros in original matrix */ 538f6275e2eSBarry Smith PetscReal dtcol; /* tolerance for pivoting; pivot if off_diagonal*dtcol > diagonal */ 539f6275e2eSBarry Smith PetscReal damping; /* scaling of identity added to matrix to prevent zero pivots */ 540f6275e2eSBarry Smith PetscReal zeropivot; /* pivot is called zero if less than this */ 541bcd9e38bSBarry Smith PetscReal pivotinblocks; /* for BAIJ and SBAIJ matrices pivot in factorization on blocks, default 1.0 542bcd9e38bSBarry Smith factorization may be faster if do not pivot */ 54314822f30SBarry Smith } MatLUInfo; 54414822f30SBarry Smith 545d91e6319SBarry Smith /*S 546*b00f7748SHong Zhang MatICCInfo - Data based into the matrix ICC factorization routines 547*b00f7748SHong Zhang 548*b00f7748SHong Zhang In Fortran these are simply double precision arrays of size MAT_ICCINFO_SIZE 549*b00f7748SHong Zhang 550*b00f7748SHong Zhang Notes: These are not usually directly used by users, instead use the PC type of ICC 551*b00f7748SHong Zhang All entries are double precision. 552*b00f7748SHong Zhang 553*b00f7748SHong Zhang Level: developer 554*b00f7748SHong Zhang 555*b00f7748SHong Zhang .seealso: MatICCFactorSymbolic(), MatICCFactor(), MatILUInfo, MatLUInfo, MatCholeskyInfo 556*b00f7748SHong Zhang 557*b00f7748SHong Zhang S*/ 558*b00f7748SHong Zhang typedef struct { 559*b00f7748SHong Zhang int levels; /* ICC(levels) */ 560*b00f7748SHong Zhang PetscReal fill; /* expected fill; nonzeros in factored matrix/nonzeros in original matrix*/ 561*b00f7748SHong Zhang PetscReal dtcol; /* tolerance for pivoting */ 562*b00f7748SHong Zhang PetscReal damping; /* scaling of identity added to matrix to prevent zero pivots */ 563*b00f7748SHong Zhang PetscTruth damp; /* if is PETSC_TRUE, apply damping until successful */ 564*b00f7748SHong Zhang PetscReal zeropivot; /* pivot is called zero if less than this */ 565*b00f7748SHong Zhang } MatICCInfo; 566*b00f7748SHong Zhang 567*b00f7748SHong Zhang /*S 568d91e6319SBarry Smith MatCholeskyInfo - Data based into the matrix Cholesky factorization routines 569d91e6319SBarry Smith 570d91e6319SBarry Smith In Fortran these are simply double precision arrays of size MAT_CHOLESKYINFO_SIZE 571d91e6319SBarry Smith 572d91e6319SBarry Smith Notes: These are not usually directly used by users, instead use the PC type of Cholesky 573d91e6319SBarry Smith All entries are double precision. 574d91e6319SBarry Smith 575d91e6319SBarry Smith Level: developer 576d91e6319SBarry Smith 577d91e6319SBarry Smith .seealso: MatCholeskyFactorSymbolic(), MatLUInfo, MatILUInfo 578d91e6319SBarry Smith 579d91e6319SBarry Smith S*/ 580ffa6d0a5SLois Curfman McInnes typedef struct { 581f6275e2eSBarry Smith PetscReal fill; /* expected fill; nonzeros in factored matrix/nonzeros in original matrix */ 582f6275e2eSBarry Smith PetscReal damping; /* scaling of identity added to matrix to prevent zero pivots */ 583bcd9e38bSBarry Smith PetscReal pivotinblocks; /* for BAIJ and SBAIJ matrices pivot in factorization on blocks, default 1.0 584bcd9e38bSBarry Smith factorization may be faster if do not pivot */ 585ffa6d0a5SLois Curfman McInnes } MatCholeskyInfo; 586ffa6d0a5SLois Curfman McInnes 58714822f30SBarry Smith EXTERN int MatLUFactor(Mat,IS,IS,MatLUInfo*); 588ca44d042SBarry Smith EXTERN int MatILUFactor(Mat,IS,IS,MatILUInfo*); 58914822f30SBarry Smith EXTERN int MatLUFactorSymbolic(Mat,IS,IS,MatLUInfo*,Mat*); 590ca44d042SBarry Smith EXTERN int MatILUFactorSymbolic(Mat,IS,IS,MatILUInfo*,Mat*); 591*b00f7748SHong Zhang EXTERN int MatICCFactorSymbolic(Mat,IS,MatICCInfo*,Mat*); 592*b00f7748SHong Zhang EXTERN int MatICCFactor(Mat,IS,MatICCInfo*); 593ca44d042SBarry Smith EXTERN int MatLUFactorNumeric(Mat,Mat*); 594ca44d042SBarry Smith EXTERN int MatILUDTFactor(Mat,MatILUInfo*,IS,IS,Mat *); 5953e0d88b5SBarry Smith EXTERN int MatGetInertia(Mat,int*,int*,int*); 596ca44d042SBarry Smith EXTERN int MatSolve(Mat,Vec,Vec); 597ca44d042SBarry Smith EXTERN int MatForwardSolve(Mat,Vec,Vec); 598ca44d042SBarry Smith EXTERN int MatBackwardSolve(Mat,Vec,Vec); 599ca44d042SBarry Smith EXTERN int MatSolveAdd(Mat,Vec,Vec,Vec); 600ca44d042SBarry Smith EXTERN int MatSolveTranspose(Mat,Vec,Vec); 601ca44d042SBarry Smith EXTERN int MatSolveTransposeAdd(Mat,Vec,Vec,Vec); 602d59c15a7SBarry Smith EXTERN int MatSolves(Mat,Vecs,Vecs); 6038ed539a5SBarry Smith 604ca44d042SBarry Smith EXTERN int MatSetUnfactored(Mat); 605bb5a7306SBarry Smith 606bb1eb677SSatish Balay /* MatSORType may be bitwise ORd together, so do not change the numbers */ 607d91e6319SBarry Smith /*E 608d91e6319SBarry Smith MatSORType - What type of (S)SOR to perform 609bb1eb677SSatish Balay 610d91e6319SBarry Smith Level: beginner 611d91e6319SBarry Smith 612d9274352SBarry Smith May be bitwise ORd together 613d9274352SBarry Smith 614d91e6319SBarry Smith Any additions/changes here MUST also be made in include/finclude/petscmat.h 615d91e6319SBarry Smith 616d91e6319SBarry Smith .seealso: MatRelax() 617d91e6319SBarry Smith E*/ 618ee50ffe9SBarry Smith typedef enum {SOR_FORWARD_SWEEP=1,SOR_BACKWARD_SWEEP=2,SOR_SYMMETRIC_SWEEP=3, 619ee50ffe9SBarry Smith SOR_LOCAL_FORWARD_SWEEP=4,SOR_LOCAL_BACKWARD_SWEEP=8, 620ee50ffe9SBarry Smith SOR_LOCAL_SYMMETRIC_SWEEP=12,SOR_ZERO_INITIAL_GUESS=16, 62184cb2905SBarry Smith SOR_EISENSTAT=32,SOR_APPLY_UPPER=64,SOR_APPLY_LOWER=128} MatSORType; 622c14dc6b6SHong Zhang EXTERN int MatRelax(Mat,Vec,PetscReal,MatSORType,PetscReal,int,int,Vec); 6238ed539a5SBarry Smith 624d4fbbf0eSBarry Smith /* 625639f9d9dSBarry Smith These routines are for efficiently computing Jacobians via finite differences. 626639f9d9dSBarry Smith */ 627b12f92e5SBarry Smith 628d9274352SBarry Smith /*E 629d9274352SBarry Smith MatColoringType - String with the name of a PETSc matrix coloring or the creation function 630d9274352SBarry Smith with an optional dynamic library name, for example 631d9274352SBarry Smith http://www.mcs.anl.gov/petsc/lib.a:coloringcreate() 632d9274352SBarry Smith 633d9274352SBarry Smith Level: beginner 634d9274352SBarry Smith 635d9274352SBarry Smith .seealso: MatGetColoring() 636d9274352SBarry Smith E*/ 637b12f92e5SBarry Smith typedef char* MatColoringType; 638b12f92e5SBarry Smith #define MATCOLORING_NATURAL "natural" 639b12f92e5SBarry Smith #define MATCOLORING_SL "sl" 640b12f92e5SBarry Smith #define MATCOLORING_LF "lf" 641b12f92e5SBarry Smith #define MATCOLORING_ID "id" 642b12f92e5SBarry Smith 643ca44d042SBarry Smith EXTERN int MatGetColoring(Mat,MatColoringType,ISColoring*); 644ca44d042SBarry Smith EXTERN int MatColoringRegister(char*,char*,char*,int(*)(Mat,MatColoringType,ISColoring *)); 645aa482453SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 646f1af5d2fSBarry Smith #define MatColoringRegisterDynamic(a,b,c,d) MatColoringRegister(a,b,c,0) 647b12f92e5SBarry Smith #else 648f1af5d2fSBarry Smith #define MatColoringRegisterDynamic(a,b,c,d) MatColoringRegister(a,b,c,d) 649b12f92e5SBarry Smith #endif 650ca44d042SBarry Smith EXTERN int MatColoringRegisterAll(char *); 6512bad1931SBarry Smith extern PetscTruth MatColoringRegisterAllCalled; 652ca44d042SBarry Smith EXTERN int MatColoringRegisterDestroy(void); 65308b6dcc0SBarry Smith EXTERN int MatColoringPatch(Mat,int,int,ISColoringValue *,ISColoring*); 654639f9d9dSBarry Smith 655d9274352SBarry Smith /*S 656d9274352SBarry Smith MatFDColoring - Object for computing a sparse Jacobian via finite differences 657d9274352SBarry Smith and coloring 658639f9d9dSBarry Smith 659d9274352SBarry Smith Level: beginner 660d9274352SBarry Smith 661d9274352SBarry Smith Concepts: coloring, sparse Jacobian, finite differences 662d9274352SBarry Smith 663d9274352SBarry Smith .seealso: MatFDColoringCreate() 664d9274352SBarry Smith S*/ 665e2a1c21fSSatish Balay typedef struct _p_MatFDColoring *MatFDColoring; 666639f9d9dSBarry Smith 667ca44d042SBarry Smith EXTERN int MatFDColoringCreate(Mat,ISColoring,MatFDColoring *); 668ca44d042SBarry Smith EXTERN int MatFDColoringDestroy(MatFDColoring); 669b0a32e0cSBarry Smith EXTERN int MatFDColoringView(MatFDColoring,PetscViewer); 670ca44d042SBarry Smith EXTERN int MatFDColoringSetFunction(MatFDColoring,int (*)(void),void*); 67187828ca2SBarry Smith EXTERN int MatFDColoringSetParameters(MatFDColoring,PetscReal,PetscReal); 672ca44d042SBarry Smith EXTERN int MatFDColoringSetFrequency(MatFDColoring,int); 673ca44d042SBarry Smith EXTERN int MatFDColoringGetFrequency(MatFDColoring,int*); 674ca44d042SBarry Smith EXTERN int MatFDColoringSetFromOptions(MatFDColoring); 675ca44d042SBarry Smith EXTERN int MatFDColoringApply(Mat,MatFDColoring,Vec,MatStructure*,void *); 67687828ca2SBarry Smith EXTERN int MatFDColoringApplyTS(Mat,MatFDColoring,PetscReal,Vec,MatStructure*,void *); 67762152c8bSBarry Smith EXTERN int MatFDColoringSetRecompute(MatFDColoring); 6783a7fca6bSBarry Smith EXTERN int MatFDColoringSetF(MatFDColoring,Vec); 67949b058dcSBarry Smith EXTERN int MatFDColoringGetPerturbedColumns(MatFDColoring,int*,int**); 680639f9d9dSBarry Smith /* 6810752156aSBarry Smith These routines are for partitioning matrices: currently used only 6823eda8832SBarry Smith for adjacency matrix, MatCreateMPIAdj(). 6830752156aSBarry Smith */ 684ca161407SBarry Smith 685d9274352SBarry Smith /*S 686d9274352SBarry Smith MatPartitioning - Object for managing the partitioning of a matrix or graph 687d9274352SBarry Smith 688d9274352SBarry Smith Level: beginner 689d9274352SBarry Smith 690d9274352SBarry Smith Concepts: partitioning 691d9274352SBarry Smith 692d9274352SBarry Smith .seealso: MatParitioningCreate(), MatPartitioningType 693d9274352SBarry Smith S*/ 69491e9ee9fSBarry Smith typedef struct _p_MatPartitioning *MatPartitioning; 695d9274352SBarry Smith 696d9274352SBarry Smith /*E 697d9274352SBarry Smith MatPartitioningType - String with the name of a PETSc matrix partitioing or the creation function 698d9274352SBarry Smith with an optional dynamic library name, for example 699d9274352SBarry Smith http://www.mcs.anl.gov/petsc/lib.a:partitioningcreate() 700d9274352SBarry Smith 701d9274352SBarry Smith Level: beginner 702d9274352SBarry Smith 703d9274352SBarry Smith .seealso: MatPartitioingCreate(), MatPartitioning 704d9274352SBarry Smith E*/ 7052aabb6bbSBarry Smith typedef char* MatPartitioningType; 7068ba1e511SMatthew Knepley #define MAT_PARTITIONING_CURRENT "current" 7078ba1e511SMatthew Knepley #define MAT_PARTITIONING_PARMETIS "parmetis" 708ca161407SBarry Smith 709ca44d042SBarry Smith EXTERN int MatPartitioningCreate(MPI_Comm,MatPartitioning*); 710ca44d042SBarry Smith EXTERN int MatPartitioningSetType(MatPartitioning,MatPartitioningType); 711ca44d042SBarry Smith EXTERN int MatPartitioningSetAdjacency(MatPartitioning,Mat); 712ca44d042SBarry Smith EXTERN int MatPartitioningSetVertexWeights(MatPartitioning,int*); 713ca44d042SBarry Smith EXTERN int MatPartitioningApply(MatPartitioning,IS*); 714ca44d042SBarry Smith EXTERN int MatPartitioningDestroy(MatPartitioning); 7152aabb6bbSBarry Smith 716ca44d042SBarry Smith EXTERN int MatPartitioningRegister(char*,char*,char*,int(*)(MatPartitioning)); 717aa482453SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 718f1af5d2fSBarry Smith #define MatPartitioningRegisterDynamic(a,b,c,d) MatPartitioningRegister(a,b,c,0) 7192aabb6bbSBarry Smith #else 720f1af5d2fSBarry Smith #define MatPartitioningRegisterDynamic(a,b,c,d) MatPartitioningRegister(a,b,c,d) 7212aabb6bbSBarry Smith #endif 7222aabb6bbSBarry Smith 723ca44d042SBarry Smith EXTERN int MatPartitioningRegisterAll(char *); 7242bad1931SBarry Smith extern PetscTruth MatPartitioningRegisterAllCalled; 725ca44d042SBarry Smith EXTERN int MatPartitioningRegisterDestroy(void); 7262bad1931SBarry Smith 727b0a32e0cSBarry Smith EXTERN int MatPartitioningView(MatPartitioning,PetscViewer); 728ca44d042SBarry Smith EXTERN int MatPartitioningSetFromOptions(MatPartitioning); 729ca44d042SBarry Smith EXTERN int MatPartitioningGetType(MatPartitioning,MatPartitioningType*); 730ca161407SBarry Smith 731ca44d042SBarry Smith EXTERN int MatPartitioningParmetisSetCoarseSequential(MatPartitioning); 7320752156aSBarry Smith 7330752156aSBarry Smith /* 7340a835dfdSSatish Balay If you add entries here you must also add them to finclude/petscmat.h 735d4fbbf0eSBarry Smith */ 7361c1c02c0SLois Curfman McInnes typedef enum { MATOP_SET_VALUES=0, 7371c1c02c0SLois Curfman McInnes MATOP_GET_ROW=1, 7381c1c02c0SLois Curfman McInnes MATOP_RESTORE_ROW=2, 7391c1c02c0SLois Curfman McInnes MATOP_MULT=3, 7401c1c02c0SLois Curfman McInnes MATOP_MULT_ADD=4, 7417c922b88SBarry Smith MATOP_MULT_TRANSPOSE=5, 7427c922b88SBarry Smith MATOP_MULT_TRANSPOSE_ADD=6, 7431c1c02c0SLois Curfman McInnes MATOP_SOLVE=7, 7441c1c02c0SLois Curfman McInnes MATOP_SOLVE_ADD=8, 7457c922b88SBarry Smith MATOP_SOLVE_TRANSPOSE=9, 7467c922b88SBarry Smith MATOP_SOLVE_TRANSPOSE_ADD=10, 7471c1c02c0SLois Curfman McInnes MATOP_LUFACTOR=11, 7481c1c02c0SLois Curfman McInnes MATOP_CHOLESKYFACTOR=12, 7491c1c02c0SLois Curfman McInnes MATOP_RELAX=13, 7501c1c02c0SLois Curfman McInnes MATOP_TRANSPOSE=14, 7511c1c02c0SLois Curfman McInnes MATOP_GETINFO=15, 7521c1c02c0SLois Curfman McInnes MATOP_EQUAL=16, 7531c1c02c0SLois Curfman McInnes MATOP_GET_DIAGONAL=17, 7541c1c02c0SLois Curfman McInnes MATOP_DIAGONAL_SCALE=18, 7551c1c02c0SLois Curfman McInnes MATOP_NORM=19, 7561c1c02c0SLois Curfman McInnes MATOP_ASSEMBLY_BEGIN=20, 7571c1c02c0SLois Curfman McInnes MATOP_ASSEMBLY_END=21, 7581c1c02c0SLois Curfman McInnes MATOP_COMPRESS=22, 7591c1c02c0SLois Curfman McInnes MATOP_SET_OPTION=23, 7601c1c02c0SLois Curfman McInnes MATOP_ZERO_ENTRIES=24, 7611c1c02c0SLois Curfman McInnes MATOP_ZERO_ROWS=25, 7621c1c02c0SLois Curfman McInnes MATOP_LUFACTOR_SYMBOLIC=26, 7631c1c02c0SLois Curfman McInnes MATOP_LUFACTOR_NUMERIC=27, 7641c1c02c0SLois Curfman McInnes MATOP_CHOLESKY_FACTOR_SYMBOLIC=28, 7651c1c02c0SLois Curfman McInnes MATOP_CHOLESKY_FACTOR_NUMERIC=29, 766d643ce63SMatthew Knepley MATOP_SETUP_PREALLOCATION=30, 767d643ce63SMatthew Knepley MATOP_ILUFACTOR_SYMBOLIC=31, 768d643ce63SMatthew Knepley MATOP_ICCFACTOR_SYMBOLIC=32, 769d643ce63SMatthew Knepley MATOP_GET_ARRAY=33, 770d643ce63SMatthew Knepley MATOP_RESTORE_ARRAY=34, 771d643ce63SMatthew Knepley MATOP_DUPLCIATE=35, 772d643ce63SMatthew Knepley MATOP_FORWARD_SOLVE=36, 773d643ce63SMatthew Knepley MATOP_BACKWARD_SOLVE=37, 774d643ce63SMatthew Knepley MATOP_ILUFACTOR=38, 775d643ce63SMatthew Knepley MATOP_ICCFACTOR=39, 776d643ce63SMatthew Knepley MATOP_AXPY=40, 777d643ce63SMatthew Knepley MATOP_GET_SUBMATRICES=41, 778d643ce63SMatthew Knepley MATOP_INCREASE_OVERLAP=42, 779d643ce63SMatthew Knepley MATOP_GET_VALUES=43, 780d643ce63SMatthew Knepley MATOP_COPY=44, 781d643ce63SMatthew Knepley MATOP_PRINT_HELP=45, 782d643ce63SMatthew Knepley MATOP_SCALE=46, 783d643ce63SMatthew Knepley MATOP_SHIFT=47, 784d643ce63SMatthew Knepley MATOP_DIAGONAL_SHIFT=48, 785d643ce63SMatthew Knepley MATOP_ILUDT_FACTOR=49, 786d643ce63SMatthew Knepley MATOP_GET_BLOCK_SIZE=50, 787d643ce63SMatthew Knepley MATOP_GET_ROW_IJ=51, 788d643ce63SMatthew Knepley MATOP_RESTORE_ROW_IJ=52, 789d643ce63SMatthew Knepley MATOP_GET_COLUMN_IJ=53, 790d643ce63SMatthew Knepley MATOP_RESTORE_COLUMN_IJ=54, 791d643ce63SMatthew Knepley MATOP_FDCOLORING_CREATE=55, 792d643ce63SMatthew Knepley MATOP_COLORING_PATCH=56, 793d643ce63SMatthew Knepley MATOP_SET_UNFACTORED=57, 794d643ce63SMatthew Knepley MATOP_PERMUTE=58, 795d643ce63SMatthew Knepley MATOP_SET_VALUES_BLOCKED=59, 796d643ce63SMatthew Knepley MATOP_GET_SUBMATRIX=60, 797d643ce63SMatthew Knepley MATOP_DESTROY=61, 798d643ce63SMatthew Knepley MATOP_VIEW=62, 799d643ce63SMatthew Knepley MATOP_GET_MAPS=63, 800d643ce63SMatthew Knepley MATOP_USE_SCALED_FORM=64, 801d643ce63SMatthew Knepley MATOP_SCALE_SYSTEM=65, 802d643ce63SMatthew Knepley MATOP_UNSCALE_SYSTEM=66, 803d643ce63SMatthew Knepley MATOP_SET_LOCAL_TO_GLOBAL_MAPPING=67, 804d643ce63SMatthew Knepley MATOP_SET_VALUES_LOCAL=68, 805d643ce63SMatthew Knepley MATOP_ZERO_ROWS_LOCAL=69, 806d643ce63SMatthew Knepley MATOP_GET_ROW_MAX=70, 807d643ce63SMatthew Knepley MATOP_CONVERT=71, 808d643ce63SMatthew Knepley MATOP_SET_COLORING=72, 809d643ce63SMatthew Knepley MATOP_SET_VALUES_ADIC=73, 810d643ce63SMatthew Knepley MATOP_SET_VALUES_ADIFOR=74, 811d643ce63SMatthew Knepley MATOP_FD_COLORING_APPLY=75, 812d643ce63SMatthew Knepley MATOP_SET_FROM_OPTIONS=76, 813d643ce63SMatthew Knepley MATOP_MULT_CONSTRAINED=77, 814d643ce63SMatthew Knepley MATOP_MULT_TRANSPOSE_CONSTRAINED=78, 815d643ce63SMatthew Knepley MATOP_ILU_FACTOR_SYMBOLIC_CONSTRAINED=79, 816d643ce63SMatthew Knepley MATOP_PERMUTE_SPARSIFY=80, 817d643ce63SMatthew Knepley MATOP_MULT_MULTIPLE=81, 818d643ce63SMatthew Knepley MATOP_SOLVE_MULTIPLE=82 819fae171e0SBarry Smith } MatOperation; 820ca44d042SBarry Smith EXTERN int MatHasOperation(Mat,MatOperation,PetscTruth*); 821ff8b7a98SSatish Balay EXTERN int MatShellSetOperation(Mat,MatOperation,void(*)(void)); 822ff8b7a98SSatish Balay EXTERN int MatShellGetOperation(Mat,MatOperation,void(**)(void)); 823273d9f13SBarry Smith EXTERN int MatShellSetContext(Mat,void*); 824112a2221SBarry Smith 82590ace30eSBarry Smith /* 82690ace30eSBarry Smith Codes for matrices stored on disk. By default they are 82790ace30eSBarry Smith stored in a universal format. By changing the format with 828fb9695e5SSatish Balay PetscViewerSetFormat(viewer,PETSC_VIEWER_BINARY_NATIVE); the matrices will 82990ace30eSBarry Smith be stored in a way natural for the matrix, for example dense matrices 83090ace30eSBarry Smith would be stored as dense. Matrices stored this way may only be 83190ace30eSBarry Smith read into matrices of the same time. 83290ace30eSBarry Smith */ 83390ace30eSBarry Smith #define MATRIX_BINARY_FORMAT_DENSE -1 83490ace30eSBarry Smith 8353f1d51d7SBarry Smith /* 8363f1d51d7SBarry Smith New matrix classes not yet distributed 8373f1d51d7SBarry Smith */ 8383f1d51d7SBarry Smith /* 8393f1d51d7SBarry Smith MatAIJIndices is a data structure for storing the nonzero location information 8403f1d51d7SBarry Smith for sparse matrices. Several matrices with identical nonzero structure can share 8413f1d51d7SBarry Smith the same MatAIJIndices. 8423f1d51d7SBarry Smith */ 843e2a1c21fSSatish Balay typedef struct _p_MatAIJIndices* MatAIJIndices; 8443f1d51d7SBarry Smith 845ca44d042SBarry Smith EXTERN int MatCreateAIJIndices(int,int,int*,int*,PetscTruth,MatAIJIndices*); 846ca44d042SBarry Smith EXTERN int MatCreateAIJIndicesEmpty(int,int,int*,PetscTruth,MatAIJIndices*); 847ca44d042SBarry Smith EXTERN int MatAttachAIJIndices(MatAIJIndices,MatAIJIndices*); 848ca44d042SBarry Smith EXTERN int MatDestroyAIJIndices(MatAIJIndices); 849ca44d042SBarry Smith EXTERN int MatCopyAIJIndices(MatAIJIndices,MatAIJIndices*); 850ca44d042SBarry Smith EXTERN int MatValidateAIJIndices(int,MatAIJIndices); 851ca44d042SBarry Smith EXTERN int MatShiftAIJIndices(MatAIJIndices); 852ca44d042SBarry Smith EXTERN int MatShrinkAIJIndices(MatAIJIndices); 853ca44d042SBarry Smith EXTERN int MatTransposeAIJIndices(MatAIJIndices,MatAIJIndices*); 8543f1d51d7SBarry Smith 855ca44d042SBarry Smith EXTERN int MatCreateSeqCSN(MPI_Comm,int,int,int*,int,Mat*); 856ca44d042SBarry Smith EXTERN int MatCreateSeqCSN_Single(MPI_Comm,int,int,int*,int,Mat*); 85787828ca2SBarry Smith EXTERN int MatCreateSeqCSNWithPrecision(MPI_Comm,int,int,int*,int,PetscScalarPrecision,Mat*); 8583f1d51d7SBarry Smith 859ca44d042SBarry Smith EXTERN int MatCreateSeqCSNIndices(MPI_Comm,MatAIJIndices,int,Mat *); 860ca44d042SBarry Smith EXTERN int MatCreateSeqCSNIndices_Single(MPI_Comm,MatAIJIndices,int,Mat *); 86187828ca2SBarry Smith EXTERN int MatCreateSeqCSNIndicesWithPrecision(MPI_Comm,MatAIJIndices,int,PetscScalarPrecision,Mat *); 8623f1d51d7SBarry Smith 8636d053be9SSatish Balay EXTERN int MatMPIBAIJSetHashTableFactor(Mat,PetscReal); 864ca44d042SBarry Smith EXTERN int MatSeqAIJGetInodeSizes(Mat,int *,int *[],int *); 86508918a0eSSatish Balay EXTERN int MatMPIRowbsGetColor(Mat,ISColoring *); 866860d1616SSatish Balay 867d9274352SBarry Smith /*S 868d9274352SBarry Smith MatNullSpace - Object that removes a null space from a vector, i.e. 869d9274352SBarry Smith orthogonalizes the vector to a subsapce 870d9274352SBarry Smith 871f7a9e4ceSBarry Smith Level: advanced 872d9274352SBarry Smith 873d9274352SBarry Smith Concepts: matrix; linear operator, null space 874d9274352SBarry Smith 8756e1639daSBarry Smith Users manual sections: 8766e1639daSBarry Smith . sec_singular 8776e1639daSBarry Smith 878d9274352SBarry Smith .seealso: MatNullSpaceCreate() 879d9274352SBarry Smith S*/ 88074637425SBarry Smith typedef struct _p_MatNullSpace* MatNullSpace; 881d9274352SBarry Smith 88274637425SBarry Smith EXTERN int MatNullSpaceCreate(MPI_Comm,int,int,Vec *,MatNullSpace*); 88374637425SBarry Smith EXTERN int MatNullSpaceDestroy(MatNullSpace); 88474637425SBarry Smith EXTERN int MatNullSpaceRemove(MatNullSpace,Vec,Vec*); 88574637425SBarry Smith EXTERN int MatNullSpaceAttach(Mat,MatNullSpace); 88674637425SBarry Smith EXTERN int MatNullSpaceTest(MatNullSpace,Mat); 88774637425SBarry Smith 888273d9f13SBarry Smith EXTERN int MatReorderingSeqSBAIJ(Mat A,IS isp); 889273d9f13SBarry Smith EXTERN int MatMPISBAIJSetHashTableFactor(Mat,PetscReal); 890273d9f13SBarry Smith EXTERN int MatSeqSBAIJSetColumnIndices(Mat,int *); 891273d9f13SBarry Smith 8923f1d51d7SBarry Smith 893f069c275SSatish Balay EXTERN int MatCreateMAIJ(Mat,int,Mat*); 894c4f061fbSSatish Balay EXTERN int MatMAIJRedimension(Mat,int,Mat*); 895c4f061fbSSatish Balay EXTERN int MatMAIJGetAIJ(Mat,Mat*); 896c4f061fbSSatish Balay 897273d9f13SBarry Smith EXTERN int MatMPIAdjSetValues(Mat,int*,int*,int*); 898f069c275SSatish Balay 899b0a32e0cSBarry Smith EXTERN int MatComputeExplicitOperator(Mat,Mat*); 900b0a32e0cSBarry Smith 90124a595ddSBarry Smith EXTERN int MatESISetType(Mat,char*); 90224a595ddSBarry Smith EXTERN int MatESISetFromOptions(Mat); 90324a595ddSBarry Smith 9042cd6534aSBarry Smith EXTERN int MatDiagonalScaleLocal(Mat,Vec); 90504f1ad80SBarry Smith 9067dbadf16SMatthew Knepley EXTERN int PetscViewerMathematicaPutMatrix(PetscViewer, int, int, PetscReal *); 9077dbadf16SMatthew Knepley EXTERN int PetscViewerMathematicaPutCSRMatrix(PetscViewer, int, int, int *, int *, PetscReal *); 9087dbadf16SMatthew Knepley 909e82a3eeeSBarry Smith EXTERN int MatUseSuperLU_DIST_MPIAIJ(Mat); 910e82a3eeeSBarry Smith EXTERN int MatUseSpooles_SeqAIJ(Mat); 911e82a3eeeSBarry Smith EXTERN int MatUseUMFPACK_SeqAIJ(Mat); 912e82a3eeeSBarry Smith EXTERN int MatUseSuperLU_SeqAIJ(Mat); 913e82a3eeeSBarry Smith EXTERN int MatUseEssl_SeqAIJ(Mat); 914e82a3eeeSBarry Smith EXTERN int MatUseLUSOL_SeqAIJ(Mat); 915e82a3eeeSBarry Smith EXTERN int MatUseMatlab_SeqAIJ(Mat); 916e82a3eeeSBarry Smith EXTERN int MatUseDXML_SeqAIJ(Mat); 917e82a3eeeSBarry Smith EXTERN int MatUseSuperLU_DIST_MPIAIJ(Mat); 918e82a3eeeSBarry Smith EXTERN int MatUseSpooles_MPIAIJ(Mat); 919e82a3eeeSBarry Smith EXTERN int MatUseSpooles_SeqSBAIJ(Mat); 920e82a3eeeSBarry Smith extern int MatUseSpooles_MPISBAIJ(Mat); 921e82a3eeeSBarry Smith 9222eac72dbSBarry Smith #endif 9232eac72dbSBarry Smith 9242eac72dbSBarry Smith 9259d00d63dSBarry Smith 926