[petsc-dev] MatDiagonalScale default implementation

Hapla Vaclav vaclav.hapla at erdw.ethz.ch
Sat Dec 1 13:49:30 CST 2018


MatDiagonalScale_Shell, MatDiagonalScale_Normal, MatDiagonalScaleHermitian_Normal and perhaps some others are essentially the same.

What about converting them into one MatDiagonalScale_Basic which would be the default implementation if no type-specific implementation is provided?

I'm asking because I wanted to add the same to MATTRANSPOSE. But with my proposal, this redundancy would be removed and additionally MatDiagonalScale() would work for any current or future MatType while it doesn't prevent providing an optimised version for explicit matrix types.

Note the same could be done for MatScale, MatShift, MatDiagonalSet and maybe some others.

I also think such approach would promote using such high-level API functions in higher PETSc layers and user codes because one wouldn't have to be afraid those methods might not be implemented in input matrices.

Thanks for opinions

Vaclav


More information about the petsc-dev mailing list