state_ops.schmidt_decomposition

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

Functions

schmidt_decomposition(rho[, dim, k_param])

Compute the Schmidt decomposition of a bipartite vector [1].

_operator_schmidt_decomposition(rho[, dim, k_param])

Calculate the Schmidt decomposition of an operator (matrix).

Module Contents

state_ops.schmidt_decomposition.schmidt_decomposition(rho, dim=None, k_param=0)

Compute the Schmidt decomposition of a bipartite vector [1].

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.

from toqito.states import max_entangled
max_entangled(3)
array([[0.57735027],
       [0.        ],
       [0.        ],
       [0.        ],
       [0.57735027],
       [0.        ],
       [0.        ],
       [0.        ],
       [0.57735027]])
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}}.\]
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")
Singular values:
[[0.57735027]
 [0.57735027]
 [0.57735027]]

U matrix:
[[1. 0. 0.]
 [0. 1. 0.]
 [0. 0. 1.]]

V^T matrix:
[[1. 0. 0.]
 [0. 1. 0.]
 [0. 0. 1.]]

References

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) – 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]

state_ops.schmidt_decomposition._operator_schmidt_decomposition(rho, dim=None, k_param=0)

Calculate the Schmidt decomposition of an operator (matrix).

Given an input rho provided as a matrix, determine its corresponding Schmidt decomposition.

Raises:

ValueError – If matrices are not of equal dimension..

Parameters:
  • rho (numpy.ndarray) – The matrix.

  • dim (int | list[int] | numpy.ndarray) – The dimension of the matrix

  • k_param (int) – The number of Schmidt coefficients to compute.

Returns:

The Schmidt decomposition of the rho input.

Return type:

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