I would like to preallocate some static arrays for use with DifferentialEquations.jl. My problem uses a lot of matrices that are 3 x N, where N is not known ahead of time. I would like to use StaticArrays.jl and do something like:
struct Memory{N}
f::MArray{Tuple{3,N},Float64,2,3N}
g::MArray{Tuple{3,N},Float64,2,3N}
...
end
Unfortunately, 3N, the number of entries, does not work as N is not seen as an integer but a type. Is there a good way to do this?
I have done something similar once, and I opted for a vector os static arrays, something like:
struct A{T<:SMatrix...}
x_solute :: Vector{T}
end
Depending on the way the operations on these vectors are performed the individual static elements do not need to be mutable at all, they can be replaced without cost.