-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update TMJets returning the TMs #634
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -18,8 +18,8 @@ SOFTWARE. | |||||
=# | ||||||
|
||||||
using TaylorSeries | ||||||
using TaylorIntegration:jetcoeffs! | ||||||
using TaylorModels: validated_step!,TaylorModelN | ||||||
using TaylorIntegration: jetcoeffs! | ||||||
using TaylorModels: validated_step!, TaylorModel1, TaylorModelN | ||||||
import IntervalArithmetic | ||||||
|
||||||
function validated_integ(f!, qq0::AbstractVector{T}, δq0::IntervalBox{N,T}, | ||||||
|
@@ -31,17 +31,19 @@ function validated_integ(f!, qq0::AbstractVector{T}, δq0::IntervalBox{N,T}, | |||||
@assert N == get_numvars() | ||||||
dof = N | ||||||
|
||||||
# Some variables | ||||||
R = IntervalArithmetic.Interval{T} | ||||||
q0 = IntervalBox(qq0) | ||||||
t = t0 + Taylor1(orderT) | ||||||
tI = t0 + Taylor1(orderT+1) | ||||||
t = t0 + Taylor1(orderT) | ||||||
tI = t0 + Taylor1(orderT+1) | ||||||
δq_norm = IntervalBox(IntervalArithmetic.Interval{T}(-1,1), Val(N)) | ||||||
q0box = q0 + δq_norm | ||||||
q0box = q0 .+ δq_norm | ||||||
|
||||||
# Allocation of vectors | ||||||
# Output | ||||||
tv = Vector{T}(undef, maxsteps+1) | ||||||
xv = Vector{IntervalBox{N,T}}(undef, maxsteps+1) | ||||||
xTM1v = Matrix{TaylorModel1{TaylorN{T}, T}}(undef, dof, maxsteps+1) | ||||||
|
||||||
# Internals: jet transport integration | ||||||
x = Vector{Taylor1{TaylorN{T}}}(undef, dof) | ||||||
|
@@ -58,20 +60,21 @@ function validated_integ(f!, qq0::AbstractVector{T}, δq0::IntervalBox{N,T}, | |||||
|
||||||
# Set initial conditions | ||||||
zI = zero(R) | ||||||
Δ = zero.(q0) | ||||||
rem = Vector{IntervalArithmetic.Interval{T}}(undef, dof) | ||||||
|
||||||
@inbounds for i in eachindex(x) | ||||||
qaux = normalize_taylor(qq0[i] + TaylorN(i, order=orderQ), δq0, true) | ||||||
x[i] = Taylor1( qaux, orderT) | ||||||
x[i] = Taylor1(qaux, orderT) | ||||||
dx[i] = x[i] | ||||||
x0[i] = copy(qaux) | ||||||
xTMN[i] = TaylorModelN(x[i][0], zI, q0, q0box) | ||||||
# | ||||||
|
||||||
xI[i] = Taylor1(q0box[i], orderT+1) | ||||||
dxI[i] = xI[i] | ||||||
x0I[i] = qaux(δq_norm) | ||||||
rem[i] = zI | ||||||
|
||||||
xTM1v[i, 1] = TaylorModel1(deepcopy(x[i]), zI, zI, zI) | ||||||
end | ||||||
|
||||||
# Output vectors | ||||||
|
@@ -100,13 +103,18 @@ function validated_integ(f!, qq0::AbstractVector{T}, δq0::IntervalBox{N,T}, | |||||
# New initial conditions and time | ||||||
nsteps += 1 | ||||||
t0 += δt | ||||||
@inbounds t[0] = t0 | ||||||
@inbounds tI[0] = t0 | ||||||
@inbounds tv[nsteps] = t0 | ||||||
@inbounds for i in eachindex(x) | ||||||
aux = x[i](δt) | ||||||
x[i] = Taylor1(aux, orderT) | ||||||
dx[i] = Taylor1(zero(aux), orderT) | ||||||
@inbounds begin | ||||||
t[0] = t0 | ||||||
tI[0] = t0 | ||||||
tv[nsteps] = t0 | ||||||
for i in eachindex(x) | ||||||
xTM1v[i, nsteps] = TaylorModel1(deepcopy(x[i]), rem[i], | ||||||
IntervalArithmetic.Interval(0, 0), | ||||||
IntervalArithmetic.Interval(0, δt)) | ||||||
aux = x[i](δt) | ||||||
x[i] = Taylor1(aux, orderT) | ||||||
dx[i] = Taylor1(zero(aux), orderT) | ||||||
end | ||||||
end | ||||||
|
||||||
if nsteps > maxsteps | ||||||
|
@@ -116,7 +124,7 @@ function validated_integ(f!, qq0::AbstractVector{T}, δq0::IntervalBox{N,T}, | |||||
|
||||||
end | ||||||
|
||||||
return view(tv,1:nsteps), view(xv,1:nsteps) | ||||||
return view(tv,1:nsteps), view(xv,1:nsteps), view(xTM1v, :, 1:nsteps) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should you not accept this new output here? Reachability.jl/src/ReachSets/ContinuousPost/TMJets/post.jl Lines 50 to 51 in 1bcaf01
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it should read it (i opened #635 as follow up) and so far it is ignored. I didn't do it here because there was no obvious workaround: |
||||||
end | ||||||
|
||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe do
for i, xi in enumerate(x)
.