[petsc-users] Sparse Matrix Matrix Multiply
Matthew Knepley
knepley at gmail.com
Thu Aug 12 10:31:10 CDT 2021
On Thu, Aug 12, 2021 at 10:44 AM Alfredo J Duarte Gomez <aduarteg at utexas.edu>
wrote:
> Good morning,
>
> I am currently having some trouble in the creation of some matrices.
>
> I am using structured dmda objects to create matrices using the DMCreate()
> function.
>
> One of these matrices will be the result of a matrix-matrix product of two
> of these dm matrices.
>
> I know that the matrix product will have more nonzero entries or at least
> a bigger stencil than the original dm matrices, however I accounted for
> that when I set the DMDA stencil width in the initial creation.
>
By default, we put zeros into those locations, so you would expand that
stencil when doing MatMatMult(). You can use
-dm_preallocate_only
to prevent the zeros from being included. However, then your target matrix
would not have those locations, so you would
need to turn that off before creating the product matrix, or you could just
make two DMDA with different stencils, since they
are really small. This later solutions sounds cleaner to me.
Thanks,
Matt
> The problem is that even with that, the resulting matrix-matrix product
> has a bigger stencil as evidenced by failure in subsequent matrix
> copy/addition operations using SAME_NONZERO_PATTERN.
>
> Judging by the difference of the nonzero entries I believe that initial
> zero entries (the ones I initialized to eventually hold this
> expaned stencil) on the original dm matrices are being combined to further
> expand the stencil of the product matrix.
>
> Is there any way of getting a matrix-matrix product that will keep the
> same nonzero pattern as the dm matrices?
>
> I have tried both MatMatMult() and the MatProductCreate() sequence so far,
> but both produce nonzero patterns that do not match the dm nonzero pattern.
>
> Thank you,
>
> -Alfredo
>
>
>
> --
> Alfredo Duarte
> Graduate Research Assistant
> The University of Texas at Austin
>
--
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
https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20210812/22f5b34d/attachment.html>
More information about the petsc-users
mailing list