lnls-fac / trackcpp

Particle tracking code
GNU General Public License v3.0
3 stars 3 forks source link

Create fast and dirty calc_twiss #19

Open xresende opened 8 years ago

xresende commented 8 years ago

_calctwiss now takes 80 ms on my I7 computer. 60 ms are from findm66 using TPSA which gives transfer matrices from passmethods with computer accuracy. For VACA purpose, should a fast and dirty _calctwiss (like AT) with numerical calculation of transfer matrices suffice?

fernandohds564 commented 8 years ago

How much do you think we would gain in time? How much time does it spend finding the closed orbit?

xresende commented 8 years ago

6d closed orbit only takes 1-2 ms. :zap: ! but it takes this eternity only because it iterates a few times (around 6-10) calculating 7 linepass each. I believe a dirty _calctwiss can be as fast as 4-7 ms for SI (3200 elements), if eta is also calculated numerically.

fernandohds564 commented 8 years ago

wow!! If those numbers are correct, this is pretty impressive! I think it would be worth having a flag in findm66 allowing the user to choose which method to use. Specially as it is not that dirty...

afonsoharuo commented 8 years ago

We could add another function instead of a flag, something like calc_fast_twiss.

fernandohds564 commented 8 years ago

But the code which would in fact change would be findm66 and not _calctwiss, is that right? If that's the case, the only difference in _calctwiss would be a call to a different version of findm66 and to the method which calculates the dispersion function. It seems an unnecessary duplication of code to create a _calc_fasttwiss, isn't it?

afonsoharuo commented 8 years ago

We can wrap the common code into a lower level function and then call it from two differently named high level functions.