Skip to content

Commit 565ed53

Browse files
author
xiaoming
committed
Update delayssajump.jl
1 parent 0e4a7cb commit 565ed53

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/delayaggregator/delayssajump.jl

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,21 +223,33 @@ Find the minimal dt_delay in all delay channels.
223223
"""
224224
function find_next_delay_dt!(p, integrator)
225225
de_chan = integrator.de_chan
226-
p.dt_delay = find_minimun_dt_delay(de_chan)
226+
p.dt_delay = find_minimum_dt_delay(de_chan)
227227
nothing
228228
end
229229

230-
function find_minimun_dt_delay(de_chan::Vector{Vector{T}}) where {T}
230+
231+
# find the minimum of a vector of vectors
232+
function find_minimum_dt_delay(de_chan::Vector{Vector{T}}) where {T}
231233
val_vec = Vector{T}(undef,length(de_chan))
232234
@inbounds for i in eachindex(de_chan)
233235
val_vec[i] = isempty(de_chan[i]) ? typemax(T) : minimum(de_chan[i])
234236
end
235237
minimum(val_vec)
236238
end
237239

240+
# find the minimum of a vector of vectors alternative
241+
# function find_minimum_dt_delay(vec::Vector{Vector{T}})::T where {T<:Real}
242+
# minimum(map(subvec -> minimum(subvec), vec))
243+
# end
244+
#minimum of an empty vector
245+
# function minimum_empty(vec::Vector{T})::T where {T<:Real}
246+
# isempty(vec) ? typemax(T) : minimum(vec)
247+
# end
248+
249+
238250
function find_next_delay_num!(p, de_chan::Vector{Vector{T}}) where {T}
239251
@label restart
240-
val = find_minimun_dt_delay(de_chan)
252+
val = find_minimum_dt_delay(de_chan)
241253
if val < eps(T)
242254
shift_delay_channel!(de_chan, eps(T))
243255
update_delay_channel!(de_chan)

0 commit comments

Comments
 (0)