[petsc-users] [Ext] Re: Question on SLEPc + computing SVD with a "matrix free" matrix
Ernesto Prudencio
EPrudencio at slb.com
Thu Jun 25 09:14:26 CDT 2020
Thanks, Dave.
Ernesto.
From: Dave May [mailto:dave.mayhem23 at gmail.com]
Sent: Thursday, June 25, 2020 2:12 AM
To: Ernesto Prudencio <EPrudencio at slb.com>
Cc: Jose E. Roman <jroman at dsic.upv.es>; petsc-users at mcs.anl.gov
Subject: Re: [petsc-users] [Ext] Re: Question on SLEPc + computing SVD with a "matrix free" matrix
On Thu 25. Jun 2020 at 08:23, Ernesto Prudencio via petsc-users <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>> wrote:
Thank you, Jose.
However, in the case of a "matrix free" matrix, the APIs on PETSc seem to allow just the implementation of A.v, not of A' . w
One could create another "matrix free" matrix B which could make the role of computing z = B . w = A' . w. But how could one force the routine MatMultTranspose(A, w, z) to call the routine for B? Here I am assuming that MatMultTranspose(A, w, z) is the routine that SLEPc calls internally in its algorithms when the user sets for implicit transpose.
I see two possibilities (for brain storming, since I don't know if such approaches would be acceptable for the PETSc team and/or the SLEPc team):
1) PETSc could add an entry for a second routine that computes [ A' . w ] when calling MatMFFDSetFunction()
MatMFFD is designed for providing the action of the jacobian associated with a nonlinear problem F(x)=0. It uses F to provide a finite difference approx of the action J w. It does not support actions J' w.
You will need to create a MatShell and supply the methods for MatMult and MatMultTranspose (as Jose suggested).
Thanks
Dave
2) SLEPc could add an entry for the routine for computing [ A' . w ] when the matrix A is "matrix free"
Thanks again,
Ernesto.
Schlumberger-Private
-----Original Message-----
From: Jose E. Roman [mailto:jroman at dsic.upv.es<mailto:jroman at dsic.upv.es>]
Sent: Thursday, June 25, 2020 1:01 AM
To: Ernesto Prudencio <EPrudencio at slb.com<mailto:EPrudencio at slb.com>>
Cc: petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>
Subject: [Ext] Re: [petsc-users] Question on SLEPc + computing SVD with a "matrix free" matrix
Yes, you have to set it with SVDSetImplicitTranspose(), but then the matrix-free matrix should implement both "A.v" and "A'.v" operations.
Jose
> El 24 jun 2020, a las 23:25, Ernesto Prudencio via petsc-users <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>> escribió:
>
> Hi,
>
> Is it possible to compute a SVD for a "matrix free" matrix?
>
> At first, it seems it would be ok with a MatCreateMFFD() and MatMFFDSetFunction(), because one could then provide the routine that computes "A . v" for any given v, which is an operation needed by SLEPc. However, one would also need to set up the SVD object in SLEPc with an implicit transpose. Would that be possible?
>
> Thanks in advance,
>
> Ernesto.
>
> Schlumberger-Private
Schlumberger-Private
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200625/20f7c92b/attachment.html>
More information about the petsc-users
mailing list