state_props.is_product

Check if state is product.

Module Contents

Functions

is_product(rho[, dim])

Determine if a given vector is a product state [1].

_is_product(rho[, dim])

Determine if input is a product state recursive helper.

_operator_is_product(rho[, dim])

Determine if a given matrix is a product operator.

state_props.is_product.is_product(rho, dim=None)

Determine if a given vector is a product state [1].

If the input is deemed to be product, then the product decomposition is also returned.

Examples

Consider the following Bell state

\[u = \frac{1}{\sqrt{2}} \left( |00 \rangle + |11 \rangle \right) \in \mathcal{X}.\]

The corresponding density matrix of \(u\) may be calculated by:

\[\begin{split}\rho = u u^* = \frac{1}{2} \begin{pmatrix} 1 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 1 & 0 & 0 & 1 \end{pmatrix} \in \text{D}(\mathcal{X}).\end{split}\]

We can provide the input as either the vector \(u\) or the denisty matrix \(\rho\). In either case, this represents an entangled state (and hence a non-product state).

>>> from toqito.state_props import is_product
>>> from toqito.states import bell
>>> rho = bell(0) * bell(0).conj().T
>>> u_vec = bell(0)
>>> is_product(rho)
(array([False]), None)
>>>
>>> is_product(u_vec)
(array([False]), None)

References

[1] (1,2)

Wikipedia. Separable state. https://en.wikipedia.org/wiki/Separable_state.

Parameters:
  • rho (numpy.ndarray) – The vector or matrix to check.

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

Returns:

True if rho is a product vector and False otherwise.

Return type:

bool | numpy.ndarray

state_props.is_product._is_product(rho, dim=None)

Determine if input is a product state recursive helper.

Parameters:
  • rho (numpy.ndarray) – The vector or matrix to check.

  • dim (int | list[int]) – The dimension of the input.

Returns:

True if rho is a product vector and False otherwise.

Return type:

list[int, bool]

state_props.is_product._operator_is_product(rho, dim=None)

Determine if a given matrix is a product operator.

Given an input rho provided as a matrix, determine if it is a product state. :param rho: The matrix to check. :param dim: The dimension of the matrix :return: True if rho is product and False otherwise.

Parameters:
  • rho (numpy.ndarray)

  • dim (int | list[int])

Return type:

list[int, bool]