Skip to content

Commit

Permalink
fix sextupole
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsignorelli committed Feb 8, 2024
1 parent b2b68bf commit 610f293
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions benchmark/taylormap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function track_drift(z0)
end

function track_sextupole(z0, k2l)
z2 = @FastGTPSA z0[2]-k2l/2.0*(z0[1]^2 - z0[3]^2)
z2 = @FastGTPSA z0[2]-k2l*(z0[1]^2 - z0[3]^2)
z4 = @FastGTPSA z0[4]+k2l/2.0*z0[1]*z0[3]
return [z0[1], z2, z0[3], z4]
end
Expand All @@ -83,7 +83,7 @@ function track_ring(z0, k1=0.36, k2l=1.2, kick=zeros(50))
end

function benchmark_GTPSA()
d = Descriptor(4,2,52,2)
d = Descriptor(4,3,52,3)
z = vars(d)
k = params(d)
map = track_ring([z[1], z[2], z[3], z[4]], 0.36+k[1], k[2], k[3:end])
Expand All @@ -94,9 +94,9 @@ function benchmark_ForwardDiff()
m(z) = track_ring([z[1], z[2], z[3], z[4]], 0.36+z[5], z[6], z[7:end])
j = Array{Float64}(undef,4,56)
h = Array{Float64}(undef,224,56)
#c = Array{Float64}(undef,12544,56)
c = Array{Float64}(undef,12544,56)
ForwardDiff.jacobian!(j, m, zeros(56))
ForwardDiff.jacobian!(h, z->ForwardDiff.jacobian(z->m(z), z), zeros(56))
#ForwardDiff.jacobian!(c, z->ForwardDiff.jacobian(z->ForwardDiff.jacobian(z->m(z), z), z), zeros(56))
ForwardDiff.jacobian!(c, z->ForwardDiff.jacobian(z->ForwardDiff.jacobian(z->m(z), z), z), zeros(56))
return j, h #, c
end

0 comments on commit 610f293

Please sign in to comment.