`QGTJacobian***(holomorphic=True)` for R->C models returns wrong output. Should error.
Created by: PhilipVinc
cc @attila-i-szabo
I agree that holomorphic=True
is wrong in that case, but it should rather throw an error than give wrong results...
It took me a while to notice that this was the cause of some wrong optimisations.
import netket as nk
import jax
L = 20
g = nk.graph.Hypercube(length=L, n_dim=1, pbc=True)
hi = nk.hilbert.Spin(s=1 / 2, N=g.n_nodes)
ha = nk.operator.Ising(hilbert=hi, graph=g, h=1.0)
ma = nk.models.RBMModPhase(alpha=1, param_dtype=float)
sa = nk.sampler.MetropolisLocal(hi, n_chains=16)
vs = nk.vqs.MCState(sa, ma, n_samples=1000, n_discard_per_chain=100)
qgt_holo = nk.optimizer.qgt.QGTJacobianDense(holomorphic=True)
qgt_nonholo = nk.optimizer.qgt.QGTJacobianDense(holomorphic=False)
qgt_otf = nk.optimizer.qgt.QGTOnTheFly()
S_holo = vs.quantum_geometric_tensor(qgt_holo)
S_nonholo = vs.quantum_geometric_tensor(qgt_nonholo)
S_otf = vs.quantum_geometric_tensor(qgt_otf)
F = vs.parameters
r_holo = S_holo@F
r_nonholo = S_nonholo@F
r_otf = S_otf@F
jax.tree_map(lambda x,y:x-y, r_holo, r_nonholo)