The SitePotential implementation using Folds accumulates into a vector containing three different kinds of objects, T, Vector{SVector{3, T}}, SMatrix{3, 3, T}.
I immagine that this falls within the range of a short Union that the compiler can still handle. But I wonder whether there is a better way that avoids the type instability entirely. What about using ComponentArrays here? Also a bit more readable.
The SitePotential implementation using
Folds
accumulates into a vector containing three different kinds of objects,T, Vector{SVector{3, T}}, SMatrix{3, 3, T}
.I immagine that this falls within the range of a short
Union
that the compiler can still handle. But I wonder whether there is a better way that avoids the type instability entirely. What about usingComponentArrays
here? Also a bit more readable.