[petsc-users] Feature request: Origin QMR implementation.

Jed Brown jedbrown at mcs.anl.gov
Fri Dec 20 14:50:24 CST 2013


Ce Qin <qince168 at gmail.com> writes:

> Thanks, Jed.
>
> I used left Jacobi preconditioner (by setting M1 = diag(A)) with Matlab's
> QMR and BCGS.
> I am new to PETSc and I am not very fimilar with linear solvers. If I want
> to implement the QMR solver, what is the starting point?

Copy a simple similar method, rename, register, and implement.
Something like this:

$ mkdir src/ksp/ksp/impls/qmr
$ sed 's/tf\(qmr\)/\1/gi' src/ksp/ksp/impls/tfqmr/tfqmr.c > src/ksp/ksp/impls/qmr/qmr.c
$ sed 's/tf\(qmr\)/\1/gi' src/ksp/ksp/impls/tfqmr/makefile > src/ksp/ksp/impls/qmr/makefile
$ emacs src/ksp/ksp/impls/makefile                          # add new directory "qmr" to list
$ emacs include/petscksp.h include/finclude/petsckspdef.h   # add KSPQMR to both files
$ emacs src/ksp/ksp/interface/itregis.c                     # add KSPQMR
$ make                                                      # compile the new files


  # check that it works and commit starting point

$ (cd src/ksp/ksp/examples/tutorials && make ex2 && ./ex2 -ksp_type qmr -ksp_monitor -ksp_view)
$ git add src/ksp/ksp/impls/qmr/{qmr.c,makefile}
$ git commit -am'KSPQMR: start new implementation, currently a copy of TFQMR'


  # change implementation from TFQMR to QMR, update references, etc.

$ emacs src/ksp/ksp/impls/qmr/qmr.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20131220/13318c08/attachment.pgp>


More information about the petsc-users mailing list