Skip to content

Commit bb01cbd

Browse files
authored
add SArray and MArray implimentations
1 parent 5788c1e commit bb01cbd

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/ArrayInterfaceStaticArrays/src/ArrayInterfaceStaticArrays.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ import ArrayInterfaceStaticArraysCore
99

1010
const CanonicalInt = Union{Int,StaticInt}
1111

12+
function ArrayInterface.undefmatrix(::MArray{S, T, N, L}) where {S, T, N, L}
13+
return MMatrix{L, L, T, L*L}(undef)
14+
end
15+
# SArray doesn't have an undef constructor and is going to be small enough that this is fine.
16+
function ArrayInterface.undefmatrix(s::SArray)
17+
v = vec(s)
18+
return v.*v'
19+
end
1220
ArrayInterface.known_first(::Type{<:StaticArrays.SOneTo}) = 1
1321
ArrayInterface.known_last(::Type{StaticArrays.SOneTo{N}}) where {N} = N
1422
ArrayInterface.known_length(::Type{StaticArrays.SOneTo{N}}) where {N} = N

0 commit comments

Comments
 (0)