[Numpy-discussion] [SciPy-User] NumPy v1.13.0rc1 released.

Julian Taylor jtaylor.debian at googlemail.com
Fri May 12 11:25:52 EDT 2017


On 12.05.2017 16:28, Jens Jørgen Mortensen wrote:
> Den 11-05-2017 kl. 03:48 skrev Charles R Harris:
>> Hi All,
>>
>> I'm please to announce the NumPy 1.13.0rc1 release. This release
>> supports Python 2.7 and 3.4-3.6 and contains many new features. It is
>> one of the most ambitious releases in the last several years. Some of
>> the highlights and new functions are
> 
> I found this strange behavior:
> 
> (np113) [jensj at ASUS np113]$ python3
> Python 3.5.3 (default, Jan 19 2017, 14:11:04)
> [GCC 6.3.0 20170118] on linux
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import numpy as np
>>>> np.__version__
> '1.13.0rc1'
>>>> s = (27, 27, 27)
>>>> x = np.ones(s, complex)
>>>> y = np.zeros(s)
>>>> y += abs(x * 2.0)**2
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> TypeError: Cannot cast ufunc add output from dtype('complex128') to
> dtype('float64') with casting rule 'same_kind'
> 
> Works OK with s=(3,3,3).
> 
> Jens Jørgen
> 

Thanks, abs() should not elide complex numbers as it changes types.
Something not handled for unary functions.
As a workaround you can use np.abs() which currently does not try to elide.


More information about the NumPy-Discussion mailing list