Tweak CG
The conjugate gradient solver had a few problems:
- if an initial guess
x0
was given to the solver, this guess was silently changed during the solver run. - some quantities like alpha, beta, gamma and delta must be real-valued by construction, but were computed as complex numbers. This could have unwanted effects due to accumulation of numerical noise, so I cast the values to real type manually.