toqito.state_ops.schmidt_decomposition ====================================== .. py:module:: toqito.state_ops.schmidt_decomposition .. autoapi-nested-parse:: Schmidt decomposition operation computes the schmidt decomposition of a quantum state or an operator. Module Contents --------------- .. py:function:: schmidt_decomposition(rho, dim = None, k_param = 0) Compute the Schmidt decomposition of a bipartite vector [@WikiScmidtDecomp]. .. rubric:: Examples Consider the \(3\)-dimensional maximally entangled state: \[ u = \frac{1}{\sqrt{3}} \left( |000 \rangle + |111 \rangle + |222 \rangle \right). \] We can generate this state using the `|toqito⟩` module as follows. ```python exec="1" source="above" from toqito.states import max_entangled print(max_entangled(3)) ``` array([[0.57735027], [0. ], [0. ], [0. ], [0.57735027], [0. ], [0. ], [0. ], [0.57735027]]) Computing the Schmidt decomposition of \(u\), we can obtain the corresponding singular values of \(u\) as \[ \frac{1}{\sqrt{3}} \left[1, 1, 1 \right]^{\text{T}}. \] ```python exec="1" source="above" from toqito.states import max_entangled from toqito.state_ops import schmidt_decomposition singular_vals, u_mat, vt_mat = schmidt_decomposition(max_entangled(3)) matrices = { "Singular values": singular_vals, "U matrix": u_mat, "V^T matrix": vt_mat, } for name, mat in matrices.items(): print(f"{name}:\n{mat}\n") ``` :raises ValueError: If matrices are not of equal dimension. :param rho: A bipartite quantum state to compute the Schmidt decomposition of. :param dim: An array consisting of the dimensions of the subsystems (default gives subsystems equal dimensions). :param k_param: How many terms of the Schmidt decomposition should be computed (default is 0). :returns: The Schmidt decomposition of the `rho` input.