From ef1e4afc146c5440ccfc212f4b13f5aa269721e6 Mon Sep 17 00:00:00 2001 From: Aayush Sabharwal Date: Wed, 24 Jul 2024 12:33:58 +0530 Subject: [PATCH] fixup! refactor: use clock from SciMLBase, fix tests --- src/discretedomain.jl | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/discretedomain.jl b/src/discretedomain.jl index 5706010e54..facb151d77 100644 --- a/src/discretedomain.jl +++ b/src/discretedomain.jl @@ -183,18 +183,18 @@ julia> x(k) # no shift x(t) julia> x(k+1) # shift -Shift(t, 1)(x(t)) +Shift(1)(x(t)) ``` """ struct ShiftIndex clock::Union{InferredTimeDomain, TimeDomain, IntegerSequence} steps::Int function ShiftIndex( - clock::Union{TimeDomain, InferredTimeDomain} = Inferred, steps::Int = 0) + clock::Union{TimeDomain, InferredTimeDomain, IntegerSequence} = Inferred, steps::Int = 0) new(clock, steps) end ShiftIndex(dt::Real, steps::Int = 0) = new(Clock(dt), steps) - ShiftIndex(t::Num, steps::Int = 0) = new(IntegerSequence(), steps) + ShiftIndex(::Num, steps::Int) = new(IntegerSequence(), steps) end function (xn::Num)(k::ShiftIndex) @@ -207,11 +207,6 @@ function (xn::Num)(k::ShiftIndex) args = Symbolics.arguments(vars[]) # args should be one element vector with the t in x(t) length(args) == 1 || error("Cannot shift an expression with multiple independent variables $x.") - t = args[] - if hasfield(typeof(clock), :t) - isequal(t, clock.t) || - error("Independent variable of $xn is not the same as that of the ShiftIndex $(k.t)") - end # d, _ = propagate_time_domain(xn) # if d != clock # this is only required if the variable has another clock