[Numpy-svn] r2727 - in trunk/numpy/core: . src

numpy-svn at scipy.org numpy-svn at scipy.org
Mon Jul 3 05:41:52 EDT 2006


Author: oliphant
Date: 2006-07-03 04:41:49 -0500 (Mon, 03 Jul 2006)
New Revision: 2727

Modified:
   trunk/numpy/core/_internal.py
   trunk/numpy/core/src/arrayobject.c
   trunk/numpy/core/src/multiarraymodule.c
Log:
Convert docstrings to reflect change to floating-point defaults.

Modified: trunk/numpy/core/_internal.py
===================================================================
--- trunk/numpy/core/_internal.py	2006-07-02 21:44:24 UTC (rev 2726)
+++ trunk/numpy/core/_internal.py	2006-07-03 09:41:49 UTC (rev 2727)
@@ -195,9 +195,18 @@
         except ImportError:
             raise AttributeError, "ctypes not available"
         self._arr = array
-        
+    
+    def data_as(self, obj):
+        return self._ctypes.cast(self._arr._as_parameter_, obj)
+
+    def shape_as(self, obj):
+        return (obj*self._arr.ndim)(*self._arr.shape)
+
+    def strides_as(self, obj):
+        return (obj*self._arr.ndim)(*self._arr.strides)
+    
     def get_data(self):
-        return self._ctypes.c_void_p(self._arr.__array_interface__['data'][0])
+        return self._ctypes.c_void_p(self._arr._as_parameter_)
 
     def get_shape(self):
         return (_getintp_ctype()*self._arr.ndim)(*self._arr.shape)

Modified: trunk/numpy/core/src/arrayobject.c
===================================================================
--- trunk/numpy/core/src/arrayobject.c	2006-07-02 21:44:24 UTC (rev 2726)
+++ trunk/numpy/core/src/arrayobject.c	2006-07-03 09:41:49 UTC (rev 2727)
@@ -6170,7 +6170,7 @@
 	"  command. Arrays are sequence, mapping and numeric objects.\n"
 	"  More information is available in the numpy module and by looking\n"
 	"  at the methods and attributes of an array.\n\n"
-	"  ndarray.__new__(subtype, shape=, dtype=int, buffer=None, \n"
+	"  ndarray.__new__(subtype, shape=, dtype=float, buffer=None, \n"
 	"                  offset=0, strides=None, order=None)\n\n"
 	"   There are two modes of creating an array using __new__:\n"
 	"   1) If buffer is None, then only shape, dtype, and order \n"

Modified: trunk/numpy/core/src/multiarraymodule.c
===================================================================
--- trunk/numpy/core/src/multiarraymodule.c	2006-07-02 21:44:24 UTC (rev 2726)
+++ trunk/numpy/core/src/multiarraymodule.c	2006-07-03 09:41:49 UTC (rev 2727)
@@ -4684,7 +4684,7 @@
 }
 
 
-static char doc_empty[] = "empty((d1,...,dn),dtype=int,order='C') will return a new array\n of shape (d1,...,dn) and given type with all its entries uninitialized. This can be faster than zeros.";
+static char doc_empty[] = "empty((d1,...,dn),dtype=float,order='C') will return a new array\n of shape (d1,...,dn) and given type with all its entries uninitialized. This can be faster than zeros.";
 
 static PyObject *
 array_empty(PyObject *ignored, PyObject *args, PyObject *kwds) 
@@ -4814,7 +4814,7 @@
 
 }
 
-static char doc_zeros[] = "zeros((d1,...,dn),dtype=int,order='C') will return a new array of shape (d1,...,dn) and type typecode with all it's entries initialized to zero.";
+static char doc_zeros[] = "zeros((d1,...,dn),dtype=float,order='C') will return a new array of shape (d1,...,dn) and type typecode with all it's entries initialized to zero.";
 
 
 static PyObject *
@@ -5024,7 +5024,7 @@
 	return (PyObject *)ret;
 }
 
-static char doc_fromString[] = "fromstring(string, dtype=int, count=-1, sep='') returns a new 1d array initialized from the raw binary data in string.  If count is positive, the new array will have count elements, otherwise it's size is determined by the size of string.  If sep is not empty then the string is interpreted in ASCII mode and converted to the desired number type using sep as the separator between elements (extra whitespace is ignored).";
+static char doc_fromString[] = "fromstring(string, dtype=float, count=-1, sep='') returns a new 1d array initialized from the raw binary data in string.  If count is positive, the new array will have count elements, otherwise it's size is determined by the size of string.  If sep is not empty then the string is interpreted in ASCII mode and converted to the desired number type using sep as the separator between elements (extra whitespace is ignored).";
 
 static PyObject *
 array_fromString(PyObject *ignored, PyObject *args, PyObject *keywds)
@@ -5294,7 +5294,7 @@
 }
 
 static char doc_fromfile[] = \
-	"fromfile(file=, dtype=int, count=-1, sep='')\n"	\
+	"fromfile(file=, dtype=float, count=-1, sep='')\n"	\
 	"\n"\
 	"  Return an array of the given data type from a \n"\
 	"  (text or binary) file.   The file argument can be an open file\n"\
@@ -5447,7 +5447,7 @@
 }
 
 static char doc_frombuffer[] = \
-	"frombuffer(buffer=, dtype=int, count=-1, offset=0)\n"\
+	"frombuffer(buffer=, dtype=float, count=-1, offset=0)\n"\
 	"\n"								\
 	"  Returns a 1-d array of data type dtype from buffer. The buffer\n"\
 	"   argument must be an object that exposes the buffer interface.\n"\




More information about the Numpy-svn mailing list