Skip to content

Commit

Permalink
Reinstate single-arg StaticArrays methods
Browse files Browse the repository at this point in the history
  • Loading branch information
danielwe committed Nov 28, 2024
1 parent cc88240 commit 56ada23
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion ext/EnzymeStaticArraysExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@ end
end
end

@inline function Enzyme.EnzymeCore.make_zero(
prev::FT
) where {S,T<:Union{AbstractFloat,Complex{<:AbstractFloat}},FT<:SArray{S,T}}
return Base.zero(prev)::FT
end
@inline function Enzyme.EnzymeCore.make_zero(
prev::FT
) where {S,T<:Union{AbstractFloat,Complex{<:AbstractFloat}},FT<:MArray{S,T}}
return Base.zero(prev)::FT
end

@inline function Enzyme.EnzymeCore.make_zero(
::Type{FT}, seen::IdDict, prev::FT, ::Val{copy_if_inactive}
) where {S,T<:Union{AbstractFloat,Complex{<:AbstractFloat}},FT<:SArray{S,T},copy_if_inactive}
Expand All @@ -47,6 +58,7 @@ end
seen[prev] = new
return new
end

@inline function Enzyme.EnzymeCore.make_zero!(
prev::FT, seen
) where {S,T<:Union{AbstractFloat,Complex{<:AbstractFloat}},FT<:MArray{S,T}}
Expand All @@ -62,7 +74,8 @@ end
@inline function Enzyme.EnzymeCore.make_zero!(
prev::FT
) where {S,T<:Union{AbstractFloat,Complex{<:AbstractFloat}},FT<:MArray{S,T}}
return Enzyme.EnzymeCore.make_zero!(prev, nothing)
Enzyme.EnzymeCore.make_zero!(prev, nothing)
return nothing
end

end

0 comments on commit 56ada23

Please sign in to comment.