MatProduct query mechanism and fallbacks?
Now that @hongzhangsun made the effort of reorganizing the Mat-Mat operations, it would be nice to have a query support mechanism, say PetscErrorCode MatProductIsSupported(MatProduct,PetscBool*)
or so, so that we can know in advance if we have a specific operation or not.
This entails reworking MatProductSetFromOptions_XXX
to return the function pointer instead of failing if not found. This can also land the basis to have _Basic
operations in place if the pointer is not found (i.e., a PtAP can generate a MATSHELL
matrix whose mult method is a sequence of three matvecs.