diff --git a/docs/src/api.md b/docs/src/api.md index 5faf51d5..858e7590 100644 --- a/docs/src/api.md +++ b/docs/src/api.md @@ -10,6 +10,8 @@ CurrentModule = QuantumToolbox BraQuantumObject KetQuantumObject OperatorQuantumObject +OperatorBraQuantumObject +OperatorKetQuantumObject SuperOperatorQuantumObject QuantumObject Qobj @@ -17,6 +19,8 @@ ket2dm isbra isket isoper +isoperbra +isoperket issuper size eltype diff --git a/src/QuantumToolbox.jl b/src/QuantumToolbox.jl index 7cfcf295..65ab6aff 100644 --- a/src/QuantumToolbox.jl +++ b/src/QuantumToolbox.jl @@ -37,8 +37,8 @@ include("arnoldi.jl") include("eigsolve.jl") include("negativity.jl") -export QuantumObject, Qobj, BraQuantumObject, KetQuantumObject, OperatorQuantumObject, SuperOperatorQuantumObject, TimeEvolutionSol -export isket, isbra, isoper, issuper, ket2dm +export QuantumObject, Qobj, BraQuantumObject, KetQuantumObject, OperatorQuantumObject, OperatorBraQuantumObject, OperatorKetQuantumObject, SuperOperatorQuantumObject, TimeEvolutionSol +export isket, isbra, isoper, isoperbra, isoperket, issuper, ket2dm export spre, spost, sprepost, lindblad_dissipator export fock, basis, coherent export sigmam, sigmap, sigmax, sigmay, sigmaz diff --git a/src/quantum_object.jl b/src/quantum_object.jl index fba34a53..00bdf836 100644 --- a/src/quantum_object.jl +++ b/src/quantum_object.jl @@ -33,6 +33,20 @@ Abstract type representing a super-operator ``\hat{\mathcal{O}}``. """ abstract type SuperOperatorQuantumObject <: QuantumObjectType end +@doc raw""" + OperatorBraQuantumObject <: QuantumObjectType + +Abstract type representing a bra state in the super-operator formalism ``\langle\langle\rho|``. +""" +abstract type OperatorBraQuantumObject <: QuantumObjectType end + +@doc raw""" + OperatorKetQuantumObject <: QuantumObjectType + +Abstract type representing a ket state in the super-operator formalism ``|\rho\rangle\rangle``. +""" +abstract type OperatorKetQuantumObject <: QuantumObjectType end + @doc raw""" mutable struct QuantumObject{MT<:AbstractArray,ObjType<:QuantumObjectType} data::MT @@ -134,6 +148,20 @@ Checks if the [`QuantumObject`](@ref) `A` is a [`OperatorQuantumObject`](@ref) s """ isoper(A::QuantumObject{<:AbstractArray{T},OpType}) where {T,OpType<:QuantumObjectType} = A.type <: OperatorQuantumObject +""" + isoperbra(A::QuantumObject) + +Checks if the [`QuantumObject`](@ref) `A` is a [`OperatorBraQuantumObject`](@ref) state. +""" +isoperbra(A::QuantumObject{<:AbstractArray{T},OpType}) where {T,OpType<:QuantumObjectType} = A.type <: OperatorBraQuantumObject + +""" + isoperket(A::QuantumObject) + +Checks if the [`QuantumObject`](@ref) `A` is a [`OperatorKetQuantumObject`](@ref) state. +""" +isoperket(A::QuantumObject{<:AbstractArray{T},OpType}) where {T,OpType<:QuantumObjectType} = A.type <: OperatorKetQuantumObject + """ issuper(A::QuantumObject) @@ -213,7 +241,7 @@ LinearAlgebra.Hermitian(A::QuantumObject{<:AbstractArray{T},OpType}, uplo::Symbo QuantumObject(Hermitian(A.data, uplo), A.type, A.dims) function Base.show(io::IO, ::MIME"text/plain", QO::QuantumObject{<:AbstractArray{T},OpType}) where -{T,OpType<:Union{BraQuantumObject,KetQuantumObject,SuperOperatorQuantumObject}} +{T,OpType<:Union{BraQuantumObject,KetQuantumObject,OperatorBraQuantumObject,OperatorKetQuantumObject,SuperOperatorQuantumObject}} op_data = QO.data op_dims = QO.dims @@ -222,6 +250,10 @@ function Base.show(io::IO, ::MIME"text/plain", QO::QuantumObject{<:AbstractArray op_type = "Ket" elseif op_type <: BraQuantumObject op_type = "Bra" + elseif op_type <: OperatorKetQuantumObject + op_type = "Operator-Ket" + elseif op_type <: OperatorBraQuantumObject + op_type = "Operator-Bra" else op_type = "SuperOperator" end