Quantum State Properties API

Quantum State Properties

graphcalc.quantum.properties.has_positive_partial_transpose(state: QuantumState, *, subsystems: Iterable[int], tol: float | None = None) bool[source]

Return whether the partial transpose is positive semidefinite.

Parameters:
  • state (QuantumState) – Input quantum state.

  • subsystems (iterable of int) – Indices of subsystems on which the partial transpose is taken.

  • tol (float | None, default=None) – Numerical tolerance for positive semidefiniteness.

Notes

This is the PPT property. In bipartite systems of dimensions 2 x 2 and 2 x 3, PPT is equivalent to separability. In higher dimensions, PPT is only a necessary condition for separability in general.

graphcalc.quantum.properties.is_entangled(state: QuantumState, *, partition: Iterable[int] | None = None, tol: float | None = None) bool[source]

Return whether the state is entangled with respect to a bipartition.

Parameters:
  • state (QuantumState) – Input quantum state.

  • partition (iterable of int | None, default=None) – Subsystems forming one side of the bipartition. The complementary subsystems form the other side. If omitted, the function uses the default convention described below.

  • tol (float | None, default=None) – Numerical tolerance for comparisons.

Notes

This function is defined as the negation of is_product_state with respect to the chosen bipartition convention.

Therefore:

  • if partition is specified, this tests entanglement across that bipartition;

  • if the state has exactly two subsystems and partition is omitted, this tests bipartite entanglement across [0] | [1];

  • if the state has more than two subsystems and partition is omitted, this returns True iff the state is not product across any nontrivial bipartition.

In the multipartite case, this corresponds to a “genuinely non-product across every bipartition” convention, which is stronger than merely “not fully separable.”

graphcalc.quantum.properties.is_mixed(state: QuantumState, *, tol: float | None = None) bool[source]

Return whether the state is mixed.

Notes

A state is mixed if it is not pure.

graphcalc.quantum.properties.is_product_state(state: QuantumState, *, partition: Iterable[int] | None = None, tol: float | None = None) bool[source]

Return whether the state is product with respect to a bipartition.

Parameters:
  • state (QuantumState) – Input quantum state.

  • partition (iterable of int | None, default=None) – Subsystems forming one side of the bipartition. The complementary subsystems form the other side. If omitted, and the state has exactly two subsystems, the partition [0] | [1] is used. If omitted for a multipartite state with more than two subsystems, this function tests whether the state is product across some nontrivial bipartition.

  • tol (float | None, default=None) – Numerical tolerance for comparisons.

Notes

Definitions of “product state” vary with context. This function uses the following convention.

  • For a specified bipartition A | B, the function tests whether rho = rho_A rho_B.

  • If no partition is supplied and the state has more than two subsystems, the function returns True if the state is product across at least one nontrivial bipartition.

This is exact for the implemented criterion. In particular, for a pure bipartite state, productness is equivalent to purity of either reduced state.

graphcalc.quantum.properties.is_pure(state: QuantumState, *, tol: float | None = None) bool[source]

Return whether the state is pure.

Notes

A state rho is pure if and only if Tr(rho^2) = 1. Equivalently, rho has rank one.

graphcalc.quantum.properties.is_valid_state(state: QuantumState, *, tol: float | None = None) bool[source]

Return whether the input is a valid density operator.

Parameters:
  • state (QuantumState) – Input quantum state.

  • tol (float | None, default=None) – Optional tolerance to use in the validation. If omitted, state.tol is used.

Notes

A valid density operator is Hermitian, positive semidefinite, and has trace one.

This function is primarily useful because some operators produced from valid states, such as partial transposes, are not necessarily valid density operators.