[petsc-users] obtaining estimated Hessian in BQNLS

Suh, Hansol hsuh at anl.gov
Tue Apr 25 13:21:46 CDT 2023


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.

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 <petsc-users-bounces at mcs.anl.gov> on behalf of Suh, Hansol via petsc-users <petsc-users at mcs.anl.gov>
Sent: Tuesday, April 25, 2023 12:56 PM
To: petsc-users at mcs.anl.gov <petsc-users at mcs.anl.gov>
Cc: Isaac, Toby <tisaac at anl.gov>; stefano.carli at kuleuven.be <stefano.carli at kuleuven.be>
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 <stefano.carli at kuleuven.be>
Subject: [petsc-users] obtaining estimated Hessian in BQNLS
Date: April 25, 2023 at 4:15:35 AM EDT
To: "petsc-users at mcs.anl.gov" <petsc-users at mcs.anl.gov>
Message-Id: <05357d86ee454f49a8499739c3654b3a at ICTS-S-EXMBX23.luna.kuleuven.be>

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

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


More information about the petsc-users mailing list