[petsc-users] Correct Usage of MatDiagonalSet
Edoardo alinovi
edoardo.alinovi at gmail.com
Mon May 25 11:54:37 CDT 2020
Cool, thanks a lot!
On Mon, 25 May 2020, 18:52 Jed Brown, <jed at jedbrown.org> wrote:
> Edoardo alinovi <edoardo.alinovi at gmail.com> writes:
>
> > Dear Guys,
> >
> > I have quick question for you. Can anyone tell me if MatDiagonalSet needs
> > also MatAssemblyBegin/MatAssemblyEnd to be called afterwards or not?
>
> It's called internally so you don't have to call again.
>
> > Basically, I am trying to compute: sum (a_nb*\phi_nb), where anb are the
> > off diagonal coeffs of the matrix and phi_nb the corresponding field
> > values.
> >
> > I was thinking to set the matrix diagonal to zero using MatDiagonalSet
> and
> > then simply use MatMult(A, x) to accomplish my task. Do we have a better
> > way in PETSc? Any suggestion in welcome :)
>
> An alternative would be to extract the diagonal and subtract off the
> result of VecPointwiseMult(w, diag, phi).
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200525/4c07a44d/attachment.html>
More information about the petsc-users
mailing list