You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/qobj/arithmetic_and_attributes.jl
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -672,15 +672,15 @@ Get the coherence value ``\alpha`` by measuring the expectation value of the des
672
672
It returns both ``\alpha`` and the corresponding state with the coherence removed: ``\ket{\delta_\alpha} = \exp ( \alpha^* \hat{a} - \alpha \hat{a}^\dagger ) \ket{\psi}`` for a pure state, and ``\hat{\rho_\alpha} = \exp ( \alpha^* \hat{a} - \alpha \hat{a}^\dagger ) \hat{\rho} \exp ( -\bar{\alpha} \hat{a} + \alpha \hat{a}^\dagger )`` for a density matrix. These states correspond to the quantum fluctuations around the coherent state ``\ket{\alpha}`` or ``|\alpha\rangle\langle\alpha|``.
673
673
"""
674
674
functionget_coherence(ψ::QuantumObject{Ket})
675
-
a =destroy(prod(ψ.dimensions))
675
+
a =destroy(hilbert_dimensions_to_size(ψ.dimensions)[1])
676
676
α =expect(a, ψ)
677
677
D =exp(α * a'-conj(α) * a)
678
678
679
679
return α, D'* ψ
680
680
end
681
681
682
682
functionget_coherence(ρ::QuantumObject{Operator})
683
-
a =destroy(prod(ρ.dimensions))
683
+
a =destroy(hilbert_dimensions_to_size(ρ.dimensions)[1])
0 commit comments