You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using ForwardDiff
using Diffractor: DiffractorForwardBackend
import AbstractDifferentiation as AD
functiontest(z0)
z =Vector{eltype(z0)}(undef, length(z0))
L =0.5
k1 =0.36
z[1] =cos(sqrt(k1)*L)*z0[1]+1/sqrt(k1)*sin(sqrt(k1)*L)*z0[2]
z[2] =-sqrt(k1)*sin(sqrt(k1)*L)*z0[1]+cos(sqrt(k1)*L)*z0[2]
return z
endm(z) =test([z[1], z[2]])
Then:
julia> j = AD.jacobian(DiffractorForwardBackend(), m, zeros(2)) |> only
2×2 Matrix{Float64}:0.295520.492534-0.1773120.29552
julia> j = AD.jacobian(AD.ForwardDiffBackend(), m, zeros(2)) |> only
2×2 Matrix{Float64}:0.9553360.492534-0.1773120.955336
ForwardDiff.jl's Jacobian was also cross-checked with GTPSA.jl
The text was updated successfully, but these errors were encountered:
Then:
ForwardDiff.jl
's Jacobian was also cross-checked withGTPSA.jl
The text was updated successfully, but these errors were encountered: