Skip to content

Commit

Permalink
refactor: use stack instead of reduce hcat
Browse files Browse the repository at this point in the history
  • Loading branch information
sathvikbhagavan committed Jul 23, 2024
1 parent 1121c94 commit 826f0a7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/online.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function append!(
append!(A.t.parent, t)
parameters = quadratic_interpolation_parameters.(
Ref(A.u), Ref(A.t), (length_old - 1):(length(A.t) - 2))
l₀, l₁, l₂ = collect.(eachrow(reduce(hcat, collect.(parameters))))
l₀, l₁, l₂ = collect.(eachrow(stack(collect.(parameters))))
append!(A.p.l₀, l₀)
append!(A.p.l₁, l₁)
append!(A.p.l₂, l₂)
Expand Down
8 changes: 4 additions & 4 deletions src/parameter_caches.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ end
function QuadraticParameterCache(u, t)
parameters = quadratic_interpolation_parameters.(
Ref(u), Ref(t), 1:(length(t) - 2))
l₀, l₁, l₂ = collect.(eachrow(reduce(hcat, collect.(parameters))))
l₀, l₁, l₂ = collect.(eachrow(stack(collect.(parameters))))
return QuadraticParameterCache(l₀, l₁, l₂)
end

Expand Down Expand Up @@ -72,7 +72,7 @@ end
function CubicSplineParameterCache(u, h, z)
parameters = cubic_spline_parameters.(
Ref(u), Ref(h), Ref(z), 1:(size(u)[end] - 1))
c₁, c₂ = collect.(eachrow(reduce(hcat, collect.(parameters))))
c₁, c₂ = collect.(eachrow(stack(collect.(parameters))))
return CubicSplineParameterCache(c₁, c₂)
end

Expand All @@ -90,7 +90,7 @@ end
function CubicHermiteParameterCache(du, u, t)
parameters = cubic_hermite_spline_parameters.(
Ref(du), Ref(u), Ref(t), 1:(length(t) - 1))
c₁, c₂ = collect.(eachrow(reduce(hcat, collect.(parameters))))
c₁, c₂ = collect.(eachrow(stack(collect.(parameters))))
return CubicHermiteParameterCache(c₁, c₂)
end

Expand All @@ -114,7 +114,7 @@ end
function QuinticHermiteParameterCache(ddu, du, u, t)
parameters = quintic_hermite_spline_parameters.(
Ref(ddu), Ref(du), Ref(u), Ref(t), 1:(length(t) - 1))
c₁, c₂, c₃ = collect.(eachrow(reduce(hcat, collect.(parameters))))
c₁, c₂, c₃ = collect.(eachrow(stack(collect.(parameters))))
return QuinticHermiteParameterCache(c₁, c₂, c₃)
end

Expand Down

0 comments on commit 826f0a7

Please sign in to comment.