rand.random_orthonormal_basis¶
Generates a random orthonormal basis.
Functions¶
|
Generate a real random orthonormal basis of given dimension \(d\). |
Module Contents¶
- rand.random_orthonormal_basis.random_orthonormal_basis(dim, is_real=False, seed=None)¶
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 [1].
Examples
To generate a random orthonormal basis of dimension \(4\),
from toqito.rand import random_orthonormal_basis random_orthonormal_basis(4, is_real = True)
[array([-0.31850694, -0.20467977, -0.54500128, 0.74808631]), array([ 0.41596141, 0.68472588, -0.59448564, -0.06865424]), array([-0.80366456, 0.20015375, -0.27542388, -0.4880609 ]), array([-0.28222812, 0.67022022, 0.52316549, 0.44435349])]
It is also possible to add a seed for reproducibility.
from toqito.rand import random_orthonormal_basis random_orthonormal_basis(2, is_real=True, seed=42)
[array([0.37621414, 0.92653274]), array([-0.92653274, 0.37621414])]
References
- dim: int
Number of elements in the random orthonormal basis.
- seed: int | None
A seed used to instantiate numpy’s random number generator.
- Parameters:
dim (int)
is_real (bool)
seed (int | None)
- Return type:
list[numpy.ndarray]