Open xresende opened 8 years ago
How much do you think we would gain in time? How much time does it spend finding the closed orbit?
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.
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...
We could add another function instead of a flag, something like calc_fast_twiss.
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?
We can wrap the common code into a lower level function and then call it from two differently named high level functions.
_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?