Functionals
Trace norm and distance
Let $\rho, \sigma \in \mathrm{L}(\mathcal{X})$. The trace norm is defined as $\|\rho\|_1 = \mathrm{Tr} \sqrt{\rho\rho^\dagger}$ and the trace distance is defined as $D_1(\rho,\sigma)=\frac{1}{2}\|\rho-\sigma\|_1$.
julia> ψ=(1/sqrt(2)) * (ket(1,2) + ket(2,2))
2-element Vector{ComplexF64}: 0.7071067811865475 + 0.0im 0.7071067811865475 + 0.0im
julia> ϕ=(1/2) * ket(1,2) + (sqrt(3)/2) * ket(2,2)
2-element Vector{ComplexF64}: 0.5 + 0.0im 0.8660254037844386 + 0.0im
julia> ρ=proj(ψ)
2×2 Matrix{ComplexF64}: 0.5+0.0im 0.5+0.0im 0.5+0.0im 0.5+0.0im
julia> σ=proj(ϕ)
2×2 Matrix{ComplexF64}: 0.25+0.0im 0.433013+0.0im 0.433013+0.0im 0.75+0.0im
julia> norm_trace(ρ)
1.0
julia> trace_distance(ρ, σ)
0.2588190451025207
Hilbert–Schmidt norm and distance
The Hilbert–Schmidt norm norm and distance defined by $\|\rho\|_{HS}=\sqrt{\mathrm{Tr}\rho^\dagger \rho}$ and $D_{HS}(\rho,\sigma)=\frac{1}{2}\|\rho-\sigma\|_{HS}$, respectively, can be used as follows
julia> norm_hs(ρ)
0.9999999999999998
julia> hs_distance(ρ, σ)
0.36602540378443854
Fidelity and superfidelity
Fidelity is a measure of distance of quantum states. It is an example of a distance measure which is not a metric on the space of quantum states. The fidelity of two quantum states $\rho, \sigma \in \mathrm{L}(\mathcal{X})$ is given by $F(\rho,\sigma)=\|\sqrt{\rho}\sqrt{\sigma}\|_1$
julia> fidelity_sqrt(ρ, σ)
0.9659258262890682
julia> fidelity(ρ, σ)
0.9330127018922192
julia> fidelity(ψ, σ)
0.9330127018922191
julia> fidelity(ρ, ϕ)
0.9330127018922191
julia> fidelity(ψ, ϕ)
0.9330127018922192
Superfidelity
Superfidelity is an upper bound on the fidelity of two quantum states It is defined by $G(\rho, \sigma) = \mathrm{Tr}\rho \sigma + \sqrt{1 - \mathrm{Tr}\rho^2} \sqrt{1-\mathrm{Tr} \sigma^2}$.
julia> superfidelity(ρ, σ)
0.9330127018922193
Diamond norm
In order to introduce the \emph{diamond norm}, we first introduce the notion of the induced trace norm. Given $\Phi \in \mathrm{T}(\mathcal{X}, \mathcal{Y})$ we define its induced trace norm as $\| \Phi \|_1 = \mathrm{max} \left\{ \| \Phi(X) \|_1: X \in L(\mathcal{X}), \| X \|_1 \leq 1 \right\}$. The diamond norm of $\Phi$ is defined as $\| \Phi \|_\diamond = \| \Phi \otimes \mathbb{I}_{\mathrm{L}(\mathcal{Y})} \|_1$ One important property of the diamond norm is that for Hermiticity-preserving $\Phi \in \mathrm{T}(\mathcal{X}, \mathcal{Y})$ we obtain $\| \Phi \|_\diamond = \max \left\{ \left\| (\Phi \otimes \mathbb{I}_{\mathrm{L}(\mathcal{Y})}) \left(|\psi\rangle\langle\psi| \right )\right\|_1: |\psi\rangle \in \mathcal{X} \otimes \mathcal{Y}, \langle\psi|\psi\rangle=1 \right\}$.
julia> γ = 0.3
0.3
julia> K0 = Matrix([1 0; 0 sqrt(1-γ)])
2×2 Matrix{Float64}: 1.0 0.0 0.0 0.83666
julia> K1 = Matrix([0 sqrt(γ); 0 0])
2×2 Matrix{Float64}: 0.0 0.547723 0.0 0.0
julia> Φ = convert(DynamicalMatrix{Array{Float64,2}}, KrausOperators([K0,K1]))
DynamicalMatrix{Matrix{Float64}} dimensions: (2, 2) [1.0 0.0 0.0 0.8366600265340756; 0.0 0.29999999999999993 0.0 0.0; 0.0 0.0 0.0 0.0; 0.8366600265340756 0.0 0.0 0.7000000000000001]
julia> L0 = Matrix([1 0; 0 sqrt(1-γ)])
2×2 Matrix{Float64}: 1.0 0.0 0.0 0.83666
julia> L1 = Matrix([0 0; 0 sqrt(γ)])
2×2 Matrix{Float64}: 0.0 0.0 0.0 0.547723
julia> Ψ = convert(DynamicalMatrix{Array{Float64,2}}, KrausOperators([K0,K1]))
DynamicalMatrix{Matrix{Float64}} dimensions: (2, 2) [1.0 0.0 0.0 0.8366600265340756; 0.0 0.29999999999999993 0.0 0.0; 0.0 0.0 0.0 0.0; 0.8366600265340756 0.0 0.0 0.7000000000000001]
julia> norm_diamond(Φ)
0.9999995938026727
julia> diamond_distance(Φ, Ψ)
-1.2351610145485521e-10
Shannon entropy and von Neumann entropy
Shannon entropy is defined for a probability vector $p$ as $H(\mathrm{p})=-\sum_{i=1}^n p_i\log_2 p_i$. We also provide an implementation for the point Shannon entropy. It is defined as $h(a) = -a \log a - (1-a)\log(1-a)$.
julia> p = vec([0.3 0.2 05])
3-element Vector{Float64}: 0.3 0.2 5.0
julia> shannon_entropy(p)
-7.3641101383859
julia> shannon_entropy(0.5)
0.6931471805599453
For a quantum system described by a state $\rho$, the von Neumann entropy is $S(\rho)=-\mathrm{Tr} \rho \log \rho$. Let $\lambda_i$, $0\leq i < n$ be the eigenvalues of $\rho$, then $S(\rho)$ can be written as $S(\rho)=-\sum_{i=1}^{n} \lambda_i \log \lambda_i$.
julia> ρ = [0.25 0.25im; -0.25im 0.75]
2×2 Matrix{ComplexF64}: 0.25+0.0im 0.0+0.25im -0.0-0.25im 0.75+0.0im
julia> σ = [0.4 0.1im; -0.1im 0.6]
2×2 Matrix{ComplexF64}: 0.4+0.0im 0.0+0.1im -0.0-0.1im 0.6+0.0im
julia> vonneumann_entropy(0.4 * ρ + 0.6 * σ)
0.5869295208554555
Distinguishability between two quantum states
One of the measure of distinguishability between two quantum states is a qauntum relative entropy, called also Kullback–Leibler divergence, defined as $S(\rho\|\sigma)=-\mathrm{Tr}\rho\log\sigma + \mathrm{Tr}\rho\log\rho$
julia> relative_entropy(ρ, σ)
0.11273751829075163
julia> kl_divergence(ρ, σ)
0.11273751829075163
Another type of measure of distinguishability between two quantum state is quantum Jensen–Shannon divergence given by $QJS(\rho,\sigma)=S\left(\frac{1}{2}\rho+\frac{1}{2}\sigma\right)- \left(\frac{1}{2}S(\rho)+\frac{1}{2}S(\sigma)\right)$.
julia> js_divergence(ρ, σ)
0.1252860912303596
The Bures distance defines an infinitesimal distance between quantum states, and it is defined as $D_B=\sqrt{2(1-\sqrt{F(\rho,\sigma)})}$. The value related with Bures distance is the Bures angle $D_A(\rho,\sigma)=\arccos(\sqrt{F(\rho,\sigma)})$
julia> bures_distance(ρ, σ)
0.24867555729886728
julia> bures_angle(ρ, σ)
0.2493208055929498
Quantum entanglement
One of the entanglement measure is negativity defined as $\mathrm{N}(\rho)=\frac{\|\rho^{T_A}\|_1-1}{2}$.
julia> negativity(ρ ⊗ σ, [2, 2], 2)
-0.0
julia> negativity(proj((1/sqrt(2)*(ket(1,2) ⊗ ket(1,2)-ket(2,2) ⊗ ket(2,2)))), [2, 2], 2)
0.4999999999999999
julia> log_negativity(ρ ⊗ σ, [2, 2], 2)
-1.1102230246251565e-16
Positive partial transpose (the Peres–Horodecki criterion) is a necessary condition of separability of the joint state $\rho_{AB}$. According PPT criterion, if $\rho^{T_B}$ has non negative eigenvalues, then $\rho_{AB}$ is separable.
julia> ppt(ρ ⊗ σ, [2, 2], 2)
0.05251262658470837
julia> ppt(proj((1/sqrt(2)*(ket(1,2) ⊗ ket(1,2)-ket(2,2) ⊗ ket(2,2)))), [2, 2], 2)
-0.4999999999999999
Another way to quantification of quantum entanglement is Concurrence. Concurrence of quantum state $\rho$ is a strong separability criterion. For two-qubit systems it is defined as $C(\rho)=\max(0,\lambda_1-\lambda_2-\lambda_3-\lambda_4)$, where $\lambda_i$ are decreasing eigenvalues of $\sqrt{\sqrt{\rho}\tilde{\rho}\sqrt{\rho}}$ with $\tilde{\rho}=(\sigma_y\otimes\sigma_y)\rho^*(\sigma_y\otimes\sigma_y)$. If $C(\rho)=0$, then $\rho$ is separable.
julia> ρ = [0.25 0.1im; -0.1im 0.75]
2×2 Matrix{ComplexF64}: 0.25+0.0im 0.0+0.1im -0.0-0.1im 0.75+0.0im
julia> σ = [0.4 0.1im; -0.1im 0.6]
2×2 Matrix{ComplexF64}: 0.4+0.0im 0.0+0.1im -0.0-0.1im 0.6+0.0im
julia> concurrence(ρ ⊗ σ)
0.0
julia> concurrence(proj(max_entangled(4)))
0.9999999999999998