Skip to content

Fix the centered SR onthefly code for R->C and nonhomogeneous parametes

Created by: inailuig

The centered SR code has to precalculate〈Ok〉using a vjp. However as pointed out in https://github.com/netket/netket/pull/652#discussion_r619709042 for R->C calculating the oks with a single vjp is not correct (the simplest way to see this is that these oks are real for all real parameters, but they should be complex). The previous test example didn't actually test R->C, since the imaginary part of the result didn't depend on the real parameters.

This

  • updates the test (need to double-check again that the example now actually covers everything)
  • for centered=True (which needs the 〈Ok〉):
    • R->R and holomorphic C->C: no changes
    • R->C: now uses separate vjps for the real and imag parts
    • inhomogeneous & non-holomorphic: converts all parameters to real and calls the R->C code
    • auto-detects R->R, R->C, assumes holomorphic C->C (with the option to specify that its not holomorphic)
  • centered=False: no changes
  • Also partially adds support for non-holomorphic wavefunctions and tests them

Merge request reports