toqito.states.mutually_unbiased_basis ===================================== .. py:module:: toqito.states.mutually_unbiased_basis .. autoapi-nested-parse:: Mutually unbiased basis states. If a system prepared in an eigenstate of one of the bases gives an equal probability of (1/d) when measured with respect to the other bases, mutually unbiased basis states are orthonormal bases in the Hilbert space Cᵈ. Module Contents --------------- .. py:function:: mutually_unbiased_basis(dim) Generate list of MUBs for a given dimension [@WikiMUB]. Note that this function only works if the dimension provided is prime or a power of a prime. Otherwise, we don't know how to generate general MUBs. .. rubric:: Examples For the case of dimension 2, the three mutually unbiased bases are provided by: \[ M_0 = \left\{|0\rangle, |1\rangle \right\}, \\ M_1 = \left\{\frac{|0\rangle + |1\rangle}{\sqrt{2}}, \frac{|0\rangle - |1\rangle}{\sqrt{2}}\right\} M_2 = \left\{\frac{|0\rangle + i|1\rangle}{\sqrt{2}}, \frac{|0\rangle - i|1\rangle}{\sqrt{2}}\right\} \] The six vectors above are obtained accordingly: ```python exec="1" source="above" session="mubs" from toqito.states import mutually_unbiased_basis mubs = mutually_unbiased_basis(2) print(len(mubs)) ``` ```python exec="1" source="above" session="mubs" lst =[vec.shape for vec in mubs] print(lst) ``` :param dim: The dimension of the mutually unbiased bases to produce. :returns: The set of mutually unbiased bases of dimension `dim` (if known).