numpy 1.22.4 Pypi GitHub Homepage
Other Docs
ParametersReturns

If a uint32 array, pass it through directly. If a non-negative integer, then break it up into uint32 words, lowest bits first. If a string starting with "0x", then interpret as a hex integer, as above. If a string of decimal digits, interpret as a decimal integer, as above. If a sequence of ints or strings, interpret each element as above and concatenate.

Note that the handling of int64 or uint64 arrays are not just straightforward views as uint32 arrays. If an element is small enough to fit into a uint32 , then it will only take up one uint32 element in the output. This is to make sure that the interpretation of a sequence of integers is the same regardless of numpy's default integer type, which differs on different platforms.

Parameters

x : int, str, sequence of int or str

Returns

seed_array : uint32 array

Coerce an input to a uint32 array.

Examples

>>> import numpy as np
... from numpy.random.bit_generator import _coerce_to_uint32_array
... _coerce_to_uint32_array(12345) array([12345], dtype=uint32)
>>> _coerce_to_uint32_array('12345')
array([12345], dtype=uint32)
>>> _coerce_to_uint32_array('0x12345')
array([74565], dtype=uint32)
>>> _coerce_to_uint32_array([12345, '67890'])
array([12345, 67890], dtype=uint32)
>>> _coerce_to_uint32_array(np.array([12345, 67890], dtype=np.uint32))
array([12345, 67890], dtype=uint32)
>>> _coerce_to_uint32_array(np.array([12345, 67890], dtype=np.int64))
array([12345, 67890], dtype=uint32)
>>> _coerce_to_uint32_array([12345, 0x10deadbeef, 67890, 0xdeadbeef])
array([     12345, 3735928559,         16,      67890, 3735928559],
      dtype=uint32)
>>> _coerce_to_uint32_array(1234567890123456789012345678901234567890)
array([3460238034, 2898026390, 3235640248, 2697535605,          3],
      dtype=uint32)
See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : None#None
type: <class 'builtin_function_or_method'>
Commit: