-
Notifications
You must be signed in to change notification settings - Fork 31
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Problem Description
Suppose we have three coefficients and operators:
coef1(p, t) = sin(t)
coef2(p, t) = cos(t)
coef3(p, t) = exp(-t)
X = sigmax()
Y = sigmay()
Z = sigmaz()This is the current way we will do to create the QobjEvo:
H = QobjEvo((Z, (X, coef1), (Y, coef2), (Z, coef3)))If one has plenty of coefficients and operators, which might need to construct the Tuple using for-loop or some iterative methods.
However, there is another intuitive way to do that by using + or +=, like:
H = Z
H += QobjEvo(((X, coef1),))
H += QobjEvo(((Y, coef2),))
H += QobjEvo(((Z, coef3),))Although it might be a little bit inefficient compare to the standard method, but this is quite intuitive and convenient.
As you can see, even for single operator with coefficient, we still need to put it inside many tuples.
Therefore, I suggest to make the following code work:
H = Z + QobjEvo(X, coef1) + QobjEvo(Y, coef2) + QobjEvo(Z, coef3)Proposed Solution
If user is trying to construct QobjEvo with a single time-dependent operator, we can construct the Tuple intrinsically for the user:
QuantumObjectEvolution(
op::QuantumObject,
f::Function,
α::Union{Nothing,Number} = nothing;
type::Union{Nothing,QuantumObjectType} = nothing
) = QuantumObjectEvolution(((op, f),), α, type = type)
# same thing for synonym QobjEvoAlternate Solutions
No response
Additional Context
No response
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request