Information Measures

Information Measures

Measures on vectors, states, and quantum operations.

Measures in Hilbert Space

quantumflow.fubini_study_angle(vec0: ndarray, vec1: ndarray) float

Calculate the Fubini–Study metric between elements of a Hilbert space.

The Fubini–Study metric is a distance measure between vectors in a projective Hilbert space. For gates this space is the Hilbert space of operators induced by the Hilbert-Schmidt inner product. For 1-qubit rotation gates, Rx, Ry and Rz, this is half the angle (theta) in the Bloch sphere.

The Fubini–Study metric between states is equal to the Burr angle between pure states.

quantumflow.fubini_study_fidelity(vec0: ndarray, vec1: ndarray) float

Cosine of the Fubini–Study metric.

quantumflow.fubini_study_close(vec0: ndarray, vec1: ndarray, atol: float = 1e-07) bool

Return True if vectors are close in the projective Hilbert space.

Similarity is measured with the Fubini–Study metric.

State Measures

quantumflow.state_angle(ket0: State, ket1: State) float

The Fubini-Study angle between states.

Equal to the Burrs angle for pure states.

quantumflow.states_close(ket0: State, ket1: State, atol: float = 1e-07) bool

Returns True if states are almost identical.

Closeness is measured with the metric Fubini-Study angle.

quantumflow.state_fidelity(ket0: State, ket1: State) float

Return the quantum fidelity between pure states.

Mixed state Measures

quantumflow.density_angle(rho0: Density, rho1: Density) float

The Fubini-Study angle between density matrices

quantumflow.purity(rho: Density) float

Calculate the purity of a mixed quantum state.

Purity, defined as tr(rho^2), has an upper bound of 1 for a pure state, and a lower bound of 1/D (where D is the Hilbert space dimension) for a competently mixed state.

Two closely related.info are the linear entropy, 1- purity, and the participation ratio, 1/purity.

quantumflow.densities_close(rho0: Density, rho1: Density, atol: float = 1e-07) bool

Returns True if densities are almost identical.

Closeness is measured with the Fubini-Study fidelity.

quantumflow.fidelity(rho0: Density, rho1: Density) float

Return the fidelity F(rho0, rho1) between two mixed quantum states.

quantumflow.bures_distance(rho0: Density, rho1: Density) float

Return the Bures distance between mixed quantum states

quantumflow.bures_angle(rho0: Density, rho1: Density) float

Return the Bures angle between mixed quantum states

quantumflow.entropy(rho: Density, base: float | None = None) float

Returns the von-Neumann entropy of a mixed quantum state.

Parameters:
  • rho – A density matrix

  • base – Optional logarithm base. Default is base e, and entropy is .info in nats. For bits set base to 2.

Returns:

The von-Neumann entropy of rho

quantumflow.mutual_info(rho: Density, qubits0: Sequence[Qubit], qubits1: Sequence[Qubit] | None = None, base: float | None = None) float

Compute the bipartite von-Neumann mutual information of a mixed quantum state.

Parameters:
  • rho – A density matrix of the complete system

  • qubits0 – Qubits of system 0

  • qubits1 – Qubits of system 1. If none, taken to be all remaining qubits

  • base – Optional logarithm base. Default is base e

Returns:

The bipartite von-Neumann mutual information.

Gate Measures

quantumflow.gate_angle(gate0: Gate, gate1: Gate) float

The Fubini-Study angle between gates

quantumflow.gates_close(gate0: Gate, gate1: Gate, atol: float = 1e-07) bool

Returns: True if gates are almost identical, up to a phase factor.

Closeness is measured with the Fubini-Study metric.

quantumflow.gates_phase_close(gate0: Gate, gate1: Gate, atol: float = 1e-07) bool

Returns: True if gates are almost identical and have almost the same phase.

quantumflow.gates_commute(gate0: Gate, gate1: Gate, atol: float = 1e-07) bool

Returns: True if gates (almost) commute.

quantumflow.almost_unitary(gate: Gate) bool

Return true if gate is (almost) unitary

quantumflow.almost_hermitian(gate: Gate) bool

Return true if gate tensor is (almost) Hermitian

quantumflow.almost_identity(gate: Gate) bool

Return true if gate tensor is (almost) the identity

Channel Measures

quantumflow.channel_angle(chan0: Channel, chan1: Channel) float

The Fubini-Study angle between channels

quantumflow.channels_close(chan0: Channel, chan1: Channel, atol: float = 1e-07) bool

Returns: True if channels are almost identical.

Closeness is measured with the channel angle.

quantumflow.average_gate_fidelity(kraus: Kraus, target: Gate | None = None) float

Return the average gate fidelity between a noisy gate (specified by a Kraus representation of a superoperator), and a purely unitary target gate.

If the target gate is not specified, default to identity gate.

quantumflow.almost_unital(chan: Channel) bool

Return true if the channel is (almost) unital.