# linear solver for complex matrix

Barry Smith bsmith at mcs.anl.gov
Mon Oct 27 11:20:52 CDT 2008

```    The PETSc MatMultTranspose(), as you state, does not use conjugate
transpose, thus the Krylov methods that
require a conjugate transpose will not work. Unless you change the
MatMultTranpose() routine.
In addition, these algorithms use VecDot(), with the complex
conjugate transpose the order of the arguments to this function
matter (determining which one is conjugated). The coding for these
methods was NOT done to use the proper conjugation
(many of the original references do not include this information).  In
other words PETSc DOES NOT support
complex conjugate for most of the Krylov methods, I think we already
said this before.

If your matrix is complex hermitian why not just use CG, why would
you want to use a different Krylov method?

Barry

On Oct 27, 2008, at 10:11 AM, zhifeng sheng wrote:

> Dear all
>
> It looks like something strange is going on for my Petsc (which was
> built with '--with-scalar-type=complex'.):
>
> 1) I got a complex system of equation, with I can solve with CG
> +SOR . But when I try to use BICGS+SOR to solve it, it never
> converges.
>
> 2) I noticed that the transpose function for complex matrices was
> not  what I was looking for. It really computes the transpose
> instead of the conjugate transpose which is the "right transpose"
> for complex matrix.
>
> For some linear solvers, e.g. BICG, BCGS, need to compute the
> transpose of real system matrix (to multiply it with a vector),
> while they need to compute the conjugate transpose for complex
> system matrices.
>
> So I am wondering whether BICGS+SOR did not converge for my complex
> matrix because of a bad A^Tx used internally in these linear
> solvers. Such problem does not exist for CG+SOR, therefore, CG+SOR
> converged.
>
> not make myself clear :o
>
> Thanks a lot
> Best regards
> Zhifeng Sheng
>
> Hong Zhang wrote:
>> Zhifeng,
>>
>> Petsc's linear solvers, including
>> the external packages (e.g., superlu, mumps, and spooles)
>> all support complex precision,
>> simply configure petsc library with
>> '--with-scalar-type=complex'.
>>
>>> How can I make the other linear solvers work for complex system? I
>>> think if only I can make the transpose function a little different
>>> then they should work. but I don't know where I should start.
>>>
>>> Did anyone have similar problem with the linear solvers for
>>> complex system before (the linear solver for complex system needs
>>> conjugate transpose)? and how could you solve it?
>>
>> Why do you need conjugate transpose for using petsc solver?
>> Do you develop your onw solver for Hermitian matrix?
>> We do not have some basic matrix operations for Hermitian matrix yet,
>> e.g., MatMult_Hermitian() when only half of the matrix entries
>> are stored. You need implement this operation for your onw
>> solver.
>>
>> If you use petsc AIJ matrix format, all complex linear solvers
>> should work. Storing half of entries is not as efficient
>> as entire matrix when you have sufficient memory space.
>>
>> Hong
>>
>>>
>>> Thanks a lot
>>> Best regards
>>> Zhifeng Sheng
>>>
>>>
>>
>

```