toqito.state_ops.schmidt_decomposition

Schmidt decomposition operation computes the schmidt decomposition of a quantum state or an operator.

Module Contents

toqito.state_ops.schmidt_decomposition.schmidt_decomposition(rho, dim=None, k_param=0)[source]

Compute the Schmidt decomposition of a bipartite vector [@WikiScmidtDecomp].

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.

Parameters:
  • rho (numpy.ndarray) – A bipartite quantum state to compute the Schmidt decomposition of.

  • dim (int | list[int] | numpy.ndarray | None) – An array consisting of the dimensions of the subsystems (default gives subsystems equal dimensions).

  • k_param (int) – How many terms of the Schmidt decomposition should be computed (default is 0).

Returns:

The Schmidt decomposition of the rho input.

Return type:

tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray]