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 
> <[email protected]> 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" <[email protected] <mailto:[email protected]>>
> An: "Marius Buerkle" <[email protected] <mailto:[email protected]>>, "PETSc users 
> list" <[email protected] <mailto:[email protected]>>
> 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 <[email protected] 
> <mailto:[email protected]>> on behalf of Marius Buerkle 
> <[email protected] <mailto:[email protected]>>
> Sent: Monday, August 10, 2020 7:50 PM
> To: PETSc users list <[email protected] 
> <mailto:[email protected]>>
> Subject: [petsc-users] componentwise matrix multiplication
>  
> Hi,
>  
> Is there a componentwise matrix multiplication, similar to VecPointwiseMult ?
>  
> Best,
> Marius

Reply via email to