matrices.standard_basis

Constructs the standard basis.

Functions

standard_basis(dim[, flatten])

Create standard basis of dimension dim.

Module Contents

matrices.standard_basis.standard_basis(dim, flatten=False)

Create standard basis of dimension dim.

Create a list containing the elements of the standard basis for the given dimension:

\[|1> = (1, 0, 0, ..., 0)^T |2> = (0, 1, 0, ..., 0)^T . . . |n> = (0, 0, 0, ..., 1)^T\]

This function was inspired by [1][2][3]

Examples

from toqito.matrices import standard_basis

standard_basis(2)
[array([[1.],
        [0.]]),
 array([[0.],
        [1.]])]

References

Parameters:
  • dim (int) – The dimension of the basis.

  • flatten (bool) – If True, the basis is returned as a flattened list.

Returns:

A list of numpy.ndarray of shape (n, 1).

Return type:

list[numpy.ndarray]