[pypy-issue] [issue913] Reduce-like *functions* for micronumpy missing, e.g. numpy.dot

Peter tracker at bugs.pypy.org
Tue Oct 18 16:03:32 CEST 2011


New submission from Peter <p.j.a.cock at googlemail.com>:

I see that under Issue 758 many numpy array reduce *methods* like dot were
introduced. However, relevant numpy reduce *functions* are still missing.

The following should work on C Python with any version of NumPy, in this case I
used NumPy 1.2.1 on Mac OS X.

>>> import numpy as np
>>> np.dot(np.ones(5), np.ones(5))
5.0
>>> np.vdot(np.ones(5), np.ones(5))
5.0
>>> np.sum(np.ones(5))
5.0
>>> np.power(np.ones(5)*2, 3)
array([ 8.,  8.,  8.,  8.,  8.])
>>> np.max(np.ones(5))
5.0
>>> np.min(np.ones(5))
5.0
>>> np.argmax(np.ones(5))
0
>>> np.argmin(np.ones(5))
0
>>> np.all(np.ones(5))
True
>>> np.any(np.ones(5))
True


Using PyPy 1.6, there is no dot, vdot, sum, power, add, min, max, argmin,
argmmax, all, any, ... function:

>>>> import numpy as np
>>>> np.dot(np.ones(5), np.ones(5))
Traceback (most recent call last):
  File "<console>", line 1, in <module>
AttributeError: 'module' object has no attribute 'dot'
>>>> np.ones(5).vdot(np.ones(5))
Traceback (most recent call last):
  File "<console>", line 1, in <module>
AttributeError: 'numarray' object has no attribute 'vdot'
>>>> np.sum(no.ones(5))
Traceback (most recent call last):
  File "<console>", line 1, in <module>
AttributeError: 'module' object has no attribute 'sum'
>>>> np.power(np.ones(5)*2, 3)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
AttributeError: 'module' object has no attribute 'power'
>>>> np.max(no.ones(5))
Traceback (most recent call last):
  File "<console>", line 1, in <module>
AttributeError: 'module' object has no attribute 'max'
>>>> np.min(no.ones(5))
Traceback (most recent call last):
  File "<console>", line 1, in <module>
AttributeError: 'module' object has no attribute 'min'
>>>> np.argmax(no.ones(5))
Traceback (most recent call last):
  File "<console>", line 1, in <module>
AttributeError: 'module' object has no attribute 'argmax'
>>>> np.argmin(no.ones(5))
Traceback (most recent call last):
  File "<console>", line 1, in <module>
AttributeError: 'module' object has no attribute 'argmin'
>>>> np.all(no.ones(5))
Traceback (most recent call last):
  File "<console>", line 1, in <module>
AttributeError: 'module' object has no attribute 'all'
>>>> np.any(no.ones(5))
Traceback (most recent call last):
  File "<console>", line 1, in <module>
AttributeError: 'module' object has no attribute 'any'

This is probably just a sublist, but some of these are quite widely used.

----------
messages: 3339
nosy: pypy-issue
priority: bug
release: 1.6
status: unread
title: Reduce-like *functions* for micronumpy missing, e.g. numpy.dot

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue913>
________________________________________


More information about the pypy-issue mailing list