Skip to content
This repository was archived by the owner on Mar 1, 2023. It is now read-only.

Use static range in Grad setproperty! #1537

Merged
merged 1 commit into from
Sep 10, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/Utilities/VariableTemplates/VariableTemplates.jl
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,14 @@ end
offset += 1
elseif T <: StaticArray
N = length(T)
retexpr = :(array[:, ($(offset + 1)):($(offset + N))] = val)
retexpr = :(
array[
:,
# static range is used here to force dispatch to
# StaticArrays setindex! because generic setindex! is slow
StaticArrays.SUnitRange($(offset + 1), $(offset + N)),
] = val
)
offset += N
else
offset += varsize(T)
Expand Down