• Brendan Murphy's avatar
    Make complex scalars work with numpy 2.0 · 756be77e
    Brendan Murphy 提交于
    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.
    756be77e
basic.py 140.8 KB