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
For the following function A(η::Array) = η[1:2]'*(reshape(η[2+1:end],(2,2))\η[1:2]), I observed a weird behaviour with ForwardDiff. Suppose that we want to evaluate the gradient at x = [2.0, 2.0, 1.0, 0.0, 0.0, 1.0]. Then ForwardDiff.gradient(A,x) returns the output [4.0, 4.0, -4.0, 0.0, -4.0, -4.0]. However, I would expect 4th element of the gradient to be -4.0. If I change the vector x slightly as [2.0, 2.0, 1.0, 0.00001, 0.00001, 1.0], then the gradient turns out to be correct and I get the output [3.999960000399996, 3.999960000399996, -3.9999200011999845, -3.9999200011999845, -3.9999200011999845, -3.9999200011999845].
The text was updated successfully, but these errors were encountered:
For the following function A(η::Array) = η[1:2]'*(reshape(η[2+1:end],(2,2))\η[1:2]), I observed a weird behaviour with ForwardDiff. Suppose that we want to evaluate the gradient at x = [2.0, 2.0, 1.0, 0.0, 0.0, 1.0]. Then ForwardDiff.gradient(A,x) returns the output [4.0, 4.0, -4.0, 0.0, -4.0, -4.0]. However, I would expect 4th element of the gradient to be -4.0. If I change the vector x slightly as [2.0, 2.0, 1.0, 0.00001, 0.00001, 1.0], then the gradient turns out to be correct and I get the output [3.999960000399996, 3.999960000399996, -3.9999200011999845, -3.9999200011999845, -3.9999200011999845, -3.9999200011999845].
The text was updated successfully, but these errors were encountered: