netket.utils.HashableArray#

class netket.utils.HashableArray[source]#

Bases: object

This class wraps a numpy or jax array in order to make it hashable and equality comparable (which is necessary since a well-defined hashable object needs to satisfy obj1 == obj2 whenever hash(obj1) == hash(obj2).

The underlying array can also be accessed using numpy.asarray(self).

Inheritance
Inheritance diagram of netket.utils.HashableArray
__init__(wrapped)[source]#

Wraps an array into an object that is hashable, and that can be converted again into an array.

Forces all arrays to numpy and sets them to readonly. They can be converted back to jax later or a writeable numpy copy can be created by using np.array(…)

The hash is computed by hashing the whole content of the array.

Parameters:

wrapped (Union[ndarray, Array]) – array to be wrapped

Attributes
dtype#
ndim#
shape#
size#
wrapped#

The read-only wrapped array.

Methods