Actual source code: strumpack.c

  1: #include <../src/mat/impls/aij/seq/aij.h>
  2: #include <../src/mat/impls/aij/mpi/mpiaij.h>
  3: #include <petscmat.h>

  5: const char *const MatSTRUMPACKCompressionTypes[] = {"NONE", "HSS", "BLR", "HODLR", "BLR_HODLR", "ZFP_BLR_HODLR", "LOSSLESS", "LOSSY", "MatSTRUMPACKCompressionType", "", NULL};
  6: const char *const MatSTRUMPACKReorderingTypes[]  = {"NATURAL", "METIS", "PARMETIS", "SCOTCH", "PTSCOTCH", "RCM", "GEOMETRIC", "AMD", "MMD", "AND", "MLF", "SPECTRAL", "MatSTRUMPACKReordering", "", NULL};

  8: /*@
  9:   MatSTRUMPACKSetReordering - Set STRUMPACK <https://portal.nersc.gov/project/sparse/strumpack/master> fill-reducing reordering

 11:   Logically Collective

 13:   Input Parameters:
 14: + F          - the factored matrix obtained by calling `MatGetFactor()` from PETSc-STRUMPACK interface
 15: - reordering - the code to be used to find the fill-reducing reordering

 17:   Options Database Key:
 18: . -mat_strumpack_reordering (natural|metis|parmetis|scotch|ptscotch|rcm|geometric|amd|mmd|and|mlf|spectral) - Sparsity reducing matrix reordering, see `MatSTRUMPACKReordering`

 20:   Level: intermediate

 22: .seealso: `MATSOLVERSTRUMPACK`, [](ch_matrices), `Mat`, `MatSTRUMPACKReordering`, `MatGetFactor()`, `MatSTRUMPACKSetColPerm()`, `MatSTRUMPACKGetReordering()`
 23: @*/
 24: PetscErrorCode MatSTRUMPACKSetReordering(Mat F, MatSTRUMPACKReordering reordering)
 25: {
 26:   PetscFunctionBegin;
 29:   PetscTryMethod(F, "MatSTRUMPACKSetReordering_C", (Mat, MatSTRUMPACKReordering), (F, reordering));
 30:   PetscFunctionReturn(PETSC_SUCCESS);
 31: }
 32: /*@
 33:   MatSTRUMPACKGetReordering - Get STRUMPACK <https://portal.nersc.gov/project/sparse/strumpack/master> fill-reducing reordering

 35:   Logically Collective

 37:   Input Parameters:
 38: . F - the factored matrix obtained by calling `MatGetFactor()` from PETSc-STRUMPACK interface

 40:   Output Parameter:
 41: . reordering - the code to be used to find the fill-reducing reordering

 43:   Level: intermediate

 45: .seealso: `MATSOLVERSTRUMPACK`, [](ch_matrices), `Mat`, `MatSTRUMPACKReordering`, `MatGetFactor()`, `MatSTRUMPACKSetReordering()`, `MatSTRUMPACKSetColPerm()`
 46: @*/
 47: PetscErrorCode MatSTRUMPACKGetReordering(Mat F, MatSTRUMPACKReordering *reordering)
 48: {
 49:   PetscFunctionBegin;
 51:   PetscUseMethod(F, "MatSTRUMPACKGetReordering_C", (Mat, MatSTRUMPACKReordering *), (F, reordering));
 53:   PetscFunctionReturn(PETSC_SUCCESS);
 54: }

 56: /*@
 57:   MatSTRUMPACKSetColPerm - Set whether STRUMPACK <https://portal.nersc.gov/project/sparse/strumpack/master>
 58:   should try to permute the columns of the matrix in order to get a nonzero diagonal

 60:   Logically Collective

 62:   Input Parameters:
 63: + F     - the factored matrix obtained by calling `MatGetFactor()`
 64: - cperm - `PETSC_TRUE` to permute (internally) the columns of the matrix

 66:   Options Database Key:
 67: . -mat_strumpack_colperm (true|false) - true to use the permutation

 69:   Level: intermediate

 71: .seealso: `MATSOLVERSTRUMPACK`, [](ch_matrices), `MatSTRUMPACKSetReordering()`, `Mat`, `MatGetFactor()`, `MatSTRUMPACKGetColPerm()`
 72: @*/
 73: PetscErrorCode MatSTRUMPACKSetColPerm(Mat F, PetscBool cperm)
 74: {
 75:   PetscFunctionBegin;
 78:   PetscTryMethod(F, "MatSTRUMPACKSetColPerm_C", (Mat, PetscBool), (F, cperm));
 79:   PetscFunctionReturn(PETSC_SUCCESS);
 80: }
 81: /*@
 82:   MatSTRUMPACKGetColPerm - Get whether STRUMPACK <https://portal.nersc.gov/project/sparse/strumpack/master>
 83:   will try to permute the columns of the matrix in order to get a nonzero diagonal

 85:   Logically Collective

 87:   Input Parameters:
 88: . F - the factored matrix obtained by calling `MatGetFactor()`

 90:   Output Parameter:
 91: . cperm - Indicates whether STRUMPACK will permute columns

 93:   Level: intermediate

 95: .seealso: `MATSOLVERSTRUMPACK`, [](ch_matrices), `MatSTRUMPACKSetReordering()`, `Mat`, `MatGetFactor()`, `MatSTRUMPACKSetColPerm()`
 96: @*/
 97: PetscErrorCode MatSTRUMPACKGetColPerm(Mat F, PetscBool *cperm)
 98: {
 99:   PetscFunctionBegin;
101:   PetscUseMethod(F, "MatSTRUMPACKGetColPerm_C", (Mat, PetscBool *), (F, cperm));
103:   PetscFunctionReturn(PETSC_SUCCESS);
104: }

106: /*@
107:   MatSTRUMPACKSetGPU - Set whether STRUMPACK <https://portal.nersc.gov/project/sparse/strumpack/master>
108:   should enable GPU acceleration (not supported for all compression types)

110:   Logically Collective

112:   Input Parameters:
113: + F   - the factored matrix obtained by calling `MatGetFactor()` from PETSc-STRUMPACK interface
114: - gpu - whether or not to use GPU acceleration

116:   Options Database Key:
117: . -mat_strumpack_gpu (true|false) - true to use GPU offload

119:   Level: intermediate

121: .seealso: `MATSOLVERSTRUMPACK`, `MatGetFactor()`, `MatSTRUMPACKGetGPU()`
122: @*/
123: PetscErrorCode MatSTRUMPACKSetGPU(Mat F, PetscBool gpu)
124: {
125:   PetscFunctionBegin;
128:   PetscTryMethod(F, "MatSTRUMPACKSetGPU_C", (Mat, PetscBool), (F, gpu));
129:   PetscFunctionReturn(PETSC_SUCCESS);
130: }
131: /*@
132:   MatSTRUMPACKGetGPU - Get whether STRUMPACK <https://portal.nersc.gov/project/sparse/strumpack/master>
133:   will try to use GPU acceleration (not supported for all compression types)

135:   Logically Collective

137:   Input Parameters:
138: . F - the factored matrix obtained by calling `MatGetFactor()` from PETSc-STRUMPACK interface

140:   Output Parameter:
141: . gpu - whether or not STRUMPACK will try to use GPU acceleration

143:   Level: intermediate

145: .seealso: `MATSOLVERSTRUMPACK`, `MatGetFactor()`, `MatSTRUMPACKSetGPU()`
146: @*/
147: PetscErrorCode MatSTRUMPACKGetGPU(Mat F, PetscBool *gpu)
148: {
149:   PetscFunctionBegin;
151:   PetscUseMethod(F, "MatSTRUMPACKGetGPU_C", (Mat, PetscBool *), (F, gpu));
153:   PetscFunctionReturn(PETSC_SUCCESS);
154: }

156: /*@
157:   MatSTRUMPACKSetCompression - Set STRUMPACK <https://portal.nersc.gov/project/sparse/strumpack/master> compression type

159:   Input Parameters:
160: + F    - the factored matrix obtained by calling `MatGetFactor()` from PETSc-STRUMPACK interface
161: - comp - Type of compression to be used in the approximate sparse factorization

163:   Options Database Key:
164: . -mat_strumpack_compression (none|hss|blr|hodlr|blr_hodlr|zfp_blr_hodlr|lossless|lossy) - Type of rank-structured compression in sparse LU factors

166:   Level: intermediate

168:   Note:
169:   Default for compression is `MAT_STRUMPACK_COMPRESSION_TYPE_NONE` for `-pc_type lu` and `MAT_STRUMPACK_COMPRESSION_TYPE_BLR`
170:   for `-pc_type ilu`

172: .seealso: `MATSOLVERSTRUMPACK`, `MatGetFactor()`, `MatSTRUMPACKCompressionType`, `MatSTRUMPACKGetCompression()`
173: @*/
174: PetscErrorCode MatSTRUMPACKSetCompression(Mat F, MatSTRUMPACKCompressionType comp)
175: {
176:   PetscFunctionBegin;
179:   PetscTryMethod(F, "MatSTRUMPACKSetCompression_C", (Mat, MatSTRUMPACKCompressionType), (F, comp));
180:   PetscFunctionReturn(PETSC_SUCCESS);
181: }
182: /*@
183:   MatSTRUMPACKGetCompression - Get STRUMPACK <https://portal.nersc.gov/project/sparse/strumpack/master> compression type

185:   Input Parameters:
186: . F - the factored matrix obtained by calling `MatGetFactor()` from PETSc-STRUMPACK interface

188:   Output Parameter:
189: . comp - Type of compression to be used in the approximate sparse factorization

191:   Level: intermediate

193: .seealso: `MATSOLVERSTRUMPACK`, `MatGetFactor()`, `MatSTRUMPACKCompressionType`, `MatSTRUMPACKSetCompression()`
194: @*/
195: PetscErrorCode MatSTRUMPACKGetCompression(Mat F, MatSTRUMPACKCompressionType *comp)
196: {
197:   PetscFunctionBegin;
199:   PetscUseMethod(F, "MatSTRUMPACKGetCompression_C", (Mat, MatSTRUMPACKCompressionType *), (F, comp));
201:   PetscFunctionReturn(PETSC_SUCCESS);
202: }

204: /*@
205:   MatSTRUMPACKSetCompRelTol - Set STRUMPACK <https://portal.nersc.gov/project/sparse/strumpack/master> relative tolerance for compression

207:   Logically Collective

209:   Input Parameters:
210: + F    - the factored matrix obtained by calling `MatGetFactor()`
211: - rtol - relative compression tolerance

213:   Options Database Key:
214: . -mat_strumpack_compression_rel_tol rel_tol - Relative compression tolerance, when using `-pctype ilu`

216:   Level: intermediate

218: .seealso: `MATSOLVERSTRUMPACK`, [](ch_matrices), `Mat`, `MatGetFactor()`, `MatSTRUMPACKGetCompRelTol()`, `MatSTRUMPACKSetReordering()`, `MatSTRUMPACKSetColPerm()`
219: @*/
220: PetscErrorCode MatSTRUMPACKSetCompRelTol(Mat F, PetscReal rtol)
221: {
222:   PetscFunctionBegin;
225:   PetscTryMethod(F, "MatSTRUMPACKSetCompRelTol_C", (Mat, PetscReal), (F, rtol));
226:   PetscFunctionReturn(PETSC_SUCCESS);
227: }
228: /*@
229:   MatSTRUMPACKGetCompRelTol - Get STRUMPACK <https://portal.nersc.gov/project/sparse/strumpack/master> relative tolerance for compression

231:   Logically Collective

233:   Input Parameters:
234: . F - the factored matrix obtained by calling `MatGetFactor()`

236:   Output Parameter:
237: . rtol - relative compression tolerance

239:   Level: intermediate

241: .seealso: `MATSOLVERSTRUMPACK`, [](ch_matrices), `Mat`, `MatGetFactor()`, `MatSTRUMPACKSetCompRelTol()`, `MatSTRUMPACKSetReordering()`, `MatSTRUMPACKSetColPerm()`
242: @*/
243: PetscErrorCode MatSTRUMPACKGetCompRelTol(Mat F, PetscReal *rtol)
244: {
245:   PetscFunctionBegin;
247:   PetscUseMethod(F, "MatSTRUMPACKGetCompRelTol_C", (Mat, PetscReal *), (F, rtol));
249:   PetscFunctionReturn(PETSC_SUCCESS);
250: }

252: /*@
253:   MatSTRUMPACKSetCompAbsTol - Set STRUMPACK <https://portal.nersc.gov/project/sparse/strumpack/master> absolute tolerance for compression

255:   Logically Collective

257:   Input Parameters:
258: + F    - the factored matrix obtained by calling `MatGetFactor()`
259: - atol - absolute compression tolerance

261:   Options Database Key:
262: . -mat_strumpack_compression_abs_tol abs_tol - Absolute compression tolerance, when using `-pctype ilu`

264:   Level: intermediate

266: .seealso: `MATSOLVERSTRUMPACK`, [](ch_matrices), `Mat`, `MatGetFactor()`, `MatSTRUMPACKGetCompAbsTol()`, `MatSTRUMPACKSetReordering()`, `MatSTRUMPACKSetColPerm()`
267: @*/
268: PetscErrorCode MatSTRUMPACKSetCompAbsTol(Mat F, PetscReal atol)
269: {
270:   PetscFunctionBegin;
273:   PetscTryMethod(F, "MatSTRUMPACKSetCompAbsTol_C", (Mat, PetscReal), (F, atol));
274:   PetscFunctionReturn(PETSC_SUCCESS);
275: }
276: /*@
277:   MatSTRUMPACKGetCompAbsTol - Get STRUMPACK <https://portal.nersc.gov/project/sparse/strumpack/master> absolute tolerance for compression

279:   Logically Collective

281:   Input Parameters:
282: . F - the factored matrix obtained by calling `MatGetFactor()`

284:   Output Parameter:
285: . atol - absolute compression tolerance

287:   Level: intermediate

289: .seealso: `MATSOLVERSTRUMPACK`, [](ch_matrices), `Mat`, `MatGetFactor()`, `MatSTRUMPACKSetCompAbsTol()`, `MatSTRUMPACKSetReordering()`, `MatSTRUMPACKSetColPerm()`
290: @*/
291: PetscErrorCode MatSTRUMPACKGetCompAbsTol(Mat F, PetscReal *atol)
292: {
293:   PetscFunctionBegin;
295:   PetscUseMethod(F, "MatSTRUMPACKGetCompAbsTol_C", (Mat, PetscReal *), (F, atol));
297:   PetscFunctionReturn(PETSC_SUCCESS);
298: }

300: /*@
301:   MatSTRUMPACKSetCompLeafSize - Set STRUMPACK <https://portal.nersc.gov/project/sparse/strumpack/master> leaf size for HSS, BLR, HODLR...

303:   Logically Collective

305:   Input Parameters:
306: + F         - the factored matrix obtained by calling `MatGetFactor()` from PETSc-STRUMPACK interface
307: - leaf_size - Size of diagonal blocks in rank-structured approximation

309:   Options Database Key:
310: . -mat_strumpack_compression_leaf_size size - Size of diagonal blocks in rank-structured approximation, when using `-pctype ilu`

312:   Level: intermediate

314: .seealso: `MATSOLVERSTRUMPACK`, [](ch_matrices), `Mat`, `MatGetFactor()`, `MatSTRUMPACKGetCompLeafSize()`, `MatSTRUMPACKSetReordering()`, `MatSTRUMPACKSetColPerm()`
315: @*/
316: PetscErrorCode MatSTRUMPACKSetCompLeafSize(Mat F, PetscInt leaf_size)
317: {
318:   PetscFunctionBegin;
321:   PetscTryMethod(F, "MatSTRUMPACKSetCompLeafSize_C", (Mat, PetscInt), (F, leaf_size));
322:   PetscFunctionReturn(PETSC_SUCCESS);
323: }
324: /*@
325:   MatSTRUMPACKGetCompLeafSize - Get STRUMPACK <https://portal.nersc.gov/project/sparse/strumpack/master> leaf size for HSS, BLR, HODLR...

327:   Logically Collective

329:   Input Parameters:
330: . F - the factored matrix obtained by calling `MatGetFactor()` from PETSc-STRUMPACK interface

332:   Output Parameter:
333: . leaf_size - Size of diagonal blocks in rank-structured approximation

335:   Level: intermediate

337: .seealso: `MATSOLVERSTRUMPACK`, [](ch_matrices), `Mat`, `MatGetFactor()`, `MatSTRUMPACKSetCompLeafSize()`, `MatSTRUMPACKSetReordering()`, `MatSTRUMPACKSetColPerm()`
338: @*/
339: PetscErrorCode MatSTRUMPACKGetCompLeafSize(Mat F, PetscInt *leaf_size)
340: {
341:   PetscFunctionBegin;
343:   PetscUseMethod(F, "MatSTRUMPACKGetCompLeafSize_C", (Mat, PetscInt *), (F, leaf_size));
345:   PetscFunctionReturn(PETSC_SUCCESS);
346: }

348: /*@
349:   MatSTRUMPACKSetGeometricNxyz - Set STRUMPACK <https://portal.nersc.gov/project/sparse/strumpack/master> mesh x, y and z dimensions, for use with
350:   the `MAT_STRUMPACK_GEOMETRIC` value of `MatSTRUMPACKReordering`

352:   Logically Collective

354:   Input Parameters:
355: + F  - the factored matrix obtained by calling `MatGetFactor()` from PETSc-STRUMPACK interface
356: . nx - x dimension of the mesh
357: . ny - y dimension of the mesh
358: - nz - z dimension of the mesh

360:   Level: intermediate

362:   Note:
363:   If the mesh is two (or one) dimensional one can use 1, `PETSC_DECIDE` or `PETSC_DEFAULT`
364:   for the missing z (and y) dimensions.

366: .seealso: `MATSOLVERSTRUMPACK`, `MatGetFactor()`, `MAT_STRUMPACK_GEOMETRIC`, `MatSTRUMPACKReordering`
367: @*/
368: PetscErrorCode MatSTRUMPACKSetGeometricNxyz(Mat F, PetscInt nx, PetscInt ny, PetscInt nz)
369: {
370:   PetscFunctionBegin;
375:   PetscTryMethod(F, "MatSTRUMPACKSetGeometricNxyz_C", (Mat, PetscInt, PetscInt, PetscInt), (F, nx, ny, nz));
376:   PetscFunctionReturn(PETSC_SUCCESS);
377: }
378: /*@
379:   MatSTRUMPACKSetGeometricComponents - Set STRUMPACK <https://portal.nersc.gov/project/sparse/strumpack/master>
380:   number of degrees of freedom per mesh point, for use with the `MAT_STRUMPACK_GEOMETRIC` value of `MatSTRUMPACKReordering`

382:   Logically Collective

384:   Input Parameters:
385: + F  - the factored matrix obtained by calling `MatGetFactor()` from PETSc-STRUMPACK interface
386: - nc - Number of components/dof's per grid point

388:   Options Database Key:
389: . -mat_strumpack_geometric_components dof - Number of components per mesh point, for geometric nested dissection ordering

391:   Level: intermediate

393: .seealso: `MATSOLVERSTRUMPACK`, `MatGetFactor()`, `MAT_STRUMPACK_GEOMETRIC`, `MatSTRUMPACKReordering`
394: @*/
395: PetscErrorCode MatSTRUMPACKSetGeometricComponents(Mat F, PetscInt nc)
396: {
397:   PetscFunctionBegin;
400:   PetscTryMethod(F, "MatSTRUMPACKSetGeometricComponents_C", (Mat, PetscInt), (F, nc));
401:   PetscFunctionReturn(PETSC_SUCCESS);
402: }
403: /*@
404:   MatSTRUMPACKSetGeometricWidth - Set STRUMPACK <https://portal.nersc.gov/project/sparse/strumpack/master> width of the separator, for use with
405:   the `MAT_STRUMPACK_GEOMETRIC` value of `MatSTRUMPACKReordering`

407:   Logically Collective

409:   Input Parameters:
410: + F - the factored matrix obtained by calling `MatGetFactor()` from PETSc-STRUMPACK interface
411: - w - width of the separator

413:   Options Database Key:
414: . -mat_strumpack_geometric_width width - Width of the separator of the mesh, for geometric nested dissection ordering

416:   Level: intermediate

418: .seealso: `MATSOLVERSTRUMPACK`, `MatGetFactor()`, `MAT_STRUMPACK_GEOMETRIC`, `MatSTRUMPACKReordering`
419: @*/
420: PetscErrorCode MatSTRUMPACKSetGeometricWidth(Mat F, PetscInt w)
421: {
422:   PetscFunctionBegin;
425:   PetscTryMethod(F, "MatSTRUMPACKSetGeometricWidth_C", (Mat, PetscInt), (F, w));
426:   PetscFunctionReturn(PETSC_SUCCESS);
427: }

429: /*@
430:   MatSTRUMPACKSetCompMinSepSize - Set STRUMPACK <https://portal.nersc.gov/project/sparse/strumpack/master> minimum separator size for low-rank approximation

432:   Logically Collective

434:   Input Parameters:
435: + F            - the factored matrix obtained by calling `MatGetFactor()` from PETSc-STRUMPACK interface
436: - min_sep_size - minimum dense matrix size for low-rank approximation

438:   Options Database Key:
439: . -mat_strumpack_compression_min_sep_size min_sep_size - Minimum size of dense sub-block for low-rank compression

441:   Level: intermediate

443: .seealso: `MATSOLVERSTRUMPACK`, `MatGetFactor()`, `MatSTRUMPACKGetCompMinSepSize()`
444: @*/
445: PetscErrorCode MatSTRUMPACKSetCompMinSepSize(Mat F, PetscInt min_sep_size)
446: {
447:   PetscFunctionBegin;
450:   PetscTryMethod(F, "MatSTRUMPACKSetCompMinSepSize_C", (Mat, PetscInt), (F, min_sep_size));
451:   PetscFunctionReturn(PETSC_SUCCESS);
452: }
453: /*@
454:   MatSTRUMPACKGetCompMinSepSize - Get STRUMPACK <https://portal.nersc.gov/project/sparse/strumpack/master> minimum separator size for low-rank approximation

456:   Logically Collective

458:   Input Parameters:
459: . F - the factored matrix obtained by calling `MatGetFactor()` from PETSc-STRUMPACK interface

461:   Output Parameter:
462: . min_sep_size - minimum dense matrix size for low-rank approximation

464:   Level: intermediate

466: .seealso: `MATSOLVERSTRUMPACK`, `MatGetFactor()`, `MatSTRUMPACKSetCompMinSepSize()`
467: @*/
468: PetscErrorCode MatSTRUMPACKGetCompMinSepSize(Mat F, PetscInt *min_sep_size)
469: {
470:   PetscFunctionBegin;
472:   PetscUseMethod(F, "MatSTRUMPACKGetCompMinSepSize_C", (Mat, PetscInt *), (F, min_sep_size));
474:   PetscFunctionReturn(PETSC_SUCCESS);
475: }

477: /*@
478:   MatSTRUMPACKSetCompLossyPrecision - Set STRUMPACK <https://portal.nersc.gov/project/sparse/strumpack/master> precision for lossy compression,
479:   that is `MAT_STRUMPACK_COMPRESSION_TYPE_LOSSY` (requires ZFP support)

481:   Logically Collective

483:   Input Parameters:
484: + F          - the factored matrix obtained by calling `MatGetFactor()` from PETSc-STRUMPACK interface
485: - lossy_prec - Number of bitplanes to use in lossy compression

487:   Options Database Key:
488: . -mat_strumpack_compression_lossy_precision lossy_prec - Precision when using lossy compression [1-64], when using `-pctype ilu -mat_strumpack_compression lossy`

490:   Level: intermediate

492: .seealso: `MATSOLVERSTRUMPACK`, `MatGetFactor()`, `MatSTRUMPACKGetCompLossyPrecision()`, `MAT_STRUMPACK_COMPRESSION_TYPE_LOSSY`
493: @*/
494: PetscErrorCode MatSTRUMPACKSetCompLossyPrecision(Mat F, PetscInt lossy_prec)
495: {
496:   PetscFunctionBegin;
499:   PetscTryMethod(F, "MatSTRUMPACKSetCompLossyPrecision_C", (Mat, PetscInt), (F, lossy_prec));
500:   PetscFunctionReturn(PETSC_SUCCESS);
501: }
502: /*@
503:   MatSTRUMPACKGetCompLossyPrecision - Get STRUMPACK <https://portal.nersc.gov/project/sparse/strumpack/master> precision for lossy compression,
504:   that is `MAT_STRUMPACK_COMPRESSION_TYPE_LOSSY`

506:   Logically Collective

508:   Input Parameters:
509: . F - the factored matrix obtained by calling `MatGetFactor()` from PETSc-STRUMPACK interface

511:   Output Parameter:
512: . lossy_prec - Number of bitplanes to use in lossy compression

514:   Level: intermediate

516: .seealso: `MATSOLVERSTRUMPACK`, `MatGetFactor()`, `MatSTRUMPACKSetCompLossyPrecision()`, `MAT_STRUMPACK_COMPRESSION_TYPE_LOSSY`
517: @*/
518: PetscErrorCode MatSTRUMPACKGetCompLossyPrecision(Mat F, PetscInt *lossy_prec)
519: {
520:   PetscFunctionBegin;
522:   PetscUseMethod(F, "MatSTRUMPACKGetCompLossyPrecision_C", (Mat, PetscInt *), (F, lossy_prec));
524:   PetscFunctionReturn(PETSC_SUCCESS);
525: }

527: /*@
528:   MatSTRUMPACKSetCompButterflyLevels - Set STRUMPACK <https://portal.nersc.gov/project/sparse/strumpack/master>
529:   number of butterfly levels in `MAT_STRUMPACK_COMPRESSION_TYPE_HODLR`, `MAT_STRUMPACK_COMPRESSION_TYPE_BLR_HODLR`, or
530:   `MAT_STRUMPACK_COMPRESSION_TYPE_ZFP_BLR_HODLR` compression (requires ButterflyPACK support)

532:   Logically Collective

534:   Input Parameters:
535: + F         - the factored matrix obtained by calling `MatGetFactor()` from PETSc-STRUMPACK interface
536: - bfly_lvls - Number of levels of butterfly compression in HODLR compression

538:   Options Database Key:
539: . -mat_strumpack_compression_butterfly_levels bfly_lvls - Number of levels in the hierarchically off-diagonal matrix for which to use butterfly

541:   Level: intermediate

543: .seealso: `MATSOLVERSTRUMPACK`, `MatGetFactor()`, `MatSTRUMPACKGetCompButterflyLevels()`, `MAT_STRUMPACK_COMPRESSION_TYPE_HODLR`,
544:           `MAT_STRUMPACK_COMPRESSION_TYPE_BLR_HODLR`, `MAT_STRUMPACK_COMPRESSION_TYPE_ZFP_BLR_HODLR`
545: @*/
546: PetscErrorCode MatSTRUMPACKSetCompButterflyLevels(Mat F, PetscInt bfly_lvls)
547: {
548:   PetscFunctionBegin;
551:   PetscTryMethod(F, "MatSTRUMPACKSetButterflyLevels_C", (Mat, PetscInt), (F, bfly_lvls));
552:   PetscFunctionReturn(PETSC_SUCCESS);
553: }
554: /*@
555:   MatSTRUMPACKGetCompButterflyLevels - Get STRUMPACK <https://portal.nersc.gov/project/sparse/strumpack/master>
556:   number of butterfly levels in `MAT_STRUMPACK_COMPRESSION_TYPE_HODLR`, `MAT_STRUMPACK_COMPRESSION_TYPE_BLR_HODLR`, or
557:   `MAT_STRUMPACK_COMPRESSION_TYPE_ZFP_BLR_HODLR` compression (requires ButterflyPACK support)

559:   Logically Collective

561:   Input Parameters:
562: . F - the factored matrix obtained by calling `MatGetFactor()` from PETSc-STRUMPACK interface

564:   Output Parameter:
565: . bfly_lvls - Number of levels of butterfly compression in compression

567:   Level: intermediate

569: .seealso: `MATSOLVERSTRUMPACK`, `MatGetFactor()`, `MatSTRUMPACKSetCompButterflyLevels()`, `MAT_STRUMPACK_COMPRESSION_TYPE_HODLR`,
570:           `MAT_STRUMPACK_COMPRESSION_TYPE_BLR_HODLR`, `MAT_STRUMPACK_COMPRESSION_TYPE_ZFP_BLR_HODLR`
571: @*/
572: PetscErrorCode MatSTRUMPACKGetCompButterflyLevels(Mat F, PetscInt *bfly_lvls)
573: {
574:   PetscFunctionBegin;
576:   PetscUseMethod(F, "MatSTRUMPACKGetButterflyLevels_C", (Mat, PetscInt *), (F, bfly_lvls));
578:   PetscFunctionReturn(PETSC_SUCCESS);
579: }