From 82b7bb2734517cb8930ca43c7fb62f0d21e66c2e Mon Sep 17 00:00:00 2001 From: Yi-Te Huang Date: Tue, 9 Apr 2024 16:06:20 +0800 Subject: [PATCH] modify `QuantumObject` strings in `show()` --- src/quantum_object.jl | 8 ++++---- test/quantum_objects.jl | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/quantum_object.jl b/src/quantum_object.jl index 7c635ad9..591dd4d9 100644 --- a/src/quantum_object.jl +++ b/src/quantum_object.jl @@ -181,12 +181,12 @@ function _check_QuantumObject(type::SuperOperatorQuantumObject, prod_dims::Int, end function _check_QuantumObject(type::OperatorKetQuantumObject, prod_dims::Int, m::Int, n::Int) - (n != 1) ? throw(DomainError((m, n), "The dimension of the array is not compatible with Operator-Ket type")) : nothing + (n != 1) ? throw(DomainError((m, n), "The dimension of the array is not compatible with OperatorKet type")) : nothing prod_dims != sqrt(m) ? throw(DimensionMismatch("The dims parameter does not fit the dimension of the Array.")) : nothing end function _check_QuantumObject(type::OperatorBraQuantumObject, prod_dims::Int, m::Int, n::Int) - (m != 1) ? throw(DomainError((m, n), "The dimension of the array is not compatible with Operator-Bra type")) : nothing + (m != 1) ? throw(DomainError((m, n), "The dimension of the array is not compatible with OperatorBra type")) : nothing prod_dims != sqrt(n) ? throw(DimensionMismatch("The dims parameter does not fit the dimension of the Array.")) : nothing end @@ -336,9 +336,9 @@ function Base.show(io::IO, ::MIME"text/plain", QO::QuantumObject{<:AbstractArray elseif op_type isa BraQuantumObject op_type = "Bra" elseif op_type isa OperatorKetQuantumObject - op_type = "Operator-Ket" + op_type = "OperatorKet" elseif op_type isa OperatorBraQuantumObject - op_type = "Operator-Bra" + op_type = "OperatorBra" else op_type = "SuperOperator" end diff --git a/test/quantum_objects.jl b/test/quantum_objects.jl index a1bedfc6..371f4d6a 100644 --- a/test/quantum_objects.jl +++ b/test/quantum_objects.jl @@ -202,14 +202,14 @@ datastring = sprint((t, s) -> show(t, "text/plain", s), ψ2.data) ψ2_dims = ψ2.dims ψ2_size = size(ψ2) - @test opstring == "Quantum Object: type=Operator-Ket dims=$ψ2_dims size=$ψ2_size\n$datastring" + @test opstring == "Quantum Object: type=OperatorKet dims=$ψ2_dims size=$ψ2_size\n$datastring" ψ2 = ψ2' opstring = sprint((t, s) -> show(t, "text/plain", s), ψ2) datastring = sprint((t, s) -> show(t, "text/plain", s), ψ2.data) ψ2_dims = ψ2.dims ψ2_size = size(ψ2) - @test opstring == "Quantum Object: type=Operator-Bra dims=$ψ2_dims size=$ψ2_size\n$datastring" + @test opstring == "Quantum Object: type=OperatorBra dims=$ψ2_dims size=$ψ2_size\n$datastring" ψ = coherent(30, 3) α, δψ = get_coherence(ψ)