Closed mattsignorelli closed 9 months ago
tpsa and ctpsa functions do not perform type promotion (except those in mad_ctpsa_conv), i.e. they do not change the type returned with respect to the input type. Such promotions are managed at the LUA level. Consequently, hypot computes sqrt(x^2+y^2) for real and complex. The scalar value can be obtained with abs.
I will check for the aliasing problem.
aliasing fixed in c785bf0f
For complex scalars as TPSAs,
mad_ctpsa_hypot
gives:In Julia/MATLAB/etc,
hypot
with complex numbers always return a real scalar assqrt(cabs(a)^2+cabs(b)^2)
, so I'm not sure if this is a bug, or if not, then what exactly doesmad_ctpsa_hypot
calculate?I also found
mad_tpsa_hypot
andmad_ctpsa_hypot
do not correctly calculate hypot when using one of the input tpsas as the destination tpsa (e.g.mad_tpsa_hypot(t1, t2, t1)
does not give the correct answer), and wanted to confirm this was expected behavior for this function, because all of the other ones so far appear ok with this.