Skip to content

dq.random.herm

herm(key: PRNGKeyArray, shape: tuple[int, ...]) -> QArray

Returns a random complex Hermitian matrix.

Parameters

  • key –

    A PRNG key used as the random key.

  • shape (shape of the form (..., n, n)) –

    Shape of the returned qarray.

Returns

(qarray of shape (*shape)) Random complex Hermitian matrix.

Examples

>>> key = jax.random.PRNGKey(42)
>>> dq.random.herm(key, (2, 2))
QArray: shape=(2, 2), dims=(2,), dtype=complex64, layout=dense
[[ 0.323+0.j    -0.074-0.146j]
 [-0.074+0.146j -0.844+0.j   ]]