[petsc-users] KSPComputeRitz, GMRES, matrix with complex number

Mark Adams mfadams at lbl.gov
Thu Jul 14 10:49:12 CDT 2022


On Thu, Jul 14, 2022 at 11:29 AM feng wang <snailsoar at hotmail.com> wrote:

> Thanks for the clarification. any recommendations to get around this?
>

I would look at the existing code and see if you can see what is limiting
it to real (comments hopefully), if it looks like something you could do,
start with a git repo of PETSc, configure with complex scalar values,
modify an existing test or make your own to test it, and make it work.
At that point you can contribute that to PETSc (there is documentation on
how to do that including our coding practices that you should be able to
infer to a large extent from the code you are modifying).
At that point PETSc will maintain it.

Mark


>
> I am solving a set of linear systems of A_i x_i = B_i with matrix-based
> GMRES. The entries of A_i and B_i are complex numbers. It is
> pre-conditioned with ASM and the preconditioning matrix is A_i itself. I
> would like to show the Ritz value to understand the convergence behaviour
> for each A_i x_i = B_i.
> ------------------------------
> *From:* Mark Adams <mfadams at lbl.gov>
> *Sent:* 14 July 2022 14:16
> *To:* feng wang <snailsoar at hotmail.com>
> *Cc:* petsc-users at mcs.anl.gov <petsc-users at mcs.anl.gov>
> *Subject:* Re: [petsc-users] KSPComputeRitz, GMRES, matrix with complex
> number
>
> No. I missed that note.
> Complex has not been implemented.
>
>
> On Thu, Jul 14, 2022 at 9:54 AM feng wang <snailsoar at hotmail.com> wrote:
>
> Hi Mark,
>
> Thanks for your reply!
>
> Maybe I have a misunderstanding of the documentation of KSPComputeRitz (
> https://petsc.org/main/docs/manualpages/KSP/KSPComputeRitz/).  It says
> "-this is currently not implemented when PETSc is built with complex
> numbers".
>
> But if it works, I will give it a try.
>
> Thanks,
> Feng
>
>
>  <https://petsc.org/main/docs/manualpages/KSP/KSPComputeRitz/>
>
>
> ------------------------------
> *From:* Mark Adams <mfadams at lbl.gov>
> *Sent:* 14 July 2022 12:23
> *To:* feng wang <snailsoar at hotmail.com>
> *Cc:* petsc-users at mcs.anl.gov <petsc-users at mcs.anl.gov>
> *Subject:* Re: [petsc-users] KSPComputeRitz, GMRES, matrix with complex
> number
>
> Why do you say it only works with Real? You need to configure PETSc to use
> complex numbers and it should work.
> This is an advanced method and it does not have any tests, which basically
> says it is very experimental.
> Don't expect it to be very robust.
>
> Mark
>
> On Thu, Jul 14, 2022 at 7:19 AM feng wang <snailsoar at hotmail.com> wrote:
>
> Dear All,
>
> I am using GMRES with complex numbers and would like to compute the Ritz
> values. I am looking at KSPComputeRitz
> <https://petsc.org/main/docs/manualpages/KSP/KSPComputeRitz/>  and it
> seems to me that it only works with Petsc compiled with real numbers. Is
> there an easy alternative way to compute Ritz values for matrices with
> complex numbers?
>
> Thanks,
> Feng
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20220714/5042ef02/attachment.html>


More information about the petsc-users mailing list