[petsc-dev] Questions about MatMatTransposeMult/MatMatMultTranspose
Dmitry Karpeev
karpeev at mcs.anl.gov
Tue Nov 1 12:14:40 CDT 2011
On Tue, Nov 1, 2011 at 11:34 AM, Barry Smith <bsmith at mcs.anl.gov> wrote:
>
> I think Jed wants to set these all up to use the dispatch on type table,
> rather than attaching the methods to the objects.
>
In fact, it could be done rather easily even in the most general case. For
example, using a pair of variadic functions:
PetscMethodRegister(void (*f)(void), const char* name, const char*
arg1Type, const char* arg2Type, ...)
PetscMethodQuery(void (**f)(void), const char* name, const char* arg1Type,
const char* arg2Type, ...)
The only wrinkle here is the need to cast f to the right function pointer
type.
Under the hood it's a simple search through an FList on the name and the
arg types.
>
>
> On Nov 1, 2011, at 8:09 AM, Dmitry Karpeev wrote:
>
> > Is there any reason that there isn't dual dispatch support for these
> routines like there is for MatMatMult?
> > If there is no particular reason, I would like to add it, largely for
> the same reasons I'd like symmetric
> > dual dispatch for MatMatMult: the ability to add new implementations
> without screwing around with all of the
> > constructors.
> >
> > Similar considerations would apply to the MatMat*Symbolic routines, as
> well as MatPtAP.
> > I still maintain that the right way to handle these is triple dispatch
> that depends on the type of the output
> > Mat as well, but that would only matter in a handful of corner cases.
> >
> > And a minor question: wouldn't it be better to name these two functions
> MatTransposeMatMult and MatMatTransposeMult
> > respectively, so that the "Transpose" operation sits next to the matrix
> it operates on?
>
> A' * B and A * B' ? Sounds reasonable.
>
Yes: A'*B --> MatTransposeMatMult, and A*B' --> MatMatTransposeMult
Currently its A'*B --> MatMatTransposeMult (which, just by looking at the
name, can be confused with A*B', it seems to me), and A*B' -->
MatMatMultTranspose (which could be mistakenly interpreted as (A*B)').
This is an API change, of course, which might break some user code, but
the fix is a trivial search-and-replace.
Shall I do it?
Dmitry.
>
> Barry
>
> >
> > Dmitry.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20111101/8b41ea74/attachment.html>
More information about the petsc-dev
mailing list