In StaticArrays example, there is this line:
similar_type(m3) == SArray{Tuple{3,3},Int64,2,9}
What is Tuple{3,3}? I thought Tuple, as a parameterized concrete type constructor, can’t take values, only types.
The explanation from API · StaticArrays.jl is not very illuminating:
SArrayA container with arbitrarily many dimensions is defined as
struct SArray{Size,T,N,L} <: StaticArray{Size,T,N}, whereSize = Tuple{S1, S2, ...}is a tuple ofInts. You can easily construct one with the@SArraymacro, supporting all the features of@SVectorand@SMatrix(but with arbitrary dimension).The main reason
SVectorandSMatrixare defined is to make it easier to define the types without the extra tuple characters (compareSVector{3}toSArray{Tuple{3}}).