toqito.rand.random_orthonormal_basis

Generates a random orthonormal basis.

Module Contents

toqito.rand.random_orthonormal_basis.random_orthonormal_basis(dim, is_real=False, seed=None)[source]

Generate a real random orthonormal basis of given dimension (d).

The basis is generated from the columns of a random unitary matrix of the same dimension as the columns of a unitary matrix typically form an orthonormal basis [@SE_1688950].

Examples

To generate a random orthonormal basis of dimension (4),

```python exec=”1” source=”above” from toqito.rand import random_orthonormal_basis

print(random_orthonormal_basis(4, is_real = True)) ```

It is also possible to add a seed for reproducibility.

```python exec=”1” source=”above” from toqito.rand import random_orthonormal_basis

print(random_orthonormal_basis(2, is_real=True, seed=42)) ```

Parameters:
  • dim (int) – Number of elements in the random orthonormal basis.

  • is_real (bool) – Bool

  • seed (int | None) – A seed used to instantiate numpy’s random number generator.

Return type:

list[numpy.ndarray]