Ce Qin <[email protected]> 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
pgp5o7qEspXll.pgp
Description: PGP signature
