1
1
"""
2
- SArray{S, T, L}(x::NTuple{L, T})
3
- SArray{S, T, L}(x1, x2, x3, ...)
2
+ sa = SArray{S, T, L}(x::NTuple{L, T})
3
+ sa = SArray{S, T, L}(x1, x2, x3, ...)
4
4
5
5
Construct a statically-sized array `SArray`. Since this type is immutable, the data must be
6
6
provided upon construction and cannot be mutated later. The `S` parameter is a Tuple-type
@@ -9,7 +9,7 @@ array. The `L` parameter is the `length` of the array and is always equal to `pr
9
9
Constructors may drop the `L` and `T` parameters if they are inferrable from the input
10
10
(e.g. `L` is always inferrable from `S`).
11
11
12
- SArray{S}(a::Array)
12
+ sa = SArray{S}(a::Array)
13
13
14
14
Construct a statically-sized array of dimensions `S` (expressed as a `Tuple{...}`) using
15
15
the data from `a`. The `S` parameter is mandatory since the size of `a` is unknown to the
52
52
53
53
@inline SArray (a:: StaticArray ) = SArray {size_tuple(a)} (Tuple (a)) # TODO fixme
54
54
55
+
56
+ """
57
+ SA = SArray(s::Size, ::Type{T})
58
+
59
+ Inferrably construct a concrete (leaf) `SArray` type with the given
60
+ [Size](@ref) `s` and element type `T`.
61
+
62
+ # Example
63
+
64
+ ```julia
65
+ julia> SArray(Size(3,2,5), Float64)
66
+ StaticArrays.SArray{Tuple{3,2,5},Float64,3,30}
67
+ ```
68
+ """
69
+ SArray {S,T} (s:: Size{S} , :: Type{T} ) = SArray{Tuple{S... }, T, length (s), prod (s)}
70
+
55
71
# Simplified show for the type
56
72
show (io:: IO , :: Type{SArray{S, T, N}} ) where {S, T, N} = print (io, " SArray{$S ,$T ,$N }" )
57
73
0 commit comments