jax.random.orthogonal

Contents

jax.random.orthogonal#

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

Sample uniformly from the orthogonal group O(n).

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

Parameters:
  • key (Union[Array, ndarray, bool_, number, bool, int, float, complex]) – 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[str, type[Any], dtype, SupportsDType]) – optional, a float dtype for the returned values (default float64 if jax_enable_x64 is true, otherwise float32).

Return type:

Array

Returns:

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