Skip to content

Commit 0a442d0

Browse files
committed
debug: correct move blocking vector for scalar horizons
1 parent 78292bd commit 0a442d0

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/controller/construct.jl

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -490,18 +490,14 @@ end
490490
"""
491491
move_blocking(Hp::Int, Hc::Int) -> nb, Hc
492492
493-
Construct a move blocking vector `nb` to fit the provides `Hp` and `Hc` horizons.
493+
Construct a move blocking vector `nb` that match the provided `Hp` and `Hc` horizons.
494494
495-
The vector is filled with `1`s for the first `Hc` blocks. If `Hc < Hp`, the last block in
496-
`nb` is set to `Hp - Hc` to ensure the total sum is `Hp`.
495+
The vector is filled with `1`s, except for the last element which is `Hp - Hc + 1`.
497496
"""
498497
function move_blocking(Hp_arg::Int, Hc_arg::Int)
499498
Hp, Hc = Hp_arg, Hc_arg
500-
nb = fill(1, Hc_arg)
501-
if Hc < Hp
502-
newblock = Hp - Hc
503-
nb = [nb; newblock]
504-
end
499+
nb = fill(1, Hc)
500+
nb[end] = Hp - Hc + 1
505501
return nb, Hc
506502
end
507503

0 commit comments

Comments
 (0)