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
function Base.:(*)(A::QuantumObject{Ket}, B::QuantumObject{Bra})
75
75
check_dimensions(A, B)
@@ -653,15 +653,15 @@ Get the coherence value ``\alpha`` by measuring the expectation value of the des
653
653
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|``.
654
654
"""
655
655
functionget_coherence(ψ::QuantumObject{Ket})
656
-
a =destroy(prod(ψ.dimensions))
656
+
a =destroy(hilbert_dimensions_to_size(ψ.dimensions)[1])
657
657
α =expect(a, ψ)
658
658
D =exp(α * a'-conj(α) * a)
659
659
660
660
return α, D'* ψ
661
661
end
662
662
663
663
functionget_coherence(ρ::QuantumObject{Operator})
664
-
a =destroy(prod(ρ.dimensions))
664
+
a =destroy(hilbert_dimensions_to_size(ρ.dimensions)[1])
0 commit comments