Skip to content

Commit

Permalink
replaced view(x, ...) by @view(x[...]) for further perf. improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
jbcaillau committed Sep 9, 2024
1 parent a9f1c7c commit 8abc547
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/optimal_control_model-getters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ function nlp_constraints!(ocp::OptimalControlModel)
j = 1
for i 1:length(ξf)
li = ξs[i]
ξf[i](view(val, j:(j + li - 1)), t, u, v)
ξf[i](@view(val[j:(j + li - 1)]), t, u, v)
j = j + li
end
return nothing
Expand All @@ -185,7 +185,7 @@ function nlp_constraints!(ocp::OptimalControlModel)
j = 1
for i 1:length(ηf)
li = ηs[i]
ηf[i](view(val, j:(j + li - 1)), t, x, v)
ηf[i](@view(val[j:(j + li - 1)]), t, x, v)
j = j + li
end
return nothing
Expand All @@ -208,7 +208,7 @@ function nlp_constraints!(ocp::OptimalControlModel)
j = 1
for i 1:length(ψf)
li = ψs[i]
ψf[i](view(val, j:(j + li - 1)), t, x, u, v)
ψf[i](@view(val[j:(j + li - 1)]), t, x, u, v)
j = j + li
end
return nothing
Expand All @@ -231,7 +231,7 @@ function nlp_constraints!(ocp::OptimalControlModel)
j = 1
for i 1:length(ϕf)
li = ϕs[i]
ϕf[i](view(val, j:(j + li - 1)), x0, xf, v)
ϕf[i](@view(val[j:(j + li - 1)]), x0, xf, v)
j = j + li
end
return nothing
Expand All @@ -254,7 +254,7 @@ function nlp_constraints!(ocp::OptimalControlModel)
j = 1
for i 1:length(θf)
li = θs[i]
θf[i](view(val, j:(j + li - 1)), v)
θf[i](@view(val[j:(j + li - 1)]), v)
j = j + li
end
return nothing
Expand Down

0 comments on commit 8abc547

Please sign in to comment.