MethodicalAcceleratorDesign / MAD-NG

MAD Next-Generation official repository
GNU General Public License v3.0
32 stars 11 forks source link

Bug in __eq for the tpsa and ctpsa #438

Closed 17IMMANUEL17 closed 5 months ago

17IMMANUEL17 commented 6 months ago

Discovered a bug for the equality operator: as for the print function eq checks the descriptor and not the tpsa. In this way mo = 4 d = gtpsad(nil,mo) t1 = tpsa(d) t2 = tpsa(d,3) t1==t2 -->true This should generate an error since the teo tpsas have a different order. This is due to the fact that the two different tpsas are created using the same descriptor and the check that eq does to ensure that the comparison is valid is based on the descriptor.

ldeniau commented 5 months ago

The result is correct, no bug. The order 3 in t2 is a "local" maximum order limiting size of memory and calculation as an optimisation, not a structural order that makes these tpsas incompatibles. When you print t1 and t2, they both have mo=4 and since they are empty, they have same values.