[pypy-commit] pypy default: delegate mean to numpy.core._methods
bdkearns
noreply at buildbot.pypy.org
Mon Oct 28 22:07:54 CET 2013
Author: Brian Kearns <bdkearns at gmail.com>
Branch:
Changeset: r67657:5a3e53d3a04c
Date: 2013-10-28 13:29 -0400
http://bitbucket.org/pypy/pypy/changeset/5a3e53d3a04c/
Log: delegate mean to numpy.core._methods
diff --git a/pypy/module/micronumpy/appbridge.py b/pypy/module/micronumpy/appbridge.py
--- a/pypy/module/micronumpy/appbridge.py
+++ b/pypy/module/micronumpy/appbridge.py
@@ -1,6 +1,7 @@
from rpython.rlib.objectmodel import specialize
class AppBridgeCache(object):
+ w__mean = None
w__var = None
w__std = None
w_module = None
diff --git a/pypy/module/micronumpy/interp_numarray.py b/pypy/module/micronumpy/interp_numarray.py
--- a/pypy/module/micronumpy/interp_numarray.py
+++ b/pypy/module/micronumpy/interp_numarray.py
@@ -827,6 +827,9 @@
return loop.multidim_dot(space, self, other, w_res, dtype,
other_critical_dim)
+ def descr_mean(self, space, __args__):
+ return get_appbridge_cache(space).call_method(space, '_mean', self, __args__)
+
def descr_var(self, space, __args__):
return get_appbridge_cache(space).call_method(space, '_var', self, __args__)
@@ -862,14 +865,6 @@
descr_cumsum = _reduce_ufunc_impl('add', cumultative=True)
descr_cumprod = _reduce_ufunc_impl('multiply', cumultative=True)
- def descr_mean(self, space, w_axis=None, w_out=None):
- if space.is_none(w_axis):
- w_denom = space.wrap(self.get_size())
- else:
- axis = unwrap_axis_arg(space, len(self.get_shape()), w_axis)
- w_denom = space.wrap(self.get_shape()[axis])
- return space.div(self.descr_sum_promote(space, w_axis, w_out), w_denom)
-
def _reduce_argmax_argmin_impl(op_name):
def impl(self, space):
if self.get_size() == 0:
More information about the pypy-commit
mailing list