Skip to content

Commit 62cd8e4

Browse files
Copilotgoerz
andauthored
Replace ≈ with norm-based comparison in Zygote gradient tests
Agent-Logs-Url: https://github.com/JuliaQuantumControl/QuantumControl.jl/sessions/db517dc6-313e-44f8-8f48-90f2a7f85542 Co-authored-by: goerz <112306+goerz@users.noreply.github.com>
1 parent 0f889af commit 62cd8e4

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

test/test_traj_zygote.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ end
3232
@test grad isa NamedTuple
3333
@test grad.initial_state isa Vector
3434
expected_grad = -Ψtgt .* conj(dot(Ψ, Ψtgt)) / N
35-
@test grad.initial_state expected_grad
35+
@test norm(grad.initial_state - expected_grad) < 1e-14
3636

3737
end
3838

@@ -65,7 +65,7 @@ end
6565
@test grad.initial_state isa Nothing
6666
@test grad.kwargs[:x] isa Vector
6767
expected_grad = -Ψtgt .* conj(dot(Ψ, Ψtgt)) / N
68-
@test grad.kwargs[:x] expected_grad
68+
@test norm(grad.kwargs[:x] - expected_grad) < 1e-14
6969
end
7070

7171
end

0 commit comments

Comments
 (0)