Skip to content

Commit

Permalink
Even more manual diff
Browse files Browse the repository at this point in the history
  • Loading branch information
gdalle committed Dec 5, 2024
1 parent 79c387a commit d7053b3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion DifferentiationInterfaceTest/src/scenarios/sparse.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
## Vector to vector

function mydiff(x::AbstractVector) # tmp fix for Enzyme
return x[2:end] .- x[1:(end - 1)]
y = similar(x, length(x) - 1)
for i in eachindex(y)
y[i] = x[i + 1] - x[i]
end
return y
end

diffsquare(x::AbstractVector)::AbstractVector = mydiff(x) .^ 2
Expand Down

0 comments on commit d7053b3

Please sign in to comment.