[petsc-dev] MatMatMult double dispatch

Jed Brown jedbrown at mcs.anl.gov
Fri Oct 28 16:08:27 CDT 2011


On Fri, Oct 28, 2011 at 15:00, Dmitry Karpeev <karpeev at mcs.anl.gov> wrote:

> Why does the double dispatch for A*B only looks for the implementation in
> B's FList?
> Is there any deep reason for this?
>

This is exactly the same problem as discussed in this thread:

http://lists.mcs.anl.gov/pipermail/petsc-dev/2011-October/006105.html

I think we should define this static global dispatch table (my suggested
implementation was especially simple because it reuses PetscFList, but there
are alternatives) and add a function MatMatMultRegister().

To my knowledge, Sean hasn't started implementing this yet.


> If I implement a new Mat type, say MATFOO, and want to make it be able pre-
> and post-multiply
> an existing type MATBAR, it looks like I have to add "MatMatMult_foo_bar_C"
> to MATBAR's FList,
> which is annoying, since I don't want to have to touch MATBAR's constructor
> code.
> I acknowledge that there is a certain amount of ambiguity possible, if both
> MATFOO and MATBAR
> had "MatMatMult_foo_bar_C" on their FLists, but one or the other would
> predictably take precedence.
>

Viewer also has the same problem. See the email thread from a couple years
ago in which I was suggesting a symmetric dispatch mechanism.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20111028/3ea96834/attachment.html>


More information about the petsc-dev mailing list