[petsc-users] [EXTERNAL] Re: J^T J p calculation

Park, Heeho heepark at sandia.gov
Thu Apr 9 16:01:30 CDT 2020


Right. That sounds good

Heeho Park

On Apr 9, 2020, at 2:44 PM, Matthew Knepley <knepley at gmail.com> wrote:


On Thu, Apr 9, 2020 at 3:41 PM Park, Heeho via petsc-users <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>> wrote:

Hi PETSc developers,


I am trying to formulate


p^T J^T J p


where p is a solution vector length n, J is Jacobian n-by-n matrix.


Ref: https://en.wikipedia.org/wiki/Gauss%E2%80%93Newton_algorithm under Large-scale optimization


It is known that for parallel computations, the best way to perform this computation (with csr matrix) is


J^T J p = SUM_i [ c_i ( c_i dot p) ] which results in a vector.

I don't think so. Why not just do

  y = J p

  y^t y = p^T J^T J p

  Thanks,

    Matt


In PFLOTRAN, we use mpibaij matrix. I could not find a PETSc command to perform this with one command.

Is there one I couldn't find? if not, is using MATGETROW with C for-loop a good way to do this?


I currently use, MatMult(J,p,w); MatMultTranspose(J,w,w2); VecDotRealPart(p,w2);


Best,


Heeho Daniel Park

! ------------------------------------ !
Sandia National Laboratories
Org: 08844, R&D
Work: 505-844-1319
! ------------------------------------ !


--
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/20200409/b23afe7b/attachment-0001.html>


More information about the petsc-users mailing list