Make complex scalars work with numpy 2.0
This is done using C++ generic functions
to get/set the real/imag parts of complex numbers.
This gives us an easy way to support Numpy v < 2.0,
and allows the type underlying the bit width types,
like pytensor_complex128, to be correctly inferred
from the numpy complex types they inherit from.
Updated pytensor_complex struct to use get/set real/imag
aliases defined above. Also updated operators such as
`Abs` to use get_real, get_imag.
Macros have been added to ensure compatibility with numpy < 2.0
Note: redefining the complex arithmetic here means that we
aren't treating NaNs and infinities as carefully as the C99
standard suggets (see Appendix G of the standard).
The code has been like this since it was added to Theano,
so we're keeping the existing behavior.
正在显示
请
注册
或者
登录
后发表评论