# [petsc-users] solve complex linear system: real or complex formulation

Hong Zhang hzhang at mcs.anl.gov
Sat Dec 10 11:58:45 CST 2011

```I would definitely use complex precision.
All direct sovler packages support complex, superlu, mumps and petsc.

Hong

On Sat, Dec 10, 2011 at 10:03 AM, Jack Poulson <jack.poulson at gmail.com> wrote:
> Xiangdong,
>
> Nearly all of the time in a serial sparse-direct factorization goes into
> performing many different dense "frontal" factorizations. Efficient
> implementations of dense LU factorization spend almost all of their time
> within dense matrix-matrix multiplication, and complex matrix-matrix
> multiplication requires about 4 times as much work as real matrix-matrix
> multiplication, as half the work is in adds and half the work is in
> multiplies with the standard approach (complex addition and multiplication
> are respectively require 2 and 6 real flops).
>
> Overall, a complex sparse-direct solve takes about 4 times as many flops
> (and twice as much memory) as a real sparse-direct solve, but due to having
> a higher arithmetic intensity (roughly, more flops per piece of data), the
> complex version will almost always take significantly less than 4 times as
> long as the real version.
>
> Jack
>
>
> On Fri, Dec 9, 2011 at 11:54 PM, Xiangdong Liang <xdliang at gmail.com> wrote:
>>
>> Hello everyone,
>>
>> I am solving a complex linear system C x = d, where C= A+ iB (A, B are
>> real), in sparse-direct solver. So far, I use the real formulation by
>> solving the linear system [A, -B; B,A].  The reason we chose this
>> approach is to use the property of that the imaginary part B in our
>> problem is sparser than A. However, I just found that the spare-direct
>> solver cannot benefit from this property.
>>
>> Now, I am thinking to re-implement it in to complex version by solving
>> Cx=d in the complex version. Of course, complex formulation would
>> perform better for iterative solvers since it only has half
>> eigenvalues than the corresponding real formulations. I am wondering
>> the comparison between real and complex formulation for sparse-direct
>> solver. Can anyone share experiences on this? Thanks.
>>
>> Xiangdong
>
>
```