[petsc-users] Using MatCreateComposite with petsc4py

Eric Chamberland Eric.Chamberland at giref.ulaval.ca
Tue Dec 3 15:33:17 CST 2024


Hi,

great!  Thank you all for this information!  Indeed MATPYTHON cover our 
needs!

:)

Eric


On 2024-12-03 01:36, Stefano Zampini wrote:
> Eric
>
> the python equivalent of a MATSHELL is MATPYTHON, where you are in 
> control of the implementation of the matrix vector product and other 
> operations, see 
> https://urldefense.us/v3/__https://petsc.org/release/petsc4py/petsc_python_types.html*petsc-python-matrix-type__;Iw!!G_uCfscf7eWS!ZD3aymPzmAu2afLqaAuAYv18OwPDU-6XWUzuj2lTZ7oyjCjYPx39HcSblHApdBD0BtxMNmBq8_BssfuDCbR1d2QRvp0ds5fft1-XkhiS$ 
>
> This should cover your needs, let me know if you need methods that are 
> not wrapped
>
> Il giorno mar 3 dic 2024 alle ore 09:15 Pierre Jolivet 
> <pierre at joliv.et> ha scritto:
>
>
>
>>     On 2 Dec 2024, at 11:15 PM, Eric Chamberland via petsc-users
>>     <petsc-users at mcs.anl.gov> wrote:
>>
>>     
>>
>>     Hello,
>>
>>     We were exploring the use of the |MatCreateComposite| function
>>     with |petsc4py|, but we noticed that it doesn't seem to be
>>     available in the Python interface
>>     (https://urldefense.us/v3/__https://petsc.org/release/petsc4py/reference/petsc4py.PETSc.Mat.html__;!!G_uCfscf7eWS!ZD3aymPzmAu2afLqaAuAYv18OwPDU-6XWUzuj2lTZ7oyjCjYPx39HcSblHApdBD0BtxMNmBq8_BssfuDCbR1d2QRvp0ds5fftzVa96TG$ 
>>     <https://urldefense.us/v3/__https://petsc.org/release/petsc4py/reference/petsc4py.PETSc.Mat.html__;!!G_uCfscf7eWS!fphemsDPNmxHUr-ybYLt_xWUrP575eKuI4xixwypEzd2g7uc6qMilt8etg13o24gU0vloOVrsHDXwqlgoY1T7jrcQUiv83PrXvNSYlNU$>).
>>
>>     We were wondering if this is due to a technical limitation or if
>>     there is a better alternative to achieve the same result.
>>
>>     Our goal is to create a matrix representing PTAP without
>>     explicitly computing the product.
>>
>>     We also considered using |MatShell|, but it seems that this
>>     approach is not supported in |petsc4py| either.
>>
>     What do you mean?
>     You can use either a MatShell or a MatPython in petsc4py out of
>     the box.
>
>     Thanks,
>     Pierre
>>
>>     On the other hand, we noticed that |MatCreateTranspose| is
>>     implemented, and it aligns somewhat with the kind of operation
>>     we're aiming for.
>>
>>     Any insights or advice you could provide would be greatly
>>     appreciated!
>>
>>     Thank you,
>>
>>     Eric
>>
>>     -- 
>>     Eric Chamberland, ing., M. Ing
>>     Professionnel de recherche
>>     GIREF/Université Laval
>>     (418) 656-2131 poste 41 22 42
>
>
>
> -- 
> Stefano

-- 
Eric Chamberland, ing., M. Ing
Professionnel de recherche
GIREF/Université Laval
(418) 656-2131 poste 41 22 42
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20241203/00416f7e/attachment.html>


More information about the petsc-users mailing list