friend pvector K(const pvector& in1)Return value:
- Result of applying preconditioner to in1: out.dat[i][j][k]=in1.dat[i][j][k]/
![]()
Input:
- in1: pvector
To implement preconditioning, add a function of the above prototype to the definition of the pvector class.
You may model K() on the Linv function. The only differences between
Linv() and K() are that, now, (a) 1. is added to
in the
denominator to keep things finite for
, and (b) you
shouldn't set the result at
to zero.
Hint if you run into trouble: a good test for debugging is that if you just have K() return in1, then you should recover your original conjugate-gradient results.