Quantum State Invariants API
Quantum State Invariants
- graphcalc.quantum.invariants.entanglement_entropy(state: QuantumState, *, subsystems: Iterable[int], base: float = 2.0) float[source]
Return the entanglement entropy across a bipartition for a pure state.
- Parameters:
state (QuantumState) – Input quantum state.
subsystems (iterable of int) – Subsystems on one side of the bipartition.
base (float, default=2.0) – Logarithm base used in the entropy.
Notes
For a pure state, the entanglement entropy across a bipartition
A | A^cis the von Neumann entropy of the reduced state on either side.This function is only defined here for pure states. For mixed states, several inequivalent notions of entanglement measure exist, so this function raises
ValueError.
- graphcalc.quantum.invariants.fidelity(state1: QuantumState, state2: QuantumState) float[source]
Return the Uhlmann fidelity between two quantum states.
- Parameters:
state1 (QuantumState) – First input state.
state2 (QuantumState) – Second input state.
Notes
The fidelity is defined by
F(rho, sigma) = (Tr(sqrt(sqrt(rho) sigma sqrt(rho))))^2.This function returns a value in
[0, 1]up to numerical tolerance. The input states must have the same total dimension.
- graphcalc.quantum.invariants.linear_entropy(state: QuantumState) float[source]
Return the linear entropy
1 - Tr(rho^2).
- graphcalc.quantum.invariants.logarithmic_negativity(state: QuantumState, *, subsystems: Iterable[int]) float[source]
Return the logarithmic negativity of a quantum state.
- Parameters:
state (QuantumState) – Input quantum state.
subsystems (iterable of int) – Indices of subsystems on which to take the partial transpose.
Notes
The logarithmic negativity is
E_N(rho) = log_2 ||rho^Gamma||_1 = log_2(2 N(rho) + 1).
- graphcalc.quantum.invariants.mutual_information(state: QuantumState, *, subsystems_a: Iterable[int], subsystems_b: Iterable[int], base: float = 2.0) float[source]
Return the quantum mutual information between two subsystem collections.
- Parameters:
state (QuantumState) – Input quantum state.
subsystems_a (iterable of int) – First subsystem collection.
subsystems_b (iterable of int) – Second subsystem collection.
base (float, default=2.0) – Logarithm base used in the entropy.
Notes
The quantum mutual information is defined by
I(A : B) = S(rho_A) + S(rho_B) - S(rho_AB),where
rho_A,rho_B, andrho_ABare the reduced states on the specified subsystem sets.The subsystem sets must be disjoint.
- graphcalc.quantum.invariants.negativity(state: QuantumState, *, subsystems: Iterable[int]) float[source]
Return the entanglement negativity with respect to a partial transpose.
- Parameters:
state (QuantumState) – Input quantum state.
subsystems (iterable of int) – Indices of subsystems on which to take the partial transpose.
Notes
If
rho^Gammadenotes the partial transpose, then the negativity isN(rho) = (||rho^Gamma||_1 - 1) / 2,equivalently the sum of absolute values of the negative eigenvalues of
rho^Gamma.
- graphcalc.quantum.invariants.purity(state: QuantumState) float[source]
Return the purity
Tr(rho^2)of a quantum state.
- graphcalc.quantum.invariants.rank(state: QuantumState) int[source]
Return the rank of the density operator.
- graphcalc.quantum.invariants.von_neumann_entropy(state: QuantumState, *, base: float = 2.0) float[source]
Return the von Neumann entropy of a quantum state.
- Parameters:
state (QuantumState) – Input quantum state.
base (float, default=2.0) – Logarithm base. Must be positive and not equal to 1.
Notes
The entropy is computed from the eigenvalues of the density operator:
S(rho) = -Tr(rho log rho).