[petsc-users] Using real and complex matrices together

Manav Bhatia bhatiamanav at gmail.com
Mon Jan 14 09:31:33 CST 2019


I have successfully used Petsc built with real numbers to solve system of equations in complex numbers by representing the NxN complex system of equations as 2Nx2N real system of equations. 

A relevant paper is this: 

@Article{Day2001,
author = {Day, David and Heroux, Michael A}, 
title = {Solving complex-valued linear systems via equivalent real formulations}, 
journal = {SIAM Journal on Scientific Computing}, 
volume = {23}, 
number = {2}, 
pages = {480--498}, 
year = {2001}, 
abstract = {Most preconditioned iterative methods apply to both real-and complex-valued linear systems. At the same time, most iterative linear solver packages available today focus exclusively on real-valued systems or deal with complex-valued systems as an.}, 
location = {}, 
keywords = {}}

Note that it is important to solve this as block matrix, which is the point made in the paper. 

My implementation in MAST is here: https://github.com/MASTmultiphysics/mast-multiphysics/blob/7b5c414e3d85a2712b3054d10be9cddb1b288a82/src/solver/complex_solver_base.cpp#L333


-Manav

> On Jan 14, 2019, at 2:13 AM, Karin&NiKo via petsc-users <petsc-users at mcs.anl.gov> wrote:
> 
> Dear Michael,
> 
> I  also have plans to use PETSc on real and complex objects and, at the moment, I do not see how to do it.
> If possible, could you please comment on how you defined your wrappers and how you link the symbols with the adequate functions? Since both PETSc real and complex  symbols have the same names, I wonder if you use the paths to the different symbols? Also, did you write your wrappers by hand and did you write a script to do it (the hidden question is : do you cover all the objects and methods of the library)?
> 
> I thank you in advance,
> Nicolas
> 
> Le dim. 13 janv. 2019 à 22:13, Povolotskyi, Mykhailo via petsc-users <petsc-users at mcs.anl.gov <mailto:petsc-users at mcs.anl.gov>> a écrit :
> Hi Evan,
> 
> I’m one of those users, who has multiple shared libraries.
> 
> It is quite stable since I create wrappers around the PETSc functions and hide the native PETSc symbols.
> 
> But, yes, the interoperations are not possible.
> 
> Michael.
> 
>  
> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10
> 
>  
> From: Jed Brown via petsc-users <mailto:petsc-users at mcs.anl.gov>
> Sent: Sunday, January 13, 2019 12:48 PM
> To: Evan Um <mailto:evanum at gmail.com>; petsc-users <mailto:petsc-users at mcs.anl.gov>
> Subject: Re: [petsc-users] Using real and complex matrices together
> 
>  
> It is not supported, sorry.  Some users do it with careful linking via
> multiple shared libraries, but that is fragile and doesn't interoperate.
> 
> Evan Um via petsc-users <petsc-users at mcs.anl.gov <mailto:petsc-users at mcs.anl.gov>> writes:
> 
> > Hi PETSC users,
> >
> > Inside my codes, I have both complex and real matrices. To solve complex
> > matrices, I build and use complex version of PETSC. In this case, is there
> > any way to use real matrices too? Do you have such a PETSC code example?
> > Until now, I have used complex matrices to represent real matrices by
> > setting imaginary components of the real matrices to zero. Real value
> > vectors are also realized by setting imaginary components to zero.
> >
> > In advance, thanks for your comments.
> >
> > Evan

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


More information about the petsc-users mailing list