jax.random.orthogonal(key, n, shape=(), dtype=<class 'numpy.float64'>)[source]#

Sample uniformly from the orthogonal group O(n).

If the dtype is complex, sample uniformly from the unitary group U(n).

  • key (Union[Array, PRNGKeyArray]) – a PRNG key used as the random key.

  • n (int) – an integer indicating the resulting dimension.

  • shape (Sequence[int]) – optional, the batch dimensions of the result. Default ().

  • dtype (Union[Any, str, dtype, SupportsDType]) – optional, a float dtype for the returned values (default float64 if jax_enable_x64 is true, otherwise float32).

Return type



A random array of shape (*shape, n, n) and specified dtype.