Returns a numpy array with all 0s and a single non-zero entry(default 1).
cirq.qis.one_hot(
*,
index: Union[None, int, Sequence[int]] = None,
shape: Union[int, Sequence[int]] = 1,
value: Any = 1,
dtype: Type[np.number]
) -> np.ndarray
Args |
index
|
The index that should store the value argument instead of 0.
If not specified, defaults to the start of the array.
|
shape
|
The shape of the array.
|
value
|
The hot value to place at index in the result.
|
dtype
|
The dtype of the array.
|
Returns |
The created numpy array.
|