Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@fast macro #12

Open
mattsignorelli opened this issue Mar 22, 2024 · 0 comments
Open

@fast macro #12

mattsignorelli opened this issue Mar 22, 2024 · 0 comments

Comments

@mattsignorelli
Copy link
Contributor

At the time of this issue, the function gofix looks like

function gofix(xy::DAMap, order=1)
  desc = getdesc(xy)
  nv = numvars(desc)

  # 1: v = map-identity in harmonic planes, identity in spin
  v = zero(xy)
  for i=1:nv
    @inbounds v.x[i] =  xy.x[i] - mono(i,use=desc)
  end
  v.Q.q[1] = 1

  # 2: map is cut to order 2 or above
  cut!(v,v,order+1)

  # 3: map is inverted at least to order 1:
  inv!(v,v)

  # 4: a map x is created with dimension nv
  # x is zero except for the parameters and delta if coasting
  x = zero(v) # default identity in parameters
  x.Q.q[1] = 1 # identity in spin
  compose!(v,v,x)

  # 5: add back in identity
  for i=1:nv
    @inbounds v.x[i] += mono(i,use=desc)
  end

  return v
end

This is pretty fast (could be made faster by proper use of work temporaries accessible by user of inv and compose) , however this is not the easiest to read. gofix could instead be written as

function gofix(xy::DAMap, order=1)
  m = cut(xy, order+1)
  return (m-I)^-1zero(m)+I
end

This is much easier to understand and read, however much slower. For the best of both worlds, a macro must be implemented to convert the above easy-to-read function to its faster less-easy-to-read function. The approach could be the same as that taken for @FastGTPSA in GTPSA.jl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant