Skip to content

Commit 47e37e3

Browse files
committed
introduce bures_dist and bures_angle
1 parent c30cdfc commit 47e37e3

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

docs/src/resources/api.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,8 @@ entanglement
262262
fidelity
263263
tracedist
264264
hilbert_dist
265+
bures_dist
266+
bures_angle
265267
```
266268

267269
## [Spin Lattice](@id doc-API:Spin-Lattice)

src/metrics.jl

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ Functions for calculating metrics (distance measures) between states and operato
44

55
export fidelity
66
export tracedist, hilbert_dist
7+
export bures_dist, bures_angle
78

89
@doc raw"""
910
fidelity(ρ::QuantumObject, σ::QuantumObject)
1011
1112
Calculate the fidelity of two [`QuantumObject`](@ref):
1213
``F(\hat{\rho}, \hat{\sigma}) = \textrm{Tr} \sqrt{\sqrt{\hat{\rho}} \hat{\sigma} \sqrt{\hat{\rho}}}``
1314
14-
Here, the definition is from Nielsen & Chuang, "Quantum Computation and Quantum Information". It is the square root of the fidelity defined in R. Jozsa, Journal of Modern Optics, 41:12, 2315 (1994).
15+
Here, the definition is from [Nielsen-Chuang2011](@citet). It is the square root of the fidelity defined in [Jozsa1994](@citet).
1516
1617
Note that `ρ` and `σ` must be either [`Ket`](@ref) or [`Operator`](@ref).
1718
"""
@@ -63,3 +64,27 @@ function hilbert_dist(
6364
A = ket2dm(ρ) - ket2dm(σ)
6465
return tr(A' * A)
6566
end
67+
68+
@doc raw"""
69+
bures_dist(ρ::QuantumObject, σ::QuantumObject)
70+
71+
Calculate the [Bures distance](https://en.wikipedia.org/wiki/Bures_metric) between two [`QuantumObject`](@ref):
72+
``D_B(\hat{\rho}, \hat{\sigma}) = \sqrt{2 \left(1 - F(\hat{\rho}, \hat{\sigma}) \right)}``
73+
74+
Here, the definition of [`fidelity`](@ref) ``F`` is from [Nielsen-Chuang2011](@citet). It is the square root of the fidelity defined in [Jozsa1994](@citet).
75+
76+
Note that `ρ` and `σ` must be either [`Ket`](@ref) or [`Operator`](@ref).
77+
"""
78+
bures_dist::QuantumObject, σ::QuantumObject) = sqrt(2 * (1 - fidelity(ρ, σ)))
79+
80+
@doc raw"""
81+
bures_angle(ρ::QuantumObject, σ::QuantumObject)
82+
83+
Calculate the [Bures angle](https://en.wikipedia.org/wiki/Bures_metric) between two [`QuantumObject`](@ref):
84+
``D_A(\hat{\rho}, \hat{\sigma}) = \arccos\left(F(\hat{\rho}, \hat{\sigma})\right)``
85+
86+
Here, the definition of [`fidelity`](@ref) ``F`` is from [Nielsen-Chuang2011](@citet). It is the square root of the fidelity defined in [Jozsa1994](@citet).
87+
88+
Note that `ρ` and `σ` must be either [`Ket`](@ref) or [`Operator`](@ref).
89+
"""
90+
bures_angle::QuantumObject, σ::QuantumObject) = acos(fidelity(ρ, σ))

0 commit comments

Comments
 (0)