We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c1e6550 commit a5c4b0cCopy full SHA for a5c4b0c
1 file changed
test/JacobianTest.jl
@@ -259,6 +259,19 @@ end
259
x0_mvector = MVector{2}(x0)
260
@test ForwardDiff.jacobian(ev1, x0_mvector) isa MMatrix{2, 2}
261
@test ForwardDiff.jacobian(ev1, x0_mvector) ≈ Calculus.finite_difference_jacobian(ev1, x0)
262
+
263
+ # real eigenvalues
264
+ f(x) = eigvals(reshape(x, 2, 2))
265
+ x1 = [1.0, 2.0, 3.0, 4.0]
266
+ @test ForwardDiff.jacobian(f, x1) ≈ Calculus.finite_difference_jacobian(f, x1)
267
268
+ # complex eigenvalues
269
+ g(x) = begin
270
+ vals = eigvals(reshape(x, 2, 2))
271
+ vcat(real(vals), imag(vals))
272
+ end
273
+ x2 = [0.0, -1.0, 1.0, 0.0]
274
+ @test ForwardDiff.jacobian(g, x2) ≈ Calculus.finite_difference_jacobian(g, x2)
275
end
276
277
@testset "type stability" begin
0 commit comments