gemseo.caches.utils module#

Some cache utilities.

hash_data(data)[source]#

Hash data using xxh3_64 from the xxhash library.

Parameters:

data (StrKeyMapping) -- The data to hash.

Returns:

The hash value of the data.

Return type:

int

Examples

>>> from gemseo.caches.utils import hash_data
>>> from numpy import array
>>> data = {"x": array([1.0, 2.0]), "y": array([3.0])}
>>> hash_data(data)
13252388834746642440
>>> hash_data(data, "x")
4006190450215859422
to_real(data)[source]#

Convert a NumPy array to a float NumPy array.

Parameters:

data (RealOrComplexArray) -- The NumPy array to be converted to real.

Returns:

A float NumPy array.

Return type:

RealArray