Measures

Distances in Hilbert Space

quantumflow.inner_product(vec0: qf.QubitVector, vec1: qf.QubitVector) → BKTensor

Hilbert-Schmidt inner product between qubit vectors

The tensor rank and qubits must match.

quantumflow.fubini_study_angle(vec0: qf.QubitVector, vec1: qf.QubitVector) → BKTensor

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.vectors_close(vec0: qf.QubitVector, vec1: qf.QubitVector, tolerance: float = 1e-06) → bool

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

Similarity is measured with the Fubini–Study metric.

State distances

quantumflow.state_angle(ket0: qf.State, ket1: qf.State) → BKTensor

The Fubini-Study angle between states.

Equal to the Burrs angle for pure states.

quantumflow.states_close(state0: qf.State, state1: qf.State, tolerance: float = 1e-06) → bool

Returns True if states are almost identical.

Closeness is measured with the metric Fubini-Study angle.

quantumflow.state_fidelity(state0: qf.State, state1: qf.State) → BKTensor

Return the quantum fidelity between pure states.

Mixed state distances

quantumflow.density_angle(rho0: qf.Density, rho1: qf.Density) → BKTensor

The Fubini-Study angle between density matrices

quantumflow.densities_close(rho0: qf.Density, rho1: qf.Density, tolerance: float = 1e-06) → bool

Returns True if densities are almost identical.

Closeness is measured with the metric Fubini-Study angle.

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

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

Note: Fidelity cannot be calculated entirely within the tensor backend.

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

Return the Bures distance between mixed quantum states

Note: Bures distance cannot be calculated within the tensor backend.

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

Return the Bures angle between mixed quantum states

Note: Bures angle cannot be calculated within the tensor backend.

quantumflow.entropy(rho: qf.Density, base: float = 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 measures in nats. For bits set base to 2.
Returns:

The von-Neumann entropy of rho

quantumflow.mutual_info(rho: qf.Density, qubits0: Qubits, qubits1: Qubits = None, base: float = 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 distances

quantumflow.gate_angle(gate0: qf.Gate, gate1: qf.Gate) → BKTensor

The Fubini-Study angle between gates

quantumflow.gates_close(gate0: qf.Gate, gate1: qf.Gate, tolerance: float = 1e-06) → bool

Returns: True if gates are almost identical.

Closeness is measured with the gate angle.

Channel distances

quantumflow.channel_angle(chan0: qf.Channel, chan1: qf.Channel) → BKTensor

The Fubini-Study angle between channels

quantumflow.channels_close(chan0: qf.Channel, chan1: qf.Channel, tolerance: float = 1e-06) → bool

Returns: True if channels are almost identical.

Closeness is measured with the channel angle.

quantumflow.diamond_norm(chan0: qf.Channel, chan1: qf.Channel) → float

Return the diamond norm between two completely positive trace-preserving (CPTP) superoperators.

The calculation uses the simplified semidefinite program of Watrous [arXiv:0901.4709](http://arxiv.org/abs/0901.4709) [J. Watrous, [Theory of Computing 5, 11, pp. 217-238 (2009)](http://theoryofcomputing.org/articles/v005a011/)]