Skip to content

Commit 4aed473

Browse files
Merge pull request #48 from SciML/sarray
More static array structure handling
2 parents 9a2ce84 + b1312c4 commit 4aed473

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/ArrayInterface.jl

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,8 +489,18 @@ function __init__()
489489
return StaticArrays.LU(L, U, p)
490490
end
491491

492-
function restructure(x::StaticArrays.SArray,y)
493-
error("Currently not supported")
492+
function restructure(x::StaticArrays.SArray,y::StaticArrays.SArray)
493+
reshape(y,StaticArrays.Size(x))
494+
end
495+
496+
function restructure(x::StaticArrays.SArray{S},y::Array) where S
497+
StaticArrays.SArray{S}(y)
498+
end
499+
500+
@require Adapt="79e6a3ab-5dfb-504d-930d-738a2a938a0e" begin
501+
function Adapt.adapt_storage(::Type{<:StaticArrays.SArray{S}},xs::Array) where S
502+
StaticArrays.SArray{S}(xs)
503+
end
494504
end
495505
end
496506

0 commit comments

Comments
 (0)