dq.random.ket
ket(key: PRNGKeyArray, shape: tuple[int, ...]) -> QArray
Returns a random ket with unit norm.
Parameters:
-
key–A PRNG key used as the random key.
-
shape(shape of the form (..., n, 1)) –Shape of the returned qarray.
Returns:
-
(qarray of shape (*shape))
–
Random ket.
Examples:
>>> key = jax.random.PRNGKey(42)
>>> dq.random.ket(key, (2, 1))
QArray: shape=(2, 1), dims=(2,), dtype=complex64, layout=dense
[[0.563+0.107j]
[0.027+0.819j]]