Skip to content

Commit 951de1d

Browse files
updated manifest
1 parent 518ca52 commit 951de1d

3 files changed

Lines changed: 10 additions & 4 deletions

File tree

‎docs/Manifest.toml‎

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎docs/Project.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ QuasiMonteCarlo = "8a4e6c94-4038-4cdc-81c3-7e6ffdb2a71b"
1111
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
1212

1313
[compat]
14+
Antique = "0.12.0"
1415
Optim = "1.7.8"
1516
Plots = "1.39.0"
1617
julia = "1.11"

‎src/solution.jl‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,13 @@ converged(sol::Solution) = converged(getfield(sol, :convergence))
7777
7878
Per-step target-state energy history — concatenated across stages, or of
7979
stage `i`. Ready for plotting (see also `plot(sol)`).
80+
For a single stage, returns its stored energy history without copying.
8081
"""
81-
energies(sol::Solution) = reduce(vcat, (s.energies for s in getfield(sol, :stages)))
82+
function energies(sol::Solution)
83+
stages = getfield(sol, :stages)
84+
length(stages) == 1 && return only(stages).energies
85+
return reduce(vcat, (s.energies for s in stages))
86+
end
8287
energies(sol::Solution, i::Integer) = getfield(sol, :stages)[i].energies
8388

8489
function _fmtE(x)

0 commit comments

Comments
 (0)