Hi -- I'm fiddling with NumPy's chopping and truncating operators: round, fix, ceil, and floor. In the case where they are passed real args, they work just fine. However, I find that when they are passed complex args, I get the following:
round -> works fine. ceil -> throws exception: 'complex' object has no attribute 'ceil' floor -> throws exception: 'complex' object has no attribute 'floor' fix -> throws exception: 'complex' object has no attribute 'floor' Please see the session log below for more details. My question: Is this a bug or a feature? It seems to me that if you implement round for complex args, then you need to also support ceil, floor, and fix for complex args, so it's a bug. But I thought I'd ask the developers what they thought before filing a ticket. Regards, Stuart Brorson Interactive Supercomputing, inc. 135 Beaver Street | Waltham | MA | 02452 | USA http://www.interactivesupercomputing.com/ -------------------------- <session log> ------------------- In [14]: import numpy In [15]: A = 10*numpy.random.rand(2, 2) + 10j*numpy.random.rand(2, 2) In [16]: numpy.round(A) Out[16]: array([[ 6.+8.j, 6.+5.j], [ 10.+6.j, 9.+9.j]]) In [17]: numpy.floor(A) --------------------------------------------------------------------------- <type 'exceptions.AttributeError'> Traceback (most recent call last) /fs/home/sdb/<ipython console> in <module>() <type 'exceptions.AttributeError'>: 'complex' object has no attribute 'floor' In [18]: numpy.ceil(A) --------------------------------------------------------------------------- <type 'exceptions.AttributeError'> Traceback (most recent call last) /fs/home/sdb/<ipython console> in <module>() <type 'exceptions.AttributeError'>: 'complex' object has no attribute 'ceil' In [19]: numpy.fix(A) --------------------------------------------------------------------------- <type 'exceptions.AttributeError'> Traceback (most recent call last) /fs/home/sdb/<ipython console> in <module>() /home/sdb/trunk/output/ia32_linux/python/lib/python2.5/site-packages/numpy/lib/ufunclike.py in fix(x, y) 14 x = asanyarray(x) 15 if y is None: ---> 16 y = nx.floor(x) 17 else: 18 nx.floor(x, y) <type 'exceptions.AttributeError'>: 'complex' object has no attribute 'floor' In [20]: numpy.__version__ Out[20]: '1.0.4' In [21]: ---------------------------- </session log> ------------------- _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion