[petsc-dev] TR: Contribution proposal about the computation of (harmonic) Ritz pairs within GMRES

TARDIEU Nicolas nicolas.tardieu at edf.fr
Fri Nov 20 12:00:30 CST 2015

Dear PETSc Team,

May I request your opinion of the development proposal in the following mail.
This work has been carried out in the framework of a PhD thesis ; besides the scientific goals, the proposed features are intended to be integrated in the open-source software Code_Aster, a general purpose finite element solver developed at EDF R&D, in particular for nuclear safety assessment.
In order to ensure the perennity of the development, their integration within PETSc is crucial.

This is why I gently request your position on their integration in PETSc. Let us know your policy on the subject and do not hesitate to request for extra integration work if needed.

Best regards,

[cid:image001.png at 01D123C5.B8E415A0]

Nicolas Tardieu
Head of the Rotating Machinery Group

nicolas.tardieu at edf.fr
Tél. : +33 1 47 65 39 05

---------- Forwarded message ----------
From: Sylvain Mercier <sylvainmercier85 at gmail.com<mailto:sylvainmercier85 at gmail.com>>
Date: 2015-11-03 17:09 GMT+01:00
Subject: [petsc-dev] Contribution proposal about the computation of (harmonic) Ritz pairs within GMRES
To: petsc-dev at mcs.anl.gov<mailto:petsc-dev at mcs.anl.gov>

Hi everyone,

During my phd thesis, I have worked on solving sequences of linear
systems with slowly varying matrices using GMRES(restart). In
particular, I have developed a preconditioning technique to improve
the action of an existing "first-level preconditioner". This new
method is defined using Ritz or harmonic Ritz vectors obtained at the
end of the solution of a linear system. Then I have developed two
routines in PETSc (that I've called KSPSetComputeRitz and
KSPComputeRitz) in order to compute the (harmonic) Ritz pairs
associated to the smallest or largest (harmonic) Ritz values in
modulus computed from the Hessenberg matrix of the last complete cycle

Beyond the application to the preconditioning technique that I have
developed, this routine can be used to recover approximated eigenpairs
(and not only eigenvalues as already available in PETSc) of the
preconditioned matrix at the end of a solution with GMRES. That is why
I propose this contribution.

Two new routines has been developed, similarly to the existing
routines KSPSetComputeEigenvalues and KSPComputeEigenvalues.

The first one is called KSPSetComputeRitz and sets a flag so that the
last complete Hessenberg matrix computed with GMRES(restart) will be
stored. Here is the synopsis of the current version (located in

PetscErrorCode  KSPSetComputeEigenvalues(KSP ksp,PetscBool flg)

        Input Parameters
            ksp   - iterative context obtained from KSPCreate()
            flg     - PETSC_TRUE or PETSC_FALSE

The second routine aims at computing the Ritz or harmonic Ritz
associated to the smallest or largest values in modulus. Here is the
synopsis of the current version (located in

PetscErrorCode KSPComputeRitz(KSP ksp,PetscBool ritz,PetscBool
small,PetscInt *nrit,Vec S[],PetscReal tetar[],PetscReal tetai[])

        Input Parameter
            ksp     - iterative context obtained from KSPCreate()
            ritz      - PETSC_TRUE or PETSC_FALSE to compute Ritz pairs
and harmonic Ritz pairs, respectively
            small   - PETSC_TRUE or PETSC_FALSE to compute pairs
associated to smallest or largest values in modulus, respectively

        Input/Output parameter
            n         - The number of required and recovered pairs

        Output Parameters
                    S[]     - a multidimensional PETSc vector to store
the (harmonic) Ritz vectors, provided by user with a dimension of at
least n
            tetar   - real part of computed (harmonic) Ritz values, provided
by user with a dimension of at least n
            tetai   - imaginary part of computed (harmonic) Ritz values,
provided by user with a dimension of at least n

This routine has been developed whithin GMRES for real-valued linear
systems. Then the (harmonic) Ritz pairs are possibly complex-valued
and conjugated. In this case, two successive columns of S are equal to
the real and the imaginary parts of the vectors. Finally, the routine
KSPSolve_GMRES (located in src/ksp/ksp/impls/gmres/gmreig.c) has been
modified in order to store the Hessenberg matrix and the basis vectors
of the Krylov subspace as soon as a complete cycle has been performed.

To conclude, I propose to contribute to PETSc with these developments
(I have followed the conventions detailed in the developer guide).
Please find attached a patch and the modified files.


Ce message et toutes les pièces jointes (ci-après le 'Message') sont établis à l'intention exclusive des destinataires et les informations qui y figurent sont strictement confidentielles. Toute utilisation de ce Message non conforme à sa destination, toute diffusion ou toute publication totale ou partielle, est interdite sauf autorisation expresse.

Si vous n'êtes pas le destinataire de ce Message, il vous est interdit de le copier, de le faire suivre, de le divulguer ou d'en utiliser tout ou partie. Si vous avez reçu ce Message par erreur, merci de le supprimer de votre système, ainsi que toutes ses copies, et de n'en garder aucune trace sur quelque support que ce soit. Nous vous remercions également d'en avertir immédiatement l'expéditeur par retour du message.

Il est impossible de garantir que les communications par messagerie électronique arrivent en temps utile, sont sécurisées ou dénuées de toute erreur ou virus.

This message and any attachments (the 'Message') are intended solely for the addressees. The information contained in this Message is confidential. Any use of information contained in this Message not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval.

If you are not the addressee, you may not copy, forward, disclose or use any part of it. If you have received this message in error, please delete it and all copies from your system and notify the sender immediately by return message.

E-mail communication cannot be guaranteed to be timely secure, error or virus-free.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20151120/ba7629a4/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 3814 bytes
Desc: image001.png
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20151120/ba7629a4/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Ritz_routines.tar.gz
Type: application/x-gzip
Size: 39447 bytes
Desc: Ritz_routines.tar.gz
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20151120/ba7629a4/attachment.gz>

More information about the petsc-dev mailing list