Large matrix crashes StaticArrays

I would like to instantiate a medium-size (1000,1000) matrix in a StaticArray field of MyStruct. But it crashes!
Can you tell me if I am doing something wrong?

a = SMatrix{1000,1000, Float64}(rand(1000,1000))

syntax: expression too large
 [1] top-level scope at /home/cocconat/Documents/Research/phd_project/simulations/tripod_network/weights/dataStructs.jl:96
 [2] _convert at /home/cocconat/.julia/packages/StaticArrays/LJQEe/src/convert.jl:35 [inlined]
 [3] convert at /home/cocconat/.julia/packages/StaticArrays/LJQEe/src/convert.jl:32 [inlined]
 [4] SArray{Tuple{1000,1000},Float64,2,L} where L(::Array{Float64,2}) at /home/cocconat/.julia/packages/StaticArrays/LJQEe/src/convert.jl:7
 [5] top-level scope at /home/cocconat/Documents/Research/phd_project/simulations/tripod_network/weights/dataStructs.jl:96


Static arrays are not meant for big matrices/vectors but only up to about 100 elements. I think this is essentially Julia’s parser giving up to parse an expression for a 1-million element tuple (which is the underlying storage for StaticArrays).


you are right, it is also written in the README

1 Like