cr.sparse.dict.rademacher_mtx

cr.sparse.dict.rademacher_mtx(key, M, N, normalize_atoms=True)[source]

A dictionary/sensing matrix where entries are drawn independently from Rademacher distribution.

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

  • M (int) – Number of rows of the sensing matrix

  • N (int) – Number of columns of the sensing matrix

  • normalize_atoms (bool) – Whether the columns of sensing matrix are normalized (default True)

Returns

A Rademacher sensing matrix of shape (M, N)

Return type

(jax.numpy.ndarray)

Example

>>> from jax import random
>>> import cr.sparse as crs
>>> import cr.sparse.dict
>>> m, n = 8, 16
>>> Phi = cr.sparse.dict.rademacher_mtx(random.PRNGKey(0), m, n,
      normalize_atoms=False)
>>> print(Phi)
[[ 1.  1.  1. -1. -1.  1. -1. -1.  1.  1.  1. -1.  1.  1. -1.  1.]
[-1.  1.  1.  1. -1.  1.  1.  1. -1. -1. -1.  1. -1. -1. -1.  1.]
[ 1. -1. -1.  1. -1.  1.  1. -1.  1. -1.  1. -1. -1. -1.  1. -1.]
[ 1. -1. -1.  1. -1.  1.  1. -1.  1. -1. -1.  1.  1.  1. -1.  1.]
[-1. -1. -1. -1. -1. -1. -1.  1. -1. -1. -1.  1. -1. -1. -1. -1.]
[-1.  1. -1.  1.  1.  1. -1. -1.  1. -1. -1.  1.  1. -1. -1.  1.]
[-1. -1.  1.  1. -1. -1. -1. -1. -1.  1. -1.  1.  1. -1. -1.  1.]
[ 1. -1.  1.  1.  1.  1.  1.  1. -1. -1.  1. -1. -1.  1.  1.  1.]]