netket.optimizer.sr.LazySMatrix

class netket.optimizer.sr.LazySMatrix(apply_fun, params, samples, sr, model_state=None, x0=None)[source]

Bases: object

Lazy representation of an S Matrix behving like a linear operator.

The S matrix is not computed yet, but can be computed by calling to_dense. The details on how the ⟨S⟩⁻¹⟨F⟩ system is solved are contaianed in the field sr.

__init__(apply_fun, params, samples, sr, model_state=None, x0=None)

Initialize self. See help(type(self)) for accurate signature.

Parameters
  • apply_fun (Callable[[Any, jax._src.numpy.lax_numpy.ndarray], jax._src.numpy.lax_numpy.ndarray]) –

  • params (Any) –

  • samples (jax._src.numpy.lax_numpy.ndarray) –

  • sr (netket.optimizer.sr.sr_onthefly.SRLazy) –

  • model_state (Optional[Any]) –

  • x0 (Optional[Any]) –

Return type

None

Attributes
model_state: Optional[Any] = None

Optional state of the ansataz.

x0: Optional[Any] = None

Optional initial guess for the iterative solution.

Methods
replace(**updates)

“Returns a new object replacing the specified fields with new values.

solve(y, x0=None)[source]

Solve the linear system x=⟨S⟩⁻¹⟨y⟩ with the chosen iterataive solver.

Parameters
  • y (Any) – the vector y in the system above.

  • x0 (Optional[Any]) – optional initial guess for the solution.

Returns

the PyTree solving the system. info: optional additional informations provided by the solver. Might be

None if there are no additional informations provided.

Return type

x

to_dense()[source]

Convert the lazy matrix representation to a dense matrix representation.s

Return type

ndarray

Returns

A dense matrix representation of this S matrix.