[petsc-users] componentwise matrix multiplication

Barry Smith bsmith at petsc.dev
Wed Aug 12 12:38:31 CDT 2020


   When the sparse matrices have the same nonzero structure then you also just get access to the two arrays as in the dense case.

   For two general sparse you can look at the code for MatAXPY and do the same thing but with multiply.

   Barry

> On Aug 11, 2020, at 10:31 PM, Zhang, Hong via petsc-users <petsc-users at mcs.anl.gov> wrote:
> 
> Marius,
> 
> Ok I see, it is not so important I was just wondering. Presently I only need it for dense matrices, fow now I am just using MatDenseGetArray <https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatDenseGetArray.html> on both matrices and multiply both arrays pointwise, which is ok I guess. For non-dense matrices it may be more complicated.
> 
> This is a good approach for sequential and parallel MatDense matrices.
> Hong
> 
>  
> 
> Von: "Zhang, Hong" <hzhang at mcs.anl.gov <mailto:hzhang at mcs.anl.gov>>
> An: "Marius Buerkle" <mbuerkle at web.de <mailto:mbuerkle at web.de>>, "PETSc users list" <petsc-users at mcs.anl.gov <mailto:petsc-users at mcs.anl.gov>>
> Betreff: Re: [petsc-users] componentwise matrix multiplication
> Marius,
> No. You may write one yourself. Let us know what matrix format do you have. We'll make suggestion to you.
> Hong
> From: petsc-users <petsc-users-bounces at mcs.anl.gov <mailto:petsc-users-bounces at mcs.anl.gov>> on behalf of Marius Buerkle <mbuerkle at web.de <mailto:mbuerkle at web.de>>
> Sent: Monday, August 10, 2020 7:50 PM
> To: PETSc users list <petsc-users at mcs.anl.gov <mailto:petsc-users at mcs.anl.gov>>
> Subject: [petsc-users] componentwise matrix multiplication
>  
> Hi,
>  
> Is there a componentwise matrix multiplication, similar to VecPointwiseMult ?
>  
> Best,
> Marius

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200812/6cc1ee01/attachment.html>


More information about the petsc-users mailing list