Add invariant and constant diagonal shift at the same time in `QGTJacobian*`
Created by: attila-i-szabo
This PR allows specifying both a scale-invariant and a constant diagonal offset in QGTJacobian*
at the same time.
@chrisrothUT and I discovered that adding a diagonal shift of the form diag_shift + diag_scale * S_ii
is much more stable than pure scale-invariant shifting but remains faster and better converging than simply using diag_shift
. To accommodate both, this PR deprecates rescale_shift
and introduces diag_scale
, the coefficient of S_ii in the shift.
Defaults:
- If nothing is specified,
diag_shift=0.01, diag_scale=0.0
to recover the original behaviour - If only
diag_scale
is specified,diag_shift=0.0
- If
rescale_shift
is specified, it behaves as it used to, but there is a deprecation warning - Specifying
rescale_shift
anddiag_scale
together leads to an error
Internally, diag_scale
is implemented the same way rescale_shift
once was; diag_shift
is added to it by adding offset=diag_shift/diag_scale
to the scale factors used to rescale rows/columns of the S matrix.
There are some bits to iron out, most importantly whether the defaults above are good and diag_scale
is a good name for the new parameter.