@@ -119,13 +119,14 @@ struct QuantumObjectEvolution{
119119
120120 function QuantumObjectEvolution (
121121 data:: DT ,
122- type:: ObjType ,
122+ type:: Union{ ObjType,Type{ObjType}} ,
123123 dims,
124124 ) where {DT<: AbstractSciMLOperator ,ObjType<: QuantumObjectType }
125- (type == Operator || type == SuperOperator) ||
126- throw (ArgumentError (" The type $type is not supported for QuantumObjectEvolution." ))
125+ (ObjType == Operator || ObjType == SuperOperator) ||
126+ throw (ArgumentError (" The type $ObjType is not supported for QuantumObjectEvolution." ))
127127
128128 dimensions = _gen_dimensions (dims)
129+ type = _get_type (type)
129130
130131 _size = _get_size (data)
131132 _check_QuantumObject (type, dimensions, _size[1 ], _size[2 ])
@@ -153,15 +154,20 @@ function Base.show(io::IO, QO::QuantumObjectEvolution)
153154end
154155
155156@doc raw """
156- QobjEvo(data::AbstractSciMLOperator; type::QuantumObjectType = Operator, dims = nothing)
157- QuantumObjectEvolution(data::AbstractSciMLOperator; type::QuantumObjectType = Operator, dims = nothing)
157+ QobjEvo(data::AbstractSciMLOperator; type::Union{ObjType, Type{ObjType}} = Operator, dims = nothing)
158+ QuantumObjectEvolution(data::AbstractSciMLOperator; type::Union{ObjType, Type{ObjType}} = Operator, dims = nothing)
158159
159160Generate a [`QuantumObjectEvolution`](@ref) object from a [`SciMLOperator`](https://github.com/SciML/SciMLOperators.jl), in the same way as [`QuantumObject`](@ref) for `AbstractArray` inputs.
160161
161162Note that `QobjEvo` is a synonym of `QuantumObjectEvolution`
162163"""
163- function QuantumObjectEvolution (data:: AbstractSciMLOperator ; type:: QuantumObjectType = Operator, dims = nothing )
164+ function QuantumObjectEvolution (
165+ data:: AbstractSciMLOperator ;
166+ type:: Union{ObjType,Type{ObjType}} = Operator,
167+ dims = nothing ,
168+ ) where {ObjType<: QuantumObjectType }
164169 _size = _get_size (data)
170+ type = _get_type (type)
165171
166172 if dims isa Nothing
167173 if type isa Operator
@@ -177,8 +183,8 @@ function QuantumObjectEvolution(data::AbstractSciMLOperator; type::QuantumObject
177183end
178184
179185@doc raw """
180- QobjEvo(op_func_list::Union{Tuple,AbstractQuantumObject}, α::Union{Nothing,Number}=nothing; type::Union{Nothing, QuantumObjectType }=nothing)
181- QuantumObjectEvolution(op_func_list::Union{Tuple,AbstractQuantumObject}, α::Union{Nothing,Number}=nothing; type::Union{Nothing, QuantumObjectType }=nothing)
186+ QobjEvo(op_func_list::Union{Tuple,AbstractQuantumObject}, α::Union{Nothing,Number}=nothing; type::Union{Nothing, ObjType, Type{ObjType} }=nothing)
187+ QuantumObjectEvolution(op_func_list::Union{Tuple,AbstractQuantumObject}, α::Union{Nothing,Number}=nothing; type::Union{Nothing, ObjType, Type{ObjType} }=nothing)
182188
183189Generate [`QuantumObjectEvolution`](@ref).
184190
@@ -272,10 +278,12 @@ Quantum Object: type=Operator dims=[10, 2] size=(20, 20) ishermitian=fal
272278function QuantumObjectEvolution (
273279 op_func_list:: Tuple ,
274280 α:: Union{Nothing,Number} = nothing ;
275- type:: Union{Nothing,QuantumObjectType } = nothing ,
276- )
281+ type:: Union{ObjType,Type{ObjType} } = nothing ,
282+ ) where {ObjType <: QuantumObjectType }
277283 op, data = _QobjEvo_generate_data (op_func_list, α)
278284 dims = op. dimensions
285+ type = _get_type (type)
286+
279287 if type isa Nothing
280288 type = op. type
281289 end
@@ -291,12 +299,12 @@ end
291299QuantumObjectEvolution (
292300 op_func:: Tuple{QuantumObject,Function} ,
293301 α:: Union{Nothing,Number} = nothing ;
294- type:: Union{Nothing,QuantumObjectType } = nothing ,
295- ) = QuantumObjectEvolution ((op_func,), α; type = type)
302+ type:: Union{Nothing,ObjType,Type{ObjType} } = nothing ,
303+ ) where {ObjType <: QuantumObjectType } = QuantumObjectEvolution ((op_func,), α; type = type)
296304
297305@doc raw """
298- QuantumObjectEvolution(op::QuantumObject, f::Function, α::Union{Nothing,Number}=nothing; type::Union{Nothing,QuantumObjectType } = nothing)
299- QobjEvo(op::QuantumObject, f::Function, α::Union{Nothing,Number}=nothing; type::Union{Nothing,QuantumObjectType } = nothing)
306+ QuantumObjectEvolution(op::QuantumObject, f::Function, α::Union{Nothing,Number}=nothing; type::Union{Nothing, ObjType, Type{ObjType} } = nothing)
307+ QobjEvo(op::QuantumObject, f::Function, α::Union{Nothing,Number}=nothing; type::Union{Nothing, ObjType, Type{ObjType} } = nothing)
300308
301309Generate [`QuantumObjectEvolution`](@ref).
302310
@@ -329,14 +337,15 @@ QuantumObjectEvolution(
329337 op:: QuantumObject ,
330338 f:: Function ,
331339 α:: Union{Nothing,Number} = nothing ;
332- type:: Union{Nothing,QuantumObjectType } = nothing ,
333- ) = QuantumObjectEvolution (((op, f),), α; type = type)
340+ type:: Union{Nothing,ObjType,Type{ObjType} } = nothing ,
341+ ) where {ObjType <: QuantumObjectType } = QuantumObjectEvolution (((op, f),), α; type = type)
334342
335343function QuantumObjectEvolution (
336344 op:: QuantumObject ,
337345 α:: Union{Nothing,Number} = nothing ;
338- type:: Union{Nothing,QuantumObjectType} = nothing ,
339- )
346+ type:: Union{Nothing,ObjType,Type{ObjType}} = nothing ,
347+ ) where {ObjType<: QuantumObjectType }
348+ type = _get_type (type)
340349 if type isa Nothing
341350 type = op. type
342351 end
346355function QuantumObjectEvolution (
347356 op:: QuantumObjectEvolution ,
348357 α:: Union{Nothing,Number} = nothing ;
349- type:: Union{Nothing,QuantumObjectType} = nothing ,
350- )
358+ type:: Union{Nothing,ObjType,Type{ObjType}} = nothing ,
359+ ) where {ObjType<: QuantumObjectType }
360+ type = _get_type (type)
351361 if type isa Nothing
352362 type = op. type
353363 elseif type != op. type
0 commit comments