From 04fcec44dadbabf499aa0753dbcb990e0f239411 Mon Sep 17 00:00:00 2001 From: Piotr Gawron Date: Tue, 26 Mar 2019 18:13:43 +0100 Subject: [PATCH] Additional fixes for dim issue and related issues --- src/channels.jl | 4 ++-- src/utils.jl | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/channels.jl b/src/channels.jl index 96ff428..e92d6ec 100644 --- a/src/channels.jl +++ b/src/channels.jl @@ -563,7 +563,7 @@ function Base.kron(Φ1::UnitaryChannel{M1}, Φ2::UnitaryChannel{M2}) where {M1<: end function Base.kron(::Type{T}, Φ1::IdentityChannel, Φ2::UnitaryChannel) where {T<:AbstractQuantumOperation{M}} where {M<:AbstractMatrix{<:Number}} - matrix = convert(M, Matrix(I, Φ1.idim, Φ1.odim) ⊗ Φ2.matrix) + matrix = convert(M, Matrix(I, Φ1.odim, Φ1.idim) ⊗ Φ2.matrix) uc = UnitaryChannel(matrix, Φ1.idim * Φ2.idim, Φ1.odim * Φ2.odim) convert(T, uc) end @@ -574,7 +574,7 @@ function Base.kron(Φ1::IdentityChannel{M1}, Φ2::UnitaryChannel{M2}) where {M1< end function Base.kron(::Type{T}, Φ1::UnitaryChannel, Φ2::IdentityChannel) where {T<:AbstractQuantumOperation{M}} where {M<:AbstractMatrix{<:Number}} - matrix = convert(M, Φ1.matrix ⊗ Matrix(I, Φ2.idim, Φ2.odim)) + matrix = convert(M, Φ1.matrix ⊗ Matrix(I, Φ2.odim, Φ2.idim)) uc = UnitaryChannel(matrix, Φ1.idim * Φ2.idim, Φ1.odim * Φ2.odim) convert(T, uc) end diff --git a/src/utils.jl b/src/utils.jl index fdfd9ef..d6884b4 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -100,9 +100,9 @@ function ispositive(ρ::AbstractMatrix{<:Number}; atol=1e-13) if rows!=cols return false end - if !ishermitian(ρ) - return false - end + # if !ishermitian(ρ) # TODO: ishermitian function has no tolerance + # return false + # end h = Hermitian(ρ) fact = eigen(h) all(fact.values .> -atol)