1 /* $Id: mat.h,v 1.183 1999/11/24 21:55:57 bsmith Exp bsmith $ */ 2 /* 3 Include file for the matrix component of PETSc 4 */ 5 #ifndef __MAT_H 6 #define __MAT_H 7 #include "vec.h" 8 9 #define MAT_COOKIE PETSC_COOKIE+5 10 11 typedef struct _p_Mat* Mat; 12 13 #define MAX_MATRIX_TYPES 14 14 /* 15 The default matrix data storage formats and routines to create them. 16 17 MATLASTTYPE is "end-of-list" marker that can be used to check that 18 MAX_MATRIX_TYPES is large enough. The rule is 19 MAX_MATRIX_TYPES >= MATLASTTYPE . 20 21 To do: add a test program that checks the consistency of these values. 22 */ 23 typedef enum { MATSAME=-1, MATSEQDENSE, MATSEQAIJ, MATMPIAIJ, MATSHELL, 24 MATMPIROWBS, MATSEQBDIAG, MATMPIBDIAG, MATMPIDENSE, MATSEQBAIJ, 25 MATMPIBAIJ, MATMPICSN, MATSEQCSN, MATSEQADJ, MATMPIADJ, 26 MATLASTTYPE } MatType; 27 28 extern int MatCreate(MPI_Comm,int,int,int,int,Mat*); 29 extern int MatCreateSeqDense(MPI_Comm,int,int,Scalar*,Mat*); 30 extern int MatCreateMPIDense(MPI_Comm,int,int,int,int,Scalar*,Mat*); 31 extern int MatCreateSeqAIJ(MPI_Comm,int,int,int,int*,Mat*); 32 extern int MatCreateMPIAIJ(MPI_Comm,int,int,int,int,int,int*,int,int*,Mat*); 33 extern int MatCreateMPIRowbs(MPI_Comm,int,int,int,int*,void*,Mat*); 34 extern int MatCreateSeqBDiag(MPI_Comm,int,int,int,int,int*,Scalar**,Mat*); 35 extern int MatCreateMPIBDiag(MPI_Comm,int,int,int,int,int,int*,Scalar**,Mat*); 36 extern int MatCreateSeqBAIJ(MPI_Comm,int,int,int,int,int*,Mat*); 37 extern int MatCreateMPIBAIJ(MPI_Comm,int,int,int,int,int,int,int*,int,int*,Mat*); 38 extern int MatCreateSeqAdj(MPI_Comm,int,int,int*,int*,Mat *); 39 extern int MatCreateMPIAdj(MPI_Comm,int,int,int*,int*,Mat*); 40 41 extern int MatDestroy(Mat); 42 43 extern int MatCreateShell(MPI_Comm,int,int,int,int,void *,Mat*); 44 extern int MatShellGetContext(Mat,void **); 45 46 extern int MatPrintHelp(Mat); 47 extern int MatGetMaps(Mat,Map*,Map*); 48 49 /* ------------------------------------------------------------*/ 50 extern int MatSetValues(Mat,int,int*,int,int*,Scalar*,InsertMode); 51 extern int MatSetValuesBlocked(Mat,int,int*,int,int*,Scalar*,InsertMode); 52 53 typedef enum {MAT_FLUSH_ASSEMBLY=1,MAT_FINAL_ASSEMBLY=0} MatAssemblyType; 54 extern int MatAssemblyBegin(Mat,MatAssemblyType); 55 extern int MatAssemblyEnd(Mat,MatAssemblyType); 56 extern int MatAssembled(Mat,PetscTruth*); 57 58 #define MatSetValue(v,i,j,va,mode) \ 59 {int _ierr,_row = i,_col = j; Scalar _va = va; \ 60 _ierr = MatSetValues(v,1,&_row,1,&_col,&_va,mode);CHKERRQ(_ierr); \ 61 } 62 #define MatGetValue(v,i,j,va) \ 63 {int _ierr,_row = i,_col = j; \ 64 _ierr = MatGetValues(v,1,&_row,1,&_col,&va);CHKERRQ(_ierr); \ 65 } 66 /* 67 Any additions/changes here MUST also be made in include/finclude/mat.h 68 */ 69 typedef enum {MAT_ROW_ORIENTED=1,MAT_COLUMN_ORIENTED=2,MAT_ROWS_SORTED=4, 70 MAT_COLUMNS_SORTED=8,MAT_NO_NEW_NONZERO_LOCATIONS=16, 71 MAT_YES_NEW_NONZERO_LOCATIONS=32,MAT_SYMMETRIC=64, 72 MAT_STRUCTURALLY_SYMMETRIC=65,MAT_NO_NEW_DIAGONALS=66, 73 MAT_YES_NEW_DIAGONALS=67,MAT_INODE_LIMIT_1=68,MAT_INODE_LIMIT_2=69, 74 MAT_INODE_LIMIT_3=70,MAT_INODE_LIMIT_4=71,MAT_INODE_LIMIT_5=72, 75 MAT_IGNORE_OFF_PROC_ENTRIES=73,MAT_ROWS_UNSORTED=74, 76 MAT_COLUMNS_UNSORTED=75,MAT_NEW_NONZERO_LOCATION_ERR=76, 77 MAT_NEW_NONZERO_ALLOCATION_ERR=77,MAT_USE_HASH_TABLE=78, 78 MAT_KEEP_ZEROED_ROWS=79,MAT_IGNORE_ZERO_ENTRIES=80} MatOption; 79 extern int MatSetOption(Mat,MatOption); 80 extern int MatGetType(Mat,MatType*,char**); 81 extern int MatGetTypeFromOptions(MPI_Comm,char*,MatType*,PetscTruth*); 82 83 extern int MatGetValues(Mat,int,int*,int,int*,Scalar*); 84 extern int MatGetRow(Mat,int,int *,int **,Scalar**); 85 extern int MatRestoreRow(Mat,int,int *,int **,Scalar**); 86 extern int MatGetColumn(Mat,int,int *,int **,Scalar**); 87 extern int MatRestoreColumn(Mat,int,int *,int **,Scalar**); 88 extern int MatGetColumnVector(Mat,Vec,int); 89 extern int MatGetArray(Mat,Scalar **); 90 extern int MatRestoreArray(Mat,Scalar **); 91 extern int MatGetBlockSize(Mat,int *); 92 93 extern int MatMult(Mat,Vec,Vec); 94 extern int MatMultAdd(Mat,Vec,Vec,Vec); 95 extern int MatMultTranspose(Mat,Vec,Vec); 96 extern int MatMultTransposeAdd(Mat,Vec,Vec,Vec); 97 98 typedef enum {MAT_DO_NOT_COPY_VALUES, MAT_COPY_VALUES} MatDuplicateOption; 99 100 extern int MatConvert(Mat,MatType,Mat*); 101 extern int MatDuplicate(Mat,MatDuplicateOption,Mat*); 102 extern int MatConvertRegister(MatType,MatType,int (*)(Mat,MatType,Mat*)); 103 extern int MatConvertRegisterAll(void); 104 105 typedef enum {SAME_NONZERO_PATTERN,DIFFERENT_NONZERO_PATTERN,SAME_PRECONDITIONER} MatStructure; 106 107 extern int MatCopy(Mat,Mat,MatStructure); 108 extern int MatView(Mat,Viewer); 109 extern int MatLoad(Viewer,MatType,Mat*); 110 extern int MatLoadRegister(MatType,int (*)(Viewer,MatType,Mat*)); 111 extern int MatLoadRegisterAll(void); 112 113 extern int MatGetRowIJ(Mat,int,PetscTruth,int*,int **,int **,PetscTruth *); 114 extern int MatRestoreRowIJ(Mat,int,PetscTruth,int *,int **,int **,PetscTruth *); 115 extern int MatGetColumnIJ(Mat,int,PetscTruth,int*,int **,int **,PetscTruth *); 116 extern int MatRestoreColumnIJ(Mat,int,PetscTruth,int *,int **,int **,PetscTruth *); 117 118 /* 119 Context of matrix information, used with MatGetInfo() 120 Note: If any entries are added to this context, be sure 121 to adjust MAT_INFO_SIZE in finclude/mat.h 122 */ 123 typedef struct { 124 PLogDouble rows_global, columns_global; /* number of global rows and columns */ 125 PLogDouble rows_local, columns_local; /* number of local rows and columns */ 126 PLogDouble block_size; /* block size */ 127 PLogDouble nz_allocated, nz_used, nz_unneeded; /* number of nonzeros */ 128 PLogDouble memory; /* memory allocated */ 129 PLogDouble assemblies; /* number of matrix assemblies */ 130 PLogDouble mallocs; /* number of mallocs during MatSetValues() */ 131 PLogDouble fill_ratio_given, fill_ratio_needed; /* fill ratio for LU/ILU */ 132 PLogDouble factor_mallocs; /* number of mallocs during factorization */ 133 } MatInfo; 134 135 typedef enum {MAT_LOCAL=1,MAT_GLOBAL_MAX=2,MAT_GLOBAL_SUM=3} MatInfoType; 136 extern int MatGetInfo(Mat,MatInfoType,MatInfo*); 137 extern int MatValid(Mat,PetscTruth*); 138 extern int MatGetDiagonal(Mat,Vec); 139 extern int MatTranspose(Mat,Mat*); 140 extern int MatPermute(Mat,IS,IS,Mat *); 141 extern int MatDiagonalScale(Mat,Vec,Vec); 142 extern int MatDiagonalShift(Mat,Vec); 143 extern int MatEqual(Mat,Mat, PetscTruth*); 144 145 extern int MatNorm(Mat,NormType,double *); 146 extern int MatZeroEntries(Mat); 147 extern int MatZeroRows(Mat,IS,Scalar*); 148 extern int MatZeroColumns(Mat,IS,Scalar*); 149 150 extern int MatUseScaledForm(Mat,PetscTruth); 151 extern int MatScaleSystem(Mat,Vec,Vec); 152 extern int MatUnScaleSystem(Mat,Vec,Vec); 153 154 extern int MatGetSize(Mat,int*,int*); 155 extern int MatGetLocalSize(Mat,int*,int*); 156 extern int MatGetOwnershipRange(Mat,int*,int*); 157 158 typedef enum {MAT_INITIAL_MATRIX, MAT_REUSE_MATRIX} MatReuse; 159 extern int MatGetSubMatrices(Mat,int,IS *,IS *,MatReuse,Mat **); 160 extern int MatDestroyMatrices(int, Mat **); 161 extern int MatGetSubMatrix(Mat,IS,IS,int,MatReuse,Mat *); 162 163 extern int MatIncreaseOverlap(Mat,int,IS *,int); 164 165 extern int MatAXPY(Scalar *,Mat,Mat); 166 extern int MatAYPX(Scalar *,Mat,Mat); 167 extern int MatCompress(Mat); 168 169 extern int MatScale(Scalar *,Mat); 170 extern int MatShift(Scalar *,Mat); 171 172 extern int MatSetLocalToGlobalMapping(Mat, ISLocalToGlobalMapping); 173 extern int MatSetLocalToGlobalMappingBlock(Mat, ISLocalToGlobalMapping); 174 extern int MatZeroRowsLocal(Mat,IS,Scalar*); 175 extern int MatSetValuesLocal(Mat,int,int*,int,int*,Scalar*,InsertMode); 176 extern int MatSetValuesBlockedLocal(Mat,int,int*,int,int*,Scalar*,InsertMode); 177 178 extern int MatSetStashInitialSize(Mat,int, int); 179 180 extern int MatInterpolateAdd(Mat,Vec,Vec,Vec); 181 extern int MatInterpolate(Mat,Vec,Vec); 182 extern int MatRestrict(Mat,Vec,Vec); 183 184 /* 185 These three macros MUST be used together. The third one closes the open { of the first one 186 */ 187 #define MatPreallocateInitialize(comm,nrows,ncols,dnz,onz) \ 188 { \ 189 int __ierr,__tmp = (nrows),__ctmp = (ncols), __rstart,__start,__end; \ 190 dnz = (int *) PetscMalloc(2*__tmp*sizeof(int));CHKPTRQ(dnz);onz = dnz + __tmp;\ 191 __ierr = PetscMemzero(dnz,2*__tmp*sizeof(int));CHKERRQ(__ierr);\ 192 __ierr = MPI_Scan(&__ctmp,&__end,1,MPI_INT,MPI_SUM,comm);CHKERRQ(__ierr); __start = __end - __ctmp;\ 193 __ierr = MPI_Scan(&__tmp,&__rstart,1,MPI_INT,MPI_SUM,comm);CHKERRQ(__ierr); __rstart = __rstart - __tmp; 194 195 #define MatPreallocateSet(row,nc,cols,dnz,onz)\ 196 { int __i; \ 197 for ( __i=0; __i<nc; __i++) {\ 198 if (cols[__i] < __start || cols[__i] >= __end) onz[row - __rstart]++; \ 199 }\ 200 dnz[row - __rstart] = nc - onz[row - __rstart];\ 201 } 202 203 #define MatPreallocateFinalize(dnz,onz) __ierr = PetscFree(dnz);CHKERRQ(__ierr);} 204 205 /* Routines unique to particular data structures */ 206 extern int MatBDiagGetData(Mat,int*,int*,int**,int**,Scalar***); 207 extern int MatSeqAIJSetColumnIndices(Mat,int *); 208 extern int MatSeqBAIJSetColumnIndices(Mat,int *); 209 210 extern int MatStoreValues(Mat); 211 extern int MatRetrieveValues(Mat); 212 213 /* 214 These routines are not usually accessed directly, rather solving is 215 done through the SLES, KSP and PC interfaces. 216 */ 217 218 typedef char* MatOrderingType; 219 #define MATORDERING_NATURAL "natural" 220 #define MATORDERING_ND "nd" 221 #define MATORDERING_1WD "1wd" 222 #define MATORDERING_RCM "rcm" 223 #define MATORDERING_QMD "qmd" 224 #define MATORDERING_ROWLENGTH "rowlength" 225 226 extern int MatGetOrdering(Mat,MatOrderingType,IS*,IS*); 227 extern int MatOrderingRegister(char*,char*,char*,int(*)(Mat,MatOrderingType,IS*,IS*)); 228 #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 229 #define MatOrderingRegisterDynamic(a,b,c,d) MatOrderingRegister(a,b,c,0) 230 #else 231 #define MatOrderingRegisterDynamic(a,b,c,d) MatOrderingRegister(a,b,c,d) 232 #endif 233 extern int MatOrderingRegisterDestroy(void); 234 extern int MatOrderingRegisterAll(char*); 235 extern int MatOrderingRegisterAllCalled; 236 237 extern int MatReorderForNonzeroDiagonal(Mat,double,IS,IS); 238 239 extern int MatCholeskyFactor(Mat,IS,double); 240 extern int MatCholeskyFactorSymbolic(Mat,IS,double,Mat*); 241 extern int MatCholeskyFactorNumeric(Mat,Mat*); 242 243 /* 244 Context of matrix information, used with MatILUFactor() and MatILUFactorSymbolic() 245 Note: If any entries are added to this context, be sure 246 to adjust MAT_ILUINFO_SIZE in finclude/mat.h 247 248 Note: The integer values below are passed in double to allow easy use from 249 Fortran 250 */ 251 typedef struct { 252 double levels; /* ILU(levels) */ 253 double fill; /* expected fill; nonzeros in factored matrix/nonzeros in original matrix*/ 254 double diagonal_fill; /* force diagonal to fill in if initially not filled */ 255 } MatILUInfo; 256 257 extern int MatLUFactor(Mat,IS,IS,double); 258 extern int MatILUFactor(Mat,IS,IS,MatILUInfo*); 259 extern int MatLUFactorSymbolic(Mat,IS,IS,double,Mat*); 260 extern int MatILUFactorSymbolic(Mat,IS,IS,MatILUInfo*,Mat*); 261 extern int MatIncompleteCholeskyFactorSymbolic(Mat,IS,double,int,Mat*); 262 extern int MatLUFactorNumeric(Mat,Mat*); 263 extern int MatILUDTFactor(Mat,double,int,IS,IS,Mat *); 264 265 extern int MatSolve(Mat,Vec,Vec); 266 extern int MatForwardSolve(Mat,Vec,Vec); 267 extern int MatBackwardSolve(Mat,Vec,Vec); 268 extern int MatSolveAdd(Mat,Vec,Vec,Vec); 269 extern int MatSolveTranspose(Mat,Vec,Vec); 270 extern int MatSolveTransposeAdd(Mat,Vec,Vec,Vec); 271 272 extern int MatSetUnfactored(Mat); 273 274 /* MatSORType may be bitwise ORd together, so do not change the numbers */ 275 276 typedef enum {SOR_FORWARD_SWEEP=1,SOR_BACKWARD_SWEEP=2,SOR_SYMMETRIC_SWEEP=3, 277 SOR_LOCAL_FORWARD_SWEEP=4,SOR_LOCAL_BACKWARD_SWEEP=8, 278 SOR_LOCAL_SYMMETRIC_SWEEP=12,SOR_ZERO_INITIAL_GUESS=16, 279 SOR_EISENSTAT=32,SOR_APPLY_UPPER=64,SOR_APPLY_LOWER=128} MatSORType; 280 extern int MatRelax(Mat,Vec,double,MatSORType,double,int,Vec); 281 282 /* 283 These routines are for efficiently computing Jacobians via finite differences. 284 */ 285 286 typedef char* MatColoringType; 287 #define MATCOLORING_NATURAL "natural" 288 #define MATCOLORING_SL "sl" 289 #define MATCOLORING_LF "lf" 290 #define MATCOLORING_ID "id" 291 292 extern int MatGetColoring(Mat,MatColoringType,ISColoring*); 293 extern int MatColoringRegister(char*,char*,char*,int(*)(Mat,MatColoringType,ISColoring *)); 294 #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 295 #define MatColoringRegisterDynamic(a,b,c,d) MatColoringRegister(a,b,c,0) 296 #else 297 #define MatColoringRegisterDynamic(a,b,c,d) MatColoringRegister(a,b,c,d) 298 #endif 299 extern int MatColoringRegisterAll(char *); 300 extern int MatColoringRegisterAllCalled; 301 extern int MatColoringRegisterDestroy(void); 302 extern int MatColoringPatch(Mat,int,int *,ISColoring*); 303 304 /* 305 Data structures used to compute Jacobian vector products 306 efficiently using finite differences. 307 */ 308 #define MAT_FDCOLORING_COOKIE PETSC_COOKIE + 23 309 310 typedef struct _p_MatFDColoring *MatFDColoring; 311 312 extern int MatFDColoringCreate(Mat,ISColoring,MatFDColoring *); 313 extern int MatFDColoringDestroy(MatFDColoring); 314 extern int MatFDColoringView(MatFDColoring,Viewer); 315 extern int MatFDColoringSetFunction(MatFDColoring,int (*)(void),void*); 316 extern int MatFDColoringSetParameters(MatFDColoring,double,double); 317 extern int MatFDColoringSetFrequency(MatFDColoring,int); 318 extern int MatFDColoringGetFrequency(MatFDColoring,int*); 319 extern int MatFDColoringSetFromOptions(MatFDColoring); 320 extern int MatFDColoringPrintHelp(MatFDColoring); 321 extern int MatFDColoringApply(Mat,MatFDColoring,Vec,MatStructure*,void *); 322 extern int MatFDColoringApplyTS(Mat,MatFDColoring,double,Vec,MatStructure*,void *); 323 324 /* 325 These routines are for partitioning matrices: currently used only 326 for adjacency matrix, MatCreateSeqAdj() or MatCreateMPIAdj(). 327 */ 328 #define MATPARTITIONING_COOKIE PETSC_COOKIE + 25 329 330 typedef struct _p_MatPartitioning *MatPartitioning; 331 typedef char* MatPartitioningType; 332 #define MATPARTITIONING_CURRENT "current" 333 #define MATPARTITIONING_PARMETIS "parmetis" 334 335 extern int MatPartitioningCreate(MPI_Comm,MatPartitioning*); 336 extern int MatPartitioningSetType(MatPartitioning,MatPartitioningType); 337 extern int MatPartitioningSetAdjacency(MatPartitioning,Mat); 338 extern int MatPartitioningSetVertexWeights(MatPartitioning,double*); 339 extern int MatPartitioningApply(MatPartitioning,IS*); 340 extern int MatPartitioningDestroy(MatPartitioning); 341 342 extern int MatPartitioningRegister(char*,char*,char*,int(*)(MatPartitioning)); 343 #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 344 #define MatPartitioningRegisterDynamic(a,b,c,d) MatPartitioningRegister(a,b,c,0) 345 #else 346 #define MatPartitioningRegisterDynamic(a,b,c,d) MatPartitioningRegister(a,b,c,d) 347 #endif 348 349 extern int MatPartitioningRegisterAll(char *); 350 extern int MatPartitioningRegisterAllCalled; 351 extern int MatPartitioningRegisterDestroy(void); 352 extern int MatPartitioningView(MatPartitioning,Viewer); 353 extern int MatPartitioningSetFromOptions(MatPartitioning); 354 extern int MatPartitioningPrintHelp(MatPartitioning); 355 extern int MatPartitioningGetType(MatPartitioning,MatPartitioningType*); 356 357 extern int MatPartitioningParmetisSetCoarseSequential(MatPartitioning); 358 359 /* 360 If you add entries here you must also add them to finclude/mat.h 361 */ 362 typedef enum { MATOP_SET_VALUES=0, 363 MATOP_GET_ROW=1, 364 MATOP_RESTORE_ROW=2, 365 MATOP_MULT=3, 366 MATOP_MULT_ADD=4, 367 MATOP_MULT_TRANSPOSE=5, 368 MATOP_MULT_TRANSPOSE_ADD=6, 369 MATOP_SOLVE=7, 370 MATOP_SOLVE_ADD=8, 371 MATOP_SOLVE_TRANSPOSE=9, 372 MATOP_SOLVE_TRANSPOSE_ADD=10, 373 MATOP_LUFACTOR=11, 374 MATOP_CHOLESKYFACTOR=12, 375 MATOP_RELAX=13, 376 MATOP_TRANSPOSE=14, 377 MATOP_GETINFO=15, 378 MATOP_EQUAL=16, 379 MATOP_GET_DIAGONAL=17, 380 MATOP_DIAGONAL_SCALE=18, 381 MATOP_NORM=19, 382 MATOP_ASSEMBLY_BEGIN=20, 383 MATOP_ASSEMBLY_END=21, 384 MATOP_COMPRESS=22, 385 MATOP_SET_OPTION=23, 386 MATOP_ZERO_ENTRIES=24, 387 MATOP_ZERO_ROWS=25, 388 MATOP_LUFACTOR_SYMBOLIC=26, 389 MATOP_LUFACTOR_NUMERIC=27, 390 MATOP_CHOLESKY_FACTOR_SYMBOLIC=28, 391 MATOP_CHOLESKY_FACTOR_NUMERIC=29, 392 MATOP_GET_SIZE=30, 393 MATOP_GET_LOCAL_SIZE=31, 394 MATOP_GET_OWNERSHIP_RANGE=32, 395 MATOP_ILUFACTOR_SYMBOLIC=33, 396 MATOP_INCOMPLETECHOLESKYFACTOR_SYMBOLIC=34, 397 MATOP_GET_ARRAY=35, 398 MATOP_RESTORE_ARRAY=36, 399 400 MATOP_CONVERT_SAME_TYPE=37, 401 MATOP_FORWARD_SOLVE=38, 402 MATOP_BACKWARD_SOLVE=39, 403 MATOP_ILUFACTOR=40, 404 MATOP_INCOMPLETECHOLESKYFACTOR=41, 405 MATOP_AXPY=42, 406 MATOP_GET_SUBMATRICES=43, 407 MATOP_INCREASE_OVERLAP=44, 408 MATOP_GET_VALUES=45, 409 MATOP_COPY=46, 410 MATOP_PRINT_HELP=47, 411 MATOP_SCALE=48, 412 MATOP_SHIFT=49, 413 MATOP_DIAGONAL_SHIFT=50, 414 MATOP_ILUDT_FACTOR=51, 415 MATOP_GET_BLOCK_SIZE=52, 416 MATOP_GET_ROW_IJ=53, 417 MATOP_RESTORE_ROW_IJ=54, 418 MATOP_GET_COLUMN_IJ=55, 419 MATOP_RESTORE_COLUMN_IJ=56, 420 MATOP_FDCOLORING_CREATE=57, 421 MATOP_COLORING_PATCH=58, 422 MATOP_SET_UNFACTORED=59, 423 MATOP_PERMUTE=60, 424 MATOP_SET_VALUES_BLOCKED=61, 425 MATOP_DESTROY=250, 426 MATOP_VIEW=251 427 } MatOperation; 428 extern int MatHasOperation(Mat,MatOperation,PetscTruth*); 429 extern int MatShellSetOperation(Mat,MatOperation,void *); 430 extern int MatShellGetOperation(Mat,MatOperation,void **); 431 432 /* 433 Codes for matrices stored on disk. By default they are 434 stored in a universal format. By changing the format with 435 ViewerSetFormat(viewer,VIEWER_FORMAT_BINARY_NATIVE); the matrices will 436 be stored in a way natural for the matrix, for example dense matrices 437 would be stored as dense. Matrices stored this way may only be 438 read into matrices of the same time. 439 */ 440 #define MATRIX_BINARY_FORMAT_DENSE -1 441 442 /* 443 New matrix classes not yet distributed 444 */ 445 /* 446 MatAIJIndices is a data structure for storing the nonzero location information 447 for sparse matrices. Several matrices with identical nonzero structure can share 448 the same MatAIJIndices. 449 */ 450 typedef struct _p_MatAIJIndices* MatAIJIndices; 451 452 extern int MatCreateAIJIndices(int,int,int*,int*,PetscTruth,MatAIJIndices*); 453 extern int MatCreateAIJIndicesEmpty(int,int,int*,PetscTruth,MatAIJIndices*); 454 extern int MatAttachAIJIndices(MatAIJIndices,MatAIJIndices*); 455 extern int MatDestroyAIJIndices(MatAIJIndices); 456 extern int MatCopyAIJIndices(MatAIJIndices,MatAIJIndices*); 457 extern int MatValidateAIJIndices(int,MatAIJIndices); 458 extern int MatShiftAIJIndices(MatAIJIndices); 459 extern int MatShrinkAIJIndices(MatAIJIndices); 460 extern int MatTransposeAIJIndices(MatAIJIndices, MatAIJIndices*); 461 462 extern int MatCreateSeqCSN(MPI_Comm,int,int,int*,int,Mat*); 463 extern int MatCreateSeqCSN_Single(MPI_Comm,int,int,int*,int,Mat*); 464 extern int MatCreateSeqCSNWithPrecision(MPI_Comm,int,int,int*,int,ScalarPrecision,Mat*); 465 466 extern int MatCreateSeqCSNIndices(MPI_Comm,MatAIJIndices,int,Mat *); 467 extern int MatCreateSeqCSNIndices_Single(MPI_Comm,MatAIJIndices,int,Mat *); 468 extern int MatCreateSeqCSNIndicesWithPrecision(MPI_Comm,MatAIJIndices,int,ScalarPrecision,Mat *); 469 470 extern int MatMPIBAIJSetHashTableFactor(Mat,double); 471 extern int MatSeqAIJGetInodeSizes(Mat,int *,int *[],int *); 472 473 474 #endif 475 476 477 478