On Tue, Apr 25, 2023 at 2:21 PM Suh, Hansol via petsc-users <
[email protected]> wrote:

> Actually, let me take that back , about inability to access LMVM.
>
> You can access LMVM Hessian mat after you are done with TaoSolve, but not
> within the iteration.
>

Good catch. You could do this in the iteration with a monitor.

  Thanks,

     Matt


> See:
>
> ```
>     PetscCall(TaoGetKSP(tao, &ksp));
>     PetscCall(KSPGetPC(ksp, &pc));
>     PetscCall(PCLMVMGetMatLMVM(pc, &M));
>     PetscCall(VecDuplicate(x, &in));
>     PetscCall(VecDuplicate(x, &out));
>     PetscCall(VecDuplicate(x, &out2));
>     PetscCall(VecSet(in, 1.0));
>     PetscCall(MatMult(M, in, out));
>     PetscCall(MatSolve(M, out, out2));
>     PetscCall(VecAXPY(out2, -1.0, in));
>     PetscCall(VecNorm(out2, NORM_2, &mult_solve_dist));
> ```
> (tao/unconstrained/tutorials/rosenbrock1.c)
>
> Hope this helps.
>
> ------------------------------
> *From:* petsc-users <[email protected]> on behalf of Suh,
> Hansol via petsc-users <[email protected]>
> *Sent:* Tuesday, April 25, 2023 12:56 PM
> *To:* [email protected] <[email protected]>
> *Cc:* Isaac, Toby <[email protected]>; [email protected] <
> [email protected]>
> *Subject:* Re: [petsc-users] obtaining estimated Hessian in BQNLS
>
> petsc's QN routines uses limited-memory variable metric format, which
> means explicit hessian is not constructed.
> Instead of creating explicit hessian, TAO uses MatSolve, and MatMult, to
> "access" the hessian. So you can have access to Hx, and H^{-1}x, but not H
> matrix by itself.
> And as of right now, there isn't a way to access such Hx, and H^{-1}x.
> (which also means that even if the routines to access Hx, H^{-1}x were
> there, getting those at each iteration doesn't really show much
> information, I think.)
>
>
> (Sorry for email reply-chain screw up..)
>
>
> *From: *Stefano Carli <[email protected]>
> *Subject: **[petsc-users] obtaining estimated Hessian in BQNLS*
> *Date: *April 25, 2023 at 4:15:35 AM EDT
> *To: *"[email protected]" <[email protected]>
> *Message-Id: *<
> [email protected]>
>
> Dear PETSc developers,
>
> I’m using PETSc version 3.14.1 coupled to a Fortran code, and I was
> wondering if there is a way of obtaining in output, possibly at each
> iteration, the estimated Hessian matrix for the BQNLS method.
>
> Thank you in advance and best regards,
> Stefano Carli
>
>
>

-- 
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/>

Reply via email to