Skip to content

Commit 19df052

Browse files
committed
fix AD cache
1 parent c66319a commit 19df052

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

QuantumToolbox.jl/time_evolution/Quantum_Fisher_Information_with_automatic_differentiation.qmd

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,8 @@ final_state([0], 100)
103103
# Define state function for automatic differentiation
104104
state(p) = final_state(p, 2000)
105105
106-
# Prepare the jacobian computation using finite differences
107-
prep = DifferentiationInterface.prepare_jacobian(state, AutoFiniteDiff(), [0.0])
108-
109106
# Compute both the state and its derivative
110-
ρ, dρ = DifferentiationInterface.value_and_jacobian(state, prep, AutoFiniteDiff(), [0.0])
107+
ρ, dρ = DifferentiationInterface.value_and_jacobian(state, AutoFiniteDiff(), [0.0])
111108
112109
# Reshape the derivative back to matrix form
113110
dρ = QuantumToolbox.vec2mat(vec(dρ))
@@ -126,7 +123,7 @@ ts = range(0, 2000, 100)
126123
127124
QFI_t = map(ts) do t
128125
state(p) = final_state(p, t)
129-
ρ, dρ = DifferentiationInterface.value_and_jacobian(state, prep, AutoFiniteDiff(), [0.0])
126+
ρ, dρ = DifferentiationInterface.value_and_jacobian(state, AutoFiniteDiff(), [0.0])
130127
dρ = QuantumToolbox.vec2mat(vec(dρ))
131128
compute_fisher_information(ρ, dρ)
132129
end

0 commit comments

Comments
 (0)