Difference between SArray{...} and StaticArray{...}

I am confused about the type parameters of StaticArrays. In particular, I defined Point2F = Point{2,Float64} for a 2D point , where the latter is from GeometryBasics. Its supertypes are as follows
image
I then defined Vector2F=SVector{2,Float64} to describe a 2-element vector. Its supertypes are
image
I noticed Point2F to be a subtype of StaticArray{Tuple{2},Float64,1}, which I understand as a "1"D array with first dimension size β€œ2”, and element type Float64. However, it is NOT a subtype of essentially the same thing, namely, SArray{Tuple{2},Float64,1,2}, which refers to a "1"D array with first dimension size β€œ2”, eltype Float64, and total length β€œ2”.
My question is, why are the two types SArray{...} and StaticArray{...} described above different? In what sense is the latter more general than the former? What types belong to the latter but not the former?

Point2F is an alias for Point{2,Float64}.

Vector2F is an alias for SArray{Tuple{2},Float64,1,2}.

These are two concrete types. Both are subtypes of the abstract type StaticArray{Tuple{2},Float64,1}.

Does this answer your question?

To elaborate on sudete’s answer: StaticArray is an abstract type while SArray is a concrete type. You cannot subtype concrete types, only abstract types. I.e. all concrete types in the type hierarchy are β€œfinal”.

2 Likes