jztools.numpy#
Functions
Returns the accumulated max and argmax. |
|
|
Inverts the operation of |
|
Produces a bytes string containing the input array, including shape and dtype information. |
|
Returns an array from random bytes of the specified dtype (can be structured). |
|
Outputs a numpy.random.Generator based on the input. |
|
Inverts the operation of |
|
Produces a bytes string containing the input array, which can be re-constructed from the bytes string using decode_ndarray. |
|
Alternative to numpy.lib.recfunctions import structured_to_unstructured, which has a memory leak in |
Classes
|
|
- jztools.numpy.randomizer(specifier: bool | int | Generator | None)#
Outputs a numpy.random.Generator based on the input. :param specifier: An integer used as the seed, or a passed-through
numpy.random.Generatorobject orFalseto returnNone.
- jztools.numpy.random_array(shape, dtype, rng=None)#
Returns an array from random bytes of the specified dtype (can be structured).
- jztools.numpy.structured_to_unstructured(arr, dtype=None)#
Alternative to numpy.lib.recfunctions import structured_to_unstructured, which has a memory leak in
- jztools.numpy.argmax_accumulate(a)#
Returns the accumulated max and argmax. https://stackoverflow.com/questions/37855059/why-does-accumulate-work-for-numpy-maximum-but-not-numpy-argmax
- jztools.numpy.raw_encode_ndarray(arr: ndarray) Tuple[bytes, dtype, Tuple[int]]#
Produces a bytes string containing the input array, which can be re-constructed from the bytes string using decode_ndarray.
- Returns:
3-tuple of bytes representation of content, dtype and shape.
(See also
encode_ndarray().)
- jztools.numpy.raw_decode_ndarray(arr_bytes: bytes, dtype: dtype, shape: Tuple[int]) ndarray#
Inverts the operation of
raw_encode_ndarray().(See also
encode_ndarray().)
- jztools.numpy.encode_ndarray(arr: ndarray, serializer=None) bytes#
Produces a bytes string containing the input array, including shape and dtype information. The original array can be re-constructed from the output bytes string using decode_ndarray.
(See also
raw_encode_ndarray().)
- jztools.numpy.decode_ndarray(arr_bytes: bytes, serializer=None) ndarray#
Inverts the operation of
encode_ndarray().(See also
raw_decode_ndarray().’)