From d7053b3237826dfd4055d565fde9be48b82d8796 Mon Sep 17 00:00:00 2001 From: Guillaume Dalle <22795598+gdalle@users.noreply.github.com> Date: Thu, 5 Dec 2024 15:53:02 +0100 Subject: [PATCH] Even more manual diff --- DifferentiationInterfaceTest/src/scenarios/sparse.jl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/DifferentiationInterfaceTest/src/scenarios/sparse.jl b/DifferentiationInterfaceTest/src/scenarios/sparse.jl index afe9bacae..b3e2d552a 100644 --- a/DifferentiationInterfaceTest/src/scenarios/sparse.jl +++ b/DifferentiationInterfaceTest/src/scenarios/sparse.jl @@ -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