Thanks, Dave. Ernesto.
From: Dave May [mailto:[email protected]] Sent: Thursday, June 25, 2020 2:12 AM To: Ernesto Prudencio <[email protected]> Cc: Jose E. Roman <[email protected]>; [email protected] 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 <[email protected]<mailto:[email protected]>> 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:[email protected]<mailto:[email protected]>] Sent: Thursday, June 25, 2020 1:01 AM To: Ernesto Prudencio <[email protected]<mailto:[email protected]>> Cc: [email protected]<mailto:[email protected]> 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 > <[email protected]<mailto:[email protected]>> 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
