toqito.matrices.standard_basis

toqito.matrices.standard_basis(dim, flatten=False)[source]

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: https://github.com/akshayseshadri/minimax-fidelity-estimation

Parameters:
  • dim – The dimension of the basis.

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

Returns:

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