cr.sparse.dict.random_onb

cr.sparse.dict.random_onb(key, N)[source]

Generates a random orthonormal basis for \(\mathbb{R}^N\)

Parameters
  • key – a PRNG key used as the random key.

  • N (int) – Dimension of the vector space

Returns

A random orthonormal basis for \(\mathbb{R}^N\) of shape (N, N)

Return type

(jax.numpy.ndarray)

Example

>>> from jax import random
>>> import cr.sparse as crs
>>> import cr.sparse.dict
>>> Phi = cr.sparse.dict.random_onb(random.PRNGKey(0),4)
>>> print(Phi)
[[-0.382254 -0.266139  0.849797  0.246773]
[ 0.518932 -0.068848 -0.035348  0.851305]
[ 0.12152  -0.959138 -0.199282 -0.159919]
[-0.754867 -0.066964 -0.486706  0.434522]]