[petsc-users] Matrix dot product

David Gross davegwebb10 at gmail.com
Wed Sep 13 17:14:22 CDT 2017


Hi Matt,
Thank you for getting back to me. Your answer confirms what I thought in
terms of existing functionality. I think it shouldn't be too hard to make a
copy of MatAXPY to MatAXY where it performs Xij = A*Xij*Yij (or without the
A). I could then do the MatNorm of the resulting matrix to get what I need.

Is a MatAXY function desirable as a source contribution?

I am hoping to use PETSc for performing basic vector and matrix operations
on dense matrices and 1D vectors. The main uses are matmult, matmatmult and
matrix additions and scaling. The application is for implementing a
parallel version on an existing Pan-Reif matrix inversion algorithm. The
choice of using PETSc is mostly due to us already using it in the same
program to solve sparse matrices (with MUMPS) with the goal of avoiding
adding yet another package (ex ScaLAPACK/PBLAS) into the code even if other
packages may be more directly oriented towards my application.

Regards,
Dave



On Mon, Sep 11, 2017 at 2:19 AM, Matthew Knepley <knepley at gmail.com> wrote:

> On Sun, Sep 10, 2017 at 5:51 PM, David Gross <davegwebb10 at gmail.com>
> wrote:
>
>> Hello,
>> I was wondering if there was a matrix equivalent to the vecDot function
>> (Frobenius inner product)? As far as I can tell the closest thing is
>> MatNorm with NORM_FROBENIUS, but obviously this is acting on only one
>> matrix.
>>
>> If there is not a built in function, what is the best way to compute
>> this? I am working fortran90.
>>
>
> We do not have this. However, it would be trivial to add since we have
>
>   http://www.mcs.anl.gov/petsc/petsc-current/docs/
> manualpages/Mat/MatAXPY.html
>
> since you just replace + with * in our code. You could argue that we
> should have written for
> a general ring, but C makes this cumbersome. Do you think you could make
> the change?
>
> What are you using this for?
>
>   Thanks,
>
>      Matt
>
>
>> Regards,
>> Dave
>>
>
>
>
> --
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which their
> experiments lead.
> -- Norbert Wiener
>
> http://www.caam.rice.edu/~mk51/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20170914/c6e54b8b/attachment.html>


More information about the petsc-users mailing list