[Numpy-svn] r3701 - in branches/multicore: . numpy/lib numpy/lib/tests

numpy-svn at scipy.org numpy-svn at scipy.org
Tue Apr 10 22:21:18 EDT 2007


Author: eric
Date: 2007-04-10 21:21:10 -0500 (Tue, 10 Apr 2007)
New Revision: 3701

Modified:
   branches/multicore/
   branches/multicore/numpy/lib/function_base.py
   branches/multicore/numpy/lib/tests/test_function_base.py
Log:
Merged revisions 3696-3700 via svnmerge from 
http://svn.scipy.org/svn/numpy/trunk

........
  r3699 | eric | 2007-04-10 21:05:06 -0500 (Tue, 10 Apr 2007) | 6 lines
  
  fixed a typecode Float->float issue in average.
  
  This is not pretty code it seems overly complicated, and it has an "eval"
  statement in it where it builds a string and evaluates it.  I can't imagine
  this is the best approach to this -- but I also am not going to spend the
  time to examine it right now.
........
  r3700 | eric | 2007-04-10 21:09:59 -0500 (Tue, 10 Apr 2007) | 1 line
  
  added simple test for weighted average
........



Property changes on: branches/multicore
___________________________________________________________________
Name: svnmerge-integrated
   - /branches/distutils-revamp:1-2752 /trunk:1-3695
   + /branches/distutils-revamp:1-2752 /trunk:1-3700

Modified: branches/multicore/numpy/lib/function_base.py
===================================================================
--- branches/multicore/numpy/lib/function_base.py	2007-04-11 02:09:59 UTC (rev 3700)
+++ branches/multicore/numpy/lib/function_base.py	2007-04-11 02:21:10 UTC (rev 3701)
@@ -306,7 +306,7 @@
                 ni = ash[axis]
                 r = [newaxis]*ni
                 r[axis] = slice(None, None, 1)
-                w1 = eval("w["+repr(tuple(r))+"]*ones(ash, Float)")
+                w1 = eval("w["+repr(tuple(r))+"]*ones(ash, float)")
                 n = add.reduce(a*w1, axis)
                 d = add.reduce(w1, axis)
             else:

Modified: branches/multicore/numpy/lib/tests/test_function_base.py
===================================================================
--- branches/multicore/numpy/lib/tests/test_function_base.py	2007-04-11 02:09:59 UTC (rev 3700)
+++ branches/multicore/numpy/lib/tests/test_function_base.py	2007-04-11 02:21:10 UTC (rev 3701)
@@ -57,6 +57,13 @@
         assert_array_equal(y5.mean(0), average(y5, 0))
         assert_array_equal(y5.mean(1), average(y5, 1))
 
+    def check_weighted(self):
+        y1 = array([[1,2,3],
+                    [4,5,6]])
+        actual = average(y1,weights=[1,2],axis=0)            
+        desired = array([3.,4.,5.])
+        assert_array_equal(actual, desired)
+
 class test_logspace(NumpyTestCase):
     def check_basic(self):
         y = logspace(0,6)




More information about the Numpy-svn mailing list