[Numpy-svn] r2959 - in trunk/numpy: core oldnumeric

numpy-svn at scipy.org numpy-svn at scipy.org
Fri Aug 4 21:00:46 CDT 2006


Author: oliphant
Date: 2006-08-04 21:00:43 -0500 (Fri, 04 Aug 2006)
New Revision: 2959

Modified:
   trunk/numpy/core/fromnumeric.py
   trunk/numpy/oldnumeric/functions.py
Log:
Final fixes to oldnumeric

Modified: trunk/numpy/core/fromnumeric.py
===================================================================
--- trunk/numpy/core/fromnumeric.py	2006-08-05 01:52:55 UTC (rev 2958)
+++ trunk/numpy/core/fromnumeric.py	2006-08-05 02:00:43 UTC (rev 2959)
@@ -239,11 +239,7 @@
         res = _wrapit(a, 'nonzero')
     else:
         res = nonzero()
-
-    if len(res) == 1:
-        return res[0]
-    else:
-        raise ValueError, "Input argument must be 1d"
+    return res
     
 
 def shape(a):

Modified: trunk/numpy/oldnumeric/functions.py
===================================================================
--- trunk/numpy/oldnumeric/functions.py	2006-08-05 01:52:55 UTC (rev 2958)
+++ trunk/numpy/oldnumeric/functions.py	2006-08-05 02:00:43 UTC (rev 2959)
@@ -34,7 +34,6 @@
 
 def cumproduct(x, axis=0):
     return N.cumproduct(x, axis)
-
     
 def ones(shape, typecode='l', savespace=0, dtype=None):
     """ones(shape, dtype=int) returns an array of the given
@@ -62,33 +61,41 @@
     dtype = convtypecode(typecode, dtype)    
     return mu.empty(shape, dtype, order)
 
+def array(sequence, typecode=None, copy=1, savespace=0, dtype=None):
+    dtype = convtypecode(typecode, dtype)
+    return mu.array(sequence, dtype, copy=copy)
 
-def array(sequence, typecode=None, copy=1, savespace=0):
-    pass
+def asarray(a, typecode=None, dtype=None):
+    dtype = convtypecode(typecode, dtype)
+    return mu.array(a, dtype, copy=0)
 
-def asarray(a, typecode=None):
-    pass
-
 def nonzero(a):
-    pass
+    res = N.nonzero(a)
+    if len(res) == 1:
+        return res[0]
+    else:
+        raise ValueError, "Input argument must be 1d"
 
 def reshape(a, shape):
-    pass
+    return N.reshape(a, shape)
 
-def arange(start, stop=None, step=1, typecode=None):
-    pass
+def arange(start, stop=None, step=1, typecode=None, dtype=None):
+    dtype = convtypecode(typecode, dtype)
+    return mu.arange(start, stop, step, dtype)
 
-def fromstring(string, typecode='l', count=-1):
-    pass
+def fromstring(string, typecode='l', count=-1, dtype=None):
+    dtype = convtypecode(typecode, dtype)
+    return mu.fromstring(string, dtype, count=count)
 
 def ravel(m):
-    pass
+    return N.ravel(m)
 
 def trace(a, offset=0, axis1=0, axis2=1):
-    pass
+    return N.trace(a, offset=0, axis1=0, axis2=1)
 
-def indices(dimensions, typecode=None):
-    pass
+def indices(dimensions, typecode=None, dtype=None):
+    dtype = convtypecode(typecode, dtype)
+    return N.indices(dimensions, dtype)
 
 def where(condition, x, y):
-    pass
+    return N.where(condition, x, y)



More information about the Numpy-svn mailing list