netket.nn.binary_encoding

netket.nn.binary_encoding#

netket.nn.binary_encoding(hilbert, x, *, max_bits=None)[source]#

Encodes the array x into a set of binary-encoded variables described by the shape of a Hilbert space. The i-th element of x will be encoded in {code}`ceil(log2(shape[i]))` bits.

Parameters:
  • hilbert (DiscreteHilbert) – Hilbert space of the samples that are to be encoded.

  • x (Union[ndarray, Array]) – The array to encode.

  • max_bits (Optional[int]) – The maximum number of bits to use for each element of x.

Return type:

Union[ndarray, Array]