have been banging my head against a wall trying to use static arrays in julia.
They are fast but updating them is a pain. This is no surprise, they are meant to be immutable!
But it is continuously recommended to me that I use static arrays even though I have to update them. In my case, the static arrays are small, just length 3, and i have a vector of them, but I only update 1 length three SVector at a time.
thanks
Nowadays you can often get away with converting to MVector, modifying the MVector, and then converting back to SVector, without incurring additional costs (like dynamic allocation). For example,
using StaticArrays
using BenchmarkTools
function f(x)
y = MVector(x)
y[3] = 1
SVector(y)
end