@@ -8,57 +8,57 @@ using Static
8
8
9
9
const CanonicalInt = Union{Int,StaticInt}
10
10
11
- ArrayInterfaceCore . ismutable (:: Type{<:StaticArrays.StaticArray} ) = false
12
- ArrayInterfaceCore . ismutable (:: Type{<:StaticArrays.MArray} ) = true
13
- ArrayInterfaceCore . ismutable (:: Type{<:StaticArrays.SizedArray} ) = true
11
+ ArrayInterface . ismutable (:: Type{<:StaticArrays.StaticArray} ) = false
12
+ ArrayInterface . ismutable (:: Type{<:StaticArrays.MArray} ) = true
13
+ ArrayInterface . ismutable (:: Type{<:StaticArrays.SizedArray} ) = true
14
14
15
- ArrayInterfaceCore . can_setindex (:: Type{<:StaticArrays.StaticArray} ) = false
16
- ArrayInterfaceCore . buffer (A:: Union{StaticArrays.SArray,StaticArrays.MArray} ) = getfield (A, :data )
15
+ ArrayInterface . can_setindex (:: Type{<:StaticArrays.StaticArray} ) = false
16
+ ArrayInterface . buffer (A:: Union{StaticArrays.SArray,StaticArrays.MArray} ) = getfield (A, :data )
17
17
18
- function ArrayInterfaceCore . lu_instance (_A:: StaticArrays.StaticMatrix{N,N} ) where {N}
18
+ function ArrayInterface . lu_instance (_A:: StaticArrays.StaticMatrix{N,N} ) where {N}
19
19
A = StaticArrays. SArray (_A)
20
20
L = LowerTriangular (A)
21
21
U = UpperTriangular (A)
22
22
p = StaticArrays. SVector {N,Int} (1 : N)
23
23
return StaticArrays. LU (L, U, p)
24
24
end
25
25
26
- function ArrayInterfaceCore . restructure (x:: StaticArrays.SArray , y:: StaticArrays.SArray )
26
+ function ArrayInterface . restructure (x:: StaticArrays.SArray , y:: StaticArrays.SArray )
27
27
reshape (y, StaticArrays. Size (x))
28
28
end
29
- ArrayInterfaceCore . restructure (x:: StaticArrays.SArray{S} , y) where {S} = StaticArrays. SArray {S} (y)
29
+ ArrayInterface . restructure (x:: StaticArrays.SArray{S} , y) where {S} = StaticArrays. SArray {S} (y)
30
30
31
- ArrayInterfaceCore . known_first (:: Type{<:StaticArrays.SOneTo} ) = 1
32
- ArrayInterfaceCore . known_last (:: Type{StaticArrays.SOneTo{N}} ) where {N} = N
33
- ArrayInterfaceCore . known_length (:: Type{StaticArrays.SOneTo{N}} ) where {N} = N
34
- ArrayInterfaceCore . known_length (:: Type{StaticArrays.Length{L}} ) where {L} = L
35
- function ArrayInterfaceCore . known_length (:: Type{A} ) where {A<: StaticArrays.StaticArray }
36
- ArrayInterfaceCore . known_length (StaticArrays. Length (A))
31
+ ArrayInterface . known_first (:: Type{<:StaticArrays.SOneTo} ) = 1
32
+ ArrayInterface . known_last (:: Type{StaticArrays.SOneTo{N}} ) where {N} = N
33
+ ArrayInterface . known_length (:: Type{StaticArrays.SOneTo{N}} ) where {N} = N
34
+ ArrayInterface . known_length (:: Type{StaticArrays.Length{L}} ) where {L} = L
35
+ function ArrayInterface . known_length (:: Type{A} ) where {A<: StaticArrays.StaticArray }
36
+ ArrayInterface . known_length (StaticArrays. Length (A))
37
37
end
38
38
39
- ArrayInterfaceCore . device (:: Type{<:StaticArrays.MArray} ) = ArrayInterfaceCore . CPUPointer ()
40
- ArrayInterfaceCore . device (:: Type{<:StaticArrays.SArray} ) = ArrayInterfaceCore . CPUTuple ()
41
- ArrayInterfaceCore . contiguous_axis (:: Type{<:StaticArrays.StaticArray} ) = StaticInt {1} ()
42
- ArrayInterfaceCore . contiguous_batch_size (:: Type{<:StaticArrays.StaticArray} ) = StaticInt {0} ()
43
- ArrayInterfaceCore . stride_rank (:: Type{T} ) where {N,T<: StaticArray{<:Any,<:Any,N} } = Static. nstatic (Val (N))
44
- function ArrayInterfaceCore . dense_dims (:: Type{<:StaticArray{S,T,N}} ) where {S,T,N}
45
- ArrayInterfaceCore . _all_dense (Val (N))
39
+ ArrayInterface . device (:: Type{<:StaticArrays.MArray} ) = ArrayInterface . CPUPointer ()
40
+ ArrayInterface . device (:: Type{<:StaticArrays.SArray} ) = ArrayInterface . CPUTuple ()
41
+ ArrayInterface . contiguous_axis (:: Type{<:StaticArrays.StaticArray} ) = StaticInt {1} ()
42
+ ArrayInterface . contiguous_batch_size (:: Type{<:StaticArrays.StaticArray} ) = StaticInt {0} ()
43
+ ArrayInterface . stride_rank (:: Type{T} ) where {N,T<: StaticArray{<:Any,<:Any,N} } = Static. nstatic (Val (N))
44
+ function ArrayInterface . dense_dims (:: Type{<:StaticArray{S,T,N}} ) where {S,T,N}
45
+ ArrayInterface . _all_dense (Val (N))
46
46
end
47
- ArrayInterfaceCore . defines_strides (:: Type{<:StaticArrays.SArray} ) = true
48
- ArrayInterfaceCore . defines_strides (:: Type{<:StaticArrays.MArray} ) = true
47
+ ArrayInterface . defines_strides (:: Type{<:StaticArrays.SArray} ) = true
48
+ ArrayInterface . defines_strides (:: Type{<:StaticArrays.MArray} ) = true
49
49
50
- @generated function ArrayInterfaceCore . axes_types (:: Type{<:StaticArrays.StaticArray{S}} ) where {S}
50
+ @generated function ArrayInterface . axes_types (:: Type{<:StaticArrays.StaticArray{S}} ) where {S}
51
51
Tuple{[StaticArrays. SOneTo{s} for s in S. parameters]. .. }
52
52
end
53
- @generated function ArrayInterfaceCore . size (A:: StaticArrays.StaticArray{S} ) where {S}
53
+ @generated function ArrayInterface . size (A:: StaticArrays.StaticArray{S} ) where {S}
54
54
t = Expr (:tuple )
55
55
Sp = S. parameters
56
56
for n = 1 : length (Sp)
57
57
push! (t. args, Expr (:call , Expr (:curly , :StaticInt , Sp[n])))
58
58
end
59
59
return t
60
60
end
61
- @generated function ArrayInterfaceCore . strides (A:: StaticArrays.StaticArray{S} ) where {S}
61
+ @generated function ArrayInterface . strides (A:: StaticArrays.StaticArray{S} ) where {S}
62
62
t = Expr (:tuple , Expr (:call , Expr (:curly , :StaticInt , 1 )))
63
63
Sp = S. parameters
64
64
x = 1
68
68
return t
69
69
end
70
70
if StaticArrays. SizedArray{Tuple{8 ,8 },Float64,2 ,2 } isa UnionAll
71
- @inline ArrayInterfaceCore . strides (B:: StaticArrays.SizedArray{S,T,M,N,A} ) where {S,T,M,N,A<: SubArray } = ArrayInterfaceCore . strides (B. data)
72
- ArrayInterfaceCore . parent_type (:: Type{<:StaticArrays.SizedArray{S,T,M,N,A}} ) where {S,T,M,N,A} = A
71
+ @inline ArrayInterface . strides (B:: StaticArrays.SizedArray{S,T,M,N,A} ) where {S,T,M,N,A<: SubArray } = ArrayInterface . strides (B. data)
72
+ ArrayInterface . parent_type (:: Type{<:StaticArrays.SizedArray{S,T,M,N,A}} ) where {S,T,M,N,A} = A
73
73
else
74
- ArrayInterfaceCore . parent_type (:: Type{<:StaticArrays.SizedArray{S,T,M,N}} ) where {S,T,M,N} = Array{T,N}
74
+ ArrayInterface . parent_type (:: Type{<:StaticArrays.SizedArray{S,T,M,N}} ) where {S,T,M,N} = Array{T,N}
75
75
end
76
76
77
77
Adapt. adapt_storage (:: Type{<:StaticArrays.SArray{S}} , xs:: Array ) where {S} = SArray {S} (xs)
0 commit comments