[Numpy-svn] r3468 - in trunk/numpy: core core/blasdot core/src fft numarray

numpy-svn at scipy.org numpy-svn at scipy.org
Fri Dec 1 23:07:47 CST 2006


Author: oliphant
Date: 2006-12-01 23:07:35 -0600 (Fri, 01 Dec 2006)
New Revision: 3468

Modified:
   trunk/numpy/core/blasdot/_dotblas.c
   trunk/numpy/core/numeric.py
   trunk/numpy/core/src/_sortmodule.c.src
   trunk/numpy/core/src/arrayobject.c
   trunk/numpy/core/src/multiarraymodule.c
   trunk/numpy/core/src/scalarmathmodule.c.src
   trunk/numpy/core/src/ufuncobject.c
   trunk/numpy/core/src/umathmodule.c.src
   trunk/numpy/fft/fftpack.c
   trunk/numpy/numarray/_capi.c
Log:
Fix warnings found by Intel compiler due to unused variables that were set.  Make ones work for compound types.

Modified: trunk/numpy/core/blasdot/_dotblas.c
===================================================================
--- trunk/numpy/core/blasdot/_dotblas.c	2006-12-02 04:34:25 UTC (rev 3467)
+++ trunk/numpy/core/blasdot/_dotblas.c	2006-12-02 05:07:35 UTC (rev 3468)
@@ -1071,10 +1071,10 @@
 /* Initialization function for the module */
 PyMODINIT_FUNC init_dotblas(void) {
     int i;
-    PyObject *m, *d, *s;
+    PyObject *d, *s;
     
     /* Create the module and add the functions */
-    m = Py_InitModule3("_dotblas", dotblas_module_methods, module_doc);
+    Py_InitModule3("_dotblas", dotblas_module_methods, module_doc);
 
     /* Import the array object */
     import_array();

Modified: trunk/numpy/core/numeric.py
===================================================================
--- trunk/numpy/core/numeric.py	2006-12-02 04:34:25 UTC (rev 3467)
+++ trunk/numpy/core/numeric.py	2006-12-02 05:07:35 UTC (rev 3468)
@@ -587,15 +587,29 @@
 # These are all essentially abbreviations
 # These might wind up in a special abbreviations module
 
+def _maketup(descr, val):
+    dt = dtype(descr)
+    # Place val in all scalar tuples:
+    fields = dt.fields
+    if fields is None:
+        return val
+    else:
+        res = [_maketup(fields[name][0],val) for name in dt.names]
+        return tuple(res)
+
 def ones(shape, dtype=None, order='C'):
     """Returns an array of the given dimensions which is initialized to all
     ones.
     """
     a = empty(shape, dtype, order)
-    a.fill(1)
-    # Above is faster now after addition of fast loops.
-    #a = zeros(shape, dtype, order)
-    #a+=1
+    try:
+        a.fill(1)
+        # Above is faster now after addition of fast loops.
+        #a = zeros(shape, dtype, order)
+        #a+=1
+    except TypeError:
+        obj = _maketup(dtype, 1)
+        a.fill(obj)
     return a
 
 def identity(n, dtype=None):

Modified: trunk/numpy/core/src/_sortmodule.c.src
===================================================================
--- trunk/numpy/core/src/_sortmodule.c.src	2006-12-02 04:34:25 UTC (rev 3467)
+++ trunk/numpy/core/src/_sortmodule.c.src	2006-12-02 05:07:35 UTC (rev 3468)
@@ -464,9 +464,8 @@
 
 PyMODINIT_FUNC
 init_sort(void) {
-	PyObject *m;
 
-	m = Py_InitModule("_sort", methods);
+	Py_InitModule("_sort", methods);
 
 	import_array();
 	add_sortfuncs();

Modified: trunk/numpy/core/src/arrayobject.c
===================================================================
--- trunk/numpy/core/src/arrayobject.c	2006-12-02 04:34:25 UTC (rev 3467)
+++ trunk/numpy/core/src/arrayobject.c	2006-12-02 05:07:35 UTC (rev 3468)
@@ -1065,8 +1065,6 @@
 static int
 PyArray_CopyAnyInto(PyArrayObject *dest, PyArrayObject *src)
 {
-
-        intp size;
         int elsize, simple;
         PyArrayIterObject *idest, *isrc;
         void (*myfunc)(char *, intp, char *, intp, intp, int);
@@ -1082,7 +1080,7 @@
                 return -1;
         }
 
-        if ((size=PyArray_SIZE(dest)) != PyArray_SIZE(src)) {
+        if (PyArray_SIZE(dest) != PyArray_SIZE(src)) {
                 PyErr_SetString(PyExc_ValueError,
                                 "arrays must have the same number of elements"
                                 " for copy");
@@ -2081,7 +2079,7 @@
                  intp *start, intp *stop, intp *step,
                  intp *slicelength)
 {
-        intp defstart, defstop;
+        intp defstop;
 
         if (r->step == Py_None) {
                 *step = 1;
@@ -2093,8 +2091,8 @@
                         return -1;
                 }
         }
+        /* defstart = *step < 0 ? length - 1 : 0; */
 
-        defstart = *step < 0 ? length - 1 : 0;
         defstop = *step < 0 ? -1 : length;
 
         if (r->start == Py_None) {
@@ -5737,7 +5735,6 @@
                                  "offset", "strides",
                                  "order", NULL};
         PyArray_Descr *descr=NULL;
-        int type_num;
         int itemsize;
         PyArray_Dims dims = {NULL, 0};
         PyArray_Dims strides = {NULL, 0};
@@ -5775,7 +5772,6 @@
         if (descr == NULL)
                 descr = PyArray_DescrFromType(PyArray_DEFAULT);
 
-        type_num = descr->type_num;
         itemsize = descr->elsize;
 
         if (itemsize == 0) {
@@ -7815,7 +7811,7 @@
 {
 
         PyArrayObject *ret=NULL;
-        int type, itemsize;
+        int itemsize;
         int copy = 0;
         int arrflags;
         PyArray_Descr *oldtype;
@@ -7827,7 +7823,6 @@
         subtype = arr->ob_type;
 
         if (newtype == NULL) {newtype = oldtype; Py_INCREF(oldtype);}
-        type = newtype->type_num;
         itemsize = newtype->elsize;
         if (itemsize == 0) {
                 PyArray_DESCR_REPLACE(newtype);
@@ -9235,7 +9230,7 @@
 iter_ass_sub_Bool(PyArrayIterObject *self, PyArrayObject *ind,
                   PyArrayIterObject *val, int swap)
 {
-        int index, strides, itemsize;
+        int index, strides;
         char *dptr;
         PyArray_CopySwapFunc *copyswap;
 
@@ -9244,7 +9239,6 @@
                                 "boolean index array should have 1 dimension");
                 return -1;
         }
-        itemsize = self->ao->descr->elsize;
         index = ind->dimensions[0];
         strides = ind->strides[0];
         dptr = ind->data;
@@ -9272,12 +9266,10 @@
         PyArray_Descr *typecode;
         intp num;
         PyArrayIterObject *ind_it;
-        int itemsize;
         int index;
         PyArray_CopySwapFunc *copyswap;
 
         typecode = self->ao->descr;
-        itemsize = typecode->elsize;
         copyswap = self->ao->descr->f->copyswap;
         if (ind->nd == 0) {
                 num = *((intp *)ind->data);

Modified: trunk/numpy/core/src/multiarraymodule.c
===================================================================
--- trunk/numpy/core/src/multiarraymodule.c	2006-12-02 04:34:25 UTC (rev 3467)
+++ trunk/numpy/core/src/multiarraymodule.c	2006-12-02 05:07:35 UTC (rev 3468)
@@ -3710,7 +3710,7 @@
               NPY_CLIPMODE clipmode)
 {
         PyArrayObject  *indices, *values;
-        int i, chunk, ni, max_item, nv, tmp, thistype;
+        int i, chunk, ni, max_item, nv, tmp;
         char *src, *dest;
         int copied = 0;
 
@@ -3743,7 +3743,6 @@
         if (indices == NULL) goto fail;
         ni = PyArray_SIZE(indices);
 
-	thistype = self->descr->type_num;
         Py_INCREF(self->descr);
 	values = (PyArrayObject *)PyArray_FromAny(values0, self->descr, 0, 0,
 						  DEFAULT | FORCECAST, NULL);
@@ -3876,7 +3875,7 @@
 PyArray_PutMask(PyArrayObject *self, PyObject* values0, PyObject* mask0)
 {
         PyArrayObject  *mask, *values;
-        int i, chunk, ni, max_item, nv, tmp, thistype;
+        int i, chunk, ni, max_item, nv, tmp;
         char *src, *dest;
         int copied=0;
 
@@ -3914,9 +3913,8 @@
                 goto fail;
         }
 
-	thistype = self->descr->type_num;
         values = (PyArrayObject *)\
-		PyArray_ContiguousFromAny(values0, thistype, 0, 0);
+		PyArray_ContiguousFromAny(values0, self->descr->type_num, 0, 0);
 	if (values == NULL) goto fail;
         nv = PyArray_SIZE(values);	 /* zero if null array */
         if (nv <= 0) {

Modified: trunk/numpy/core/src/scalarmathmodule.c.src
===================================================================
--- trunk/numpy/core/src/scalarmathmodule.c.src	2006-12-02 04:34:25 UTC (rev 3467)
+++ trunk/numpy/core/src/scalarmathmodule.c.src	2006-12-02 05:07:35 UTC (rev 3468)
@@ -1192,9 +1192,8 @@
 };
 
 PyMODINIT_FUNC initscalarmath(void) {
-    PyObject *m;
 
-    m = Py_InitModule("scalarmath", methods);
+    Py_InitModule("scalarmath", methods);
 
     import_array();
     import_umath();

Modified: trunk/numpy/core/src/ufuncobject.c
===================================================================
--- trunk/numpy/core/src/ufuncobject.c	2006-12-02 04:34:25 UTC (rev 3467)
+++ trunk/numpy/core/src/ufuncobject.c	2006-12-02 05:07:35 UTC (rev 3468)
@@ -1115,7 +1115,7 @@
 construct_arrays(PyUFuncLoopObject *loop, PyObject *args, PyArrayObject **mps,
                  PyObject *typetup)
 {
-        int nargs, i, maxsize;
+        int nargs, i;
         int arg_types[NPY_MAXARGS];
 	PyArray_SCALARKIND scalars[NPY_MAXARGS];
 	PyUFuncObject *self=loop->ufunc;
@@ -1326,7 +1326,6 @@
 	if (loop->size == 0) return nargs;
 
 
-	maxsize = 0;
         for (i=0; i<self->nargs; i++) {
 		loop->needbuffer[i] = 0;
                 if (arg_types[i] != mps[i]->descr->type_num ||

Modified: trunk/numpy/core/src/umathmodule.c.src
===================================================================
--- trunk/numpy/core/src/umathmodule.c.src	2006-12-02 04:34:25 UTC (rev 3467)
+++ trunk/numpy/core/src/umathmodule.c.src	2006-12-02 05:07:35 UTC (rev 3468)
@@ -1279,15 +1279,10 @@
 {
         intp i, is1 = steps[0], os = steps[1], n = dimensions[0];
         char *i1 = args[0], *op = args[1];
-        c at typ@ *x, *y;
-        @typ@ xr, xi, xmag2;
+        c at typ@ *y;
 
         for (i = 0; i < n; i++, i1 += is1, op += os) {
-                x = (c at typ@ *)i1;
                 y = (c at typ@ *)op;
-                xr = x->real;
-                xi = x->imag;
-                xmag2 = xr*xr + xi*xi;
                 y->real = 1.0;
                 y->imag = 0.0;
         }

Modified: trunk/numpy/fft/fftpack.c
===================================================================
--- trunk/numpy/fft/fftpack.c	2006-12-02 04:34:25 UTC (rev 3467)
+++ trunk/numpy/fft/fftpack.c	2006-12-02 05:07:35 UTC (rev 3468)
@@ -270,11 +270,11 @@
       const Treal wa[], int isign)
   /* isign is -1 for forward transform and +1 for backward transform */
   {
-    int idij, idlj, idot, ipph, i, j, k, l, jc, lc, ik, nt, idj, idl, inc,idp;
+    int idij, idlj, idot, ipph, i, j, k, l, jc, lc, ik, idj, idl, inc,idp;
     Treal wai, war;
 
     idot = ido / 2;
-    nt = ip*idl1;
+    /* nt = ip*idl1;*/
     ipph = (ip + 1) / 2;
     idp = ip*ido;
     if (ido >= l1) {

Modified: trunk/numpy/numarray/_capi.c
===================================================================
--- trunk/numpy/numarray/_capi.c	2006-12-02 04:34:25 UTC (rev 3467)
+++ trunk/numpy/numarray/_capi.c	2006-12-02 05:07:35 UTC (rev 3468)
@@ -123,12 +123,11 @@
 static int 
 getBufferSize(PyObject *buffobj) 
 {
-  Py_ssize_t segcount, size=0;
+  Py_ssize_t size=0;
   PyObject *buff2;
   if ((buff2 = getBuffer(buffobj))) 
     {
-      segcount = buff2->ob_type->tp_as_buffer->bf_getsegcount(buff2, 
-								&size);
+      (void) buff2->ob_type->tp_as_buffer->bf_getsegcount(buff2, &size);
       Py_DECREF(buff2);
     }
   else
@@ -621,12 +620,11 @@
     PyObject *inbuffObj, *outbuffObj, *shapeObj;
     PyObject *inbstridesObj, *outbstridesObj;
     CfuncObject *me = (CfuncObject *) self;
-    int  nshape, ninbstrides, noutbstrides, nargs;
+    int  nshape, ninbstrides, noutbstrides;
     maybelong shape[MAXDIM], inbstrides[MAXDIM], 
 	    outbstrides[MAXDIM], *outbstrides1 = outbstrides;
     long inboffset, outboffset, nbytes=0;
 
-    nargs = PyObject_Length(args);
     if (!PyArg_ParseTuple(args, "OOlOOlO|l",
             &shapeObj, &inbuffObj,  &inboffset, &inbstridesObj,
             &outbuffObj, &outboffset, &outbstridesObj,



More information about the Numpy-svn mailing list