[Numpy-svn] r3705 - in branches/multicore: . numpy/core/blasdot numpy/doc/swig

numpy-svn@scip... numpy-svn@scip...
Wed Apr 11 15:38:47 CDT 2007


Author: eric
Date: 2007-04-11 15:38:46 -0500 (Wed, 11 Apr 2007)
New Revision: 3705

Modified:
   branches/multicore/
   branches/multicore/numpy/core/blasdot/_dotblas.c
   branches/multicore/numpy/core/blasdot/cblas.h
   branches/multicore/numpy/doc/swig/numpy.i
Log:
Merged revisions 3701-3704 via svnmerge from 
http://svn.scipy.org/svn/numpy/trunk

........
  r3702 | eric | 2007-04-11 02:32:05 -0500 (Wed, 11 Apr 2007) | 1 line
  
  long lost author was... eric.
........
  r3703 | wfspotz@sandia.gov | 2007-04-11 11:50:38 -0500 (Wed, 11 Apr 2007) | 1 line
  
  Provided more sophisticated typecheck typemap for IN_ARRAYs
........
  r3704 | charris | 2007-04-11 12:41:19 -0500 (Wed, 11 Apr 2007) | 1 line
  
  Cleanup whitespace.
........



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

Modified: branches/multicore/numpy/core/blasdot/_dotblas.c
===================================================================
--- branches/multicore/numpy/core/blasdot/_dotblas.c	2007-04-11 17:41:19 UTC (rev 3704)
+++ branches/multicore/numpy/core/blasdot/_dotblas.c	2007-04-11 20:38:46 UTC (rev 3705)
@@ -12,62 +12,62 @@
 
 static PyArray_DotFunc *oldFunctions[PyArray_NTYPES];
 
-static void 
-FLOAT_dot(void *a, intp stridea, void *b, intp strideb, void *res, 
+static void
+FLOAT_dot(void *a, intp stridea, void *b, intp strideb, void *res,
 	  intp n, void *tmp)
 {
     register int na = stridea / sizeof(float);
     register int nb = strideb / sizeof(float);
 
-    if ((sizeof(float) * na == stridea) && 
+    if ((sizeof(float) * na == stridea) &&
 	(sizeof(float) * nb == strideb))
 	    *((float *)res) = cblas_sdot((int)n, (float *)a, na, (float *)b, nb);
-    
-    else 
+
+    else
 	    oldFunctions[PyArray_FLOAT](a, stridea, b, strideb, res, n, tmp);
 }
 
-static void 
-DOUBLE_dot(void *a, intp stridea, void *b, intp strideb, void *res, 
+static void
+DOUBLE_dot(void *a, intp stridea, void *b, intp strideb, void *res,
 	   intp n, void *tmp)
 {
     register int na = stridea / sizeof(double);
     register int nb = strideb / sizeof(double);
 
-    if ((sizeof(double) * na == stridea) && 
-	(sizeof(double) * nb == strideb))    
+    if ((sizeof(double) * na == stridea) &&
+	(sizeof(double) * nb == strideb))
 	    *((double *)res) = cblas_ddot((int)n, (double *)a, na, (double *)b, nb);
     else
 	    oldFunctions[PyArray_DOUBLE](a, stridea, b, strideb, res, n, tmp);
 }
 
-static void 
-CFLOAT_dot(void *a, intp stridea, void *b, intp strideb, void *res, 
+static void
+CFLOAT_dot(void *a, intp stridea, void *b, intp strideb, void *res,
 	   intp n, void *tmp)
 {
-    
+
     register int na = stridea / sizeof(cfloat);
     register int nb = strideb / sizeof(cfloat);
 
-    if ((sizeof(cfloat) * na == stridea) && 
-	(sizeof(cfloat) * nb == strideb))    
+    if ((sizeof(cfloat) * na == stridea) &&
+	(sizeof(cfloat) * nb == strideb))
 	    cblas_cdotu_sub((int)n, (float *)a, na, (float *)b, nb, (float *)res);
     else
 	    oldFunctions[PyArray_CFLOAT](a, stridea, b, strideb, res, n, tmp);
 }
 
-static void 
-CDOUBLE_dot(void *a, intp stridea, void *b, intp strideb, void *res, 
+static void
+CDOUBLE_dot(void *a, intp stridea, void *b, intp strideb, void *res,
 	    intp n, void *tmp)
 {
     register int na = stridea / sizeof(cdouble);
     register int nb = strideb / sizeof(cdouble);
 
-    if ((sizeof(cdouble) * na == stridea) && 
-	(sizeof(cdouble) * nb == strideb))    
+    if ((sizeof(cdouble) * na == stridea) &&
+	(sizeof(cdouble) * nb == strideb))
 	    cblas_zdotu_sub((int)n, (double *)a, na, (double *)b, nb, (double *)res);
     else
-	    oldFunctions[PyArray_CDOUBLE](a, stridea, b, strideb, res, n, tmp);    
+	    oldFunctions[PyArray_CDOUBLE](a, stridea, b, strideb, res, n, tmp);
 }
 
 
@@ -76,10 +76,10 @@
 static char doc_alterdot[] = "alterdot() changes all dot functions to use blas.";
 
 static PyObject *
-dotblas_alterdot(PyObject *dummy, PyObject *args) 
+dotblas_alterdot(PyObject *dummy, PyObject *args)
 {
     PyArray_Descr *descr;
-    
+
     if (!PyArg_ParseTuple(args, "")) return NULL;
 
     /* Replace the dot functions to the ones using blas */
@@ -88,15 +88,15 @@
 	descr = PyArray_DescrFromType(PyArray_FLOAT);
 	oldFunctions[PyArray_FLOAT] = descr->f->dotfunc;
 	descr->f->dotfunc = (PyArray_DotFunc *)FLOAT_dot;
-	
+
 	descr = PyArray_DescrFromType(PyArray_DOUBLE);
 	oldFunctions[PyArray_DOUBLE] = descr->f->dotfunc;
 	descr->f->dotfunc = (PyArray_DotFunc *)DOUBLE_dot;
-	
+
 	descr = PyArray_DescrFromType(PyArray_CFLOAT);
 	oldFunctions[PyArray_CFLOAT] = descr->f->dotfunc;
 	descr->f->dotfunc = (PyArray_DotFunc *)CFLOAT_dot;
-	
+
 	descr = PyArray_DescrFromType(PyArray_CDOUBLE);
 	oldFunctions[PyArray_CDOUBLE] = descr->f->dotfunc;
 	descr->f->dotfunc = (PyArray_DotFunc *)CDOUBLE_dot;
@@ -111,7 +111,7 @@
 static char doc_restoredot[] = "restoredot() restores dots to defaults.";
 
 static PyObject *
-dotblas_restoredot(PyObject *dummy, PyObject *args) 
+dotblas_restoredot(PyObject *dummy, PyObject *args)
 {
     PyArray_Descr *descr;
 
@@ -137,7 +137,7 @@
 	descr->f->dotfunc = oldFunctions[PyArray_CDOUBLE];
 	oldFunctions[PyArray_CDOUBLE] = NULL;
 	Py_XDECREF(descr);
-	
+
 	altered = FALSE;
     }
 
@@ -147,7 +147,7 @@
 
 typedef enum {_scalar, _column, _row, _matrix} MatrixShape;
 
-static MatrixShape 
+static MatrixShape
 _select_matrix_shape(PyArrayObject *array)
 {
     switch (array->nd) {
@@ -175,7 +175,7 @@
 static char doc_matrixproduct[] = "dot(a,b)\nReturns the dot product of a and b for arrays of floating point types.\nLike the generic numpy equivalent the product sum is over\nthe last dimension of a and the second-to-last dimension of b.\nNB: The first argument is not conjugated.";
 
 static PyObject *
-dotblas_matrixproduct(PyObject *dummy, PyObject *args) 
+dotblas_matrixproduct(PyObject *dummy, PyObject *args)
 {
     PyObject *op1, *op2;
     PyArrayObject *ap1=NULL, *ap2=NULL, *ret=NULL;
@@ -192,23 +192,23 @@
     PyTypeObject *subtype;
     PyArray_Descr *dtype;
     MatrixShape ap1shape, ap2shape;
-    
+
     if (!PyArg_ParseTuple(args, "OO", &op1, &op2)) return NULL;
-	
-    /* 
-     * "Matrix product" using the BLAS.  
+
+    /*
+     * "Matrix product" using the BLAS.
      * Only works for float double and complex types.
      */
 
-    typenum = PyArray_ObjectType(op1, 0);  
+    typenum = PyArray_ObjectType(op1, 0);
     typenum = PyArray_ObjectType(op2, typenum);
-    
+
     /* This function doesn't handle other types */
     if ((typenum != PyArray_DOUBLE && typenum != PyArray_CDOUBLE &&
 	 typenum != PyArray_FLOAT && typenum != PyArray_CFLOAT)) {
 	return PyArray_Return((PyArrayObject *)PyArray_MatrixProduct(op1, op2));
     }
-    
+
     dtype = PyArray_DescrFromType(typenum);
     ap1 = (PyArrayObject *)PyArray_FromAny(op1, dtype, 0, 0, ALIGNED, NULL);
     if (ap1 == NULL) return NULL;
@@ -216,7 +216,7 @@
     ap2 = (PyArrayObject *)PyArray_FromAny(op2, dtype, 0, 0, ALIGNED, NULL);
     if (ap2 == NULL) goto fail;
 
-    if ((ap1->nd > 2) || (ap2->nd > 2)) {  
+    if ((ap1->nd > 2) || (ap2->nd > 2)) {
 	/* This function doesn't handle dimensions greater than 2 -- other
 	   than to ensure the dot function is altered
 	*/
@@ -225,16 +225,16 @@
 	    PyObject *tmp1, *tmp2;
 	    tmp1 = PyTuple_New(0);
 	    tmp2 = dotblas_alterdot(NULL, tmp1);
-	    Py_DECREF(tmp1); 
+	    Py_DECREF(tmp1);
 	    Py_DECREF(tmp2);
 	}
-	ret = (PyArrayObject *)PyArray_MatrixProduct((PyObject *)ap1, 
+	ret = (PyArrayObject *)PyArray_MatrixProduct((PyObject *)ap1,
 						     (PyObject *)ap2);
-	Py_DECREF(ap1); 
+	Py_DECREF(ap1);
 	Py_DECREF(ap2);
 	return PyArray_Return(ret);
     }
-    
+
     if (!PyArray_ElementStrides((PyObject *)ap1)) {
 	    op1 = PyArray_NewCopy(ap1, PyArray_ANYORDER);
 	    Py_DECREF(ap1);
@@ -249,7 +249,7 @@
     }
     ap1shape = _select_matrix_shape(ap1);
     ap2shape = _select_matrix_shape(ap2);
-    
+
     if (ap1shape == _scalar || ap2shape == _scalar) {
         PyArrayObject *oap1, *oap2;
         oap1 = ap1; oap2 = ap2;
@@ -267,11 +267,11 @@
 
  	if (ap1->nd == 0 || ap2->nd == 0) {
             intp *thisdims;
-            if (ap1->nd == 0) { 
+            if (ap1->nd == 0) {
                 nd = ap2->nd;
                 thisdims = ap2->dimensions;
             }
-            else { 
+            else {
                 nd = ap1->nd;
                 thisdims = ap1->dimensions;
             }
@@ -281,7 +281,7 @@
                 l *= dimensions[j];
             }
         }
-        else { 
+        else {
             l = oap1->dimensions[oap1->nd-1];
 
             if (oap2->dimensions[0] != l) {
@@ -292,7 +292,7 @@
             /* nd = 0 or 1 or 2 */
             /* If nd == 0 do nothing ... */
             if (nd == 1) {
-                /* Either ap1->nd is 1 dim or ap2->nd is 1 dim 
+                /* Either ap1->nd is 1 dim or ap2->nd is 1 dim
                    and the other is 2-dim */
                 dimensions[0] = (oap1->nd == 2) ? oap1->dimensions[0] : oap2->dimensions[1];
                 l = dimensions[0];
@@ -316,21 +316,21 @@
     else { /* (ap1->nd <= 2 && ap2->nd <= 2) */
 	/*  Both ap1 and ap2 are vectors or matrices */
 	l = ap1->dimensions[ap1->nd-1];
-	
+
 	if (ap2->dimensions[0] != l) {
 	    PyErr_SetString(PyExc_ValueError, "matrices are not aligned");
 	    goto fail;
 	}
 	nd = ap1->nd+ap2->nd-2;
-	
-	if (nd == 1) 
+
+	if (nd == 1)
 	    dimensions[0] = (ap1->nd == 2) ? ap1->dimensions[0] : ap2->dimensions[1];
 	else if (nd == 2) {
 	    dimensions[0] = ap1->dimensions[0];
 	    dimensions[1] = ap2->dimensions[1];
 	}
     }
-    
+
     /* Choose which subtype to return */
     if (ap1->ob_type != ap2->ob_type) {
 	prior2 = PyArray_GetPriority((PyObject *)ap2, 0.0);
@@ -341,12 +341,12 @@
 	prior1 = prior2 = 0.0;
 	subtype = ap1->ob_type;
     }
-    
+
     ret = (PyArrayObject *)PyArray_New(subtype, nd, dimensions,
 				       typenum, NULL, NULL, 0, 0,
 				       (PyObject *)
 				       (prior2 > prior1 ? ap2 : ap1));
-    
+
     if (ret == NULL) goto fail;
     numbytes = PyArray_NBYTES(ret);
     memset(ret->data, 0, numbytes);
@@ -386,19 +386,19 @@
 		a1s = ap1->strides[maxind] / sizeof(double);
 		rets = ret->strides[maxind] / sizeof(double);
 		for (i=0; i < ap1->dimensions[oind]; i++) {
-		    cblas_daxpy(l, val, (double *)ptr, a1s, 
+		    cblas_daxpy(l, val, (double *)ptr, a1s,
 				(double *)rptr, rets);
 		    ptr += ap1->strides[oind];
 		    rptr += ret->strides[oind];
 		}
 	    }
-	} 
+	}
 	else if (typenum == PyArray_CDOUBLE) {
 	    if (l == 1) {
 		cdouble *ptr1, *ptr2, *res;
 		ptr1 = (cdouble *)ap2->data;
 		ptr2 = (cdouble *)ap1->data;
-		res = (cdouble *)ret->data;		
+		res = (cdouble *)ret->data;
 		res->real = ptr1->real * ptr2->real - ptr1->imag * ptr2->imag;
 		res->imag = ptr1->real * ptr2->imag + ptr1->imag * ptr2->real;
 	    }
@@ -419,7 +419,7 @@
 		a1s = ap1->strides[maxind] / sizeof(cdouble);
 		rets = ret->strides[maxind] / sizeof(cdouble);
 		for (i=0; i < ap1->dimensions[oind]; i++) {
-		    cblas_zaxpy(l, pval, (double *)ptr, a1s, 
+		    cblas_zaxpy(l, pval, (double *)ptr, a1s,
 				(double *)rptr, rets);
 		    ptr += ap1->strides[oind];
 		    rptr += ret->strides[oind];
@@ -448,7 +448,7 @@
 		a1s = ap1->strides[maxind] / sizeof(float);
 		rets = ret->strides[maxind] / sizeof(float);
 		for (i=0; i < ap1->dimensions[oind]; i++) {
-		    cblas_saxpy(l, val, (float *)ptr, a1s, 
+		    cblas_saxpy(l, val, (float *)ptr, a1s,
 				(float *)rptr, rets);
 		    ptr += ap1->strides[oind];
 		    rptr += ret->strides[oind];
@@ -460,7 +460,7 @@
 		cfloat *ptr1, *ptr2, *res;
 		ptr1 = (cfloat *)ap2->data;
 		ptr2 = (cfloat *)ap1->data;
-		res = (cfloat *)ret->data;		
+		res = (cfloat *)ret->data;
 		res->real = ptr1->real * ptr2->real - ptr1->imag * ptr2->imag;
 		res->imag = ptr1->real * ptr2->imag + ptr1->imag * ptr2->real;
 	    }
@@ -481,7 +481,7 @@
 		a1s = ap1->strides[maxind] / sizeof(cfloat);
 		rets = ret->strides[maxind] / sizeof(cfloat);
 		for (i=0; i < ap1->dimensions[oind]; i++) {
-		    cblas_caxpy(l, pval, (float *)ptr, a1s, 
+		    cblas_caxpy(l, pval, (float *)ptr, a1s,
 				(float *)rptr, rets);
 		    ptr += ap1->strides[oind];
 		    rptr += ret->strides[oind];
@@ -501,24 +501,24 @@
 	else {
 	    ap1s = ap1->strides[0] / ap1->descr->elsize;
 	}
-	    
+
 	/* Dot product between two vectors -- Level 1 BLAS */
 	if (typenum == PyArray_DOUBLE) {
-	    double result = cblas_ddot(l, (double *)ap1->data, ap1s, 
+	    double result = cblas_ddot(l, (double *)ap1->data, ap1s,
 				       (double *)ap2->data, ap2s);
 	    *((double *)ret->data) = result;
 	}
 	else if (typenum == PyArray_FLOAT) {
-	    float result = cblas_sdot(l, (float *)ap1->data, ap1s, 
+	    float result = cblas_sdot(l, (float *)ap1->data, ap1s,
 				      (float *)ap2->data, ap2s);
 	    *((float *)ret->data) = result;
 	}
 	else if (typenum == PyArray_CDOUBLE) {
-	    cblas_zdotu_sub(l, (double *)ap1->data, ap1s, 
+	    cblas_zdotu_sub(l, (double *)ap1->data, ap1s,
 			    (double *)ap2->data, ap2s, (double *)ret->data);
 	}
 	else if (typenum == PyArray_CFLOAT) {
-	    cblas_cdotu_sub(l, (float *)ap1->data, ap1s, 
+	    cblas_cdotu_sub(l, (float *)ap1->data, ap1s,
 			    (float *)ap2->data, ap2s, (float *)ret->data);
 	}
 	NPY_END_ALLOW_THREADS
@@ -547,29 +547,29 @@
 	}
 	ap2s = ap2->strides[0] / ap2->descr->elsize;
 	if (typenum == PyArray_DOUBLE) {
-	    cblas_dgemv(Order, CblasNoTrans,  
-			ap1->dimensions[0], ap1->dimensions[1], 
-			1.0, (double *)ap1->data, lda, 
+	    cblas_dgemv(Order, CblasNoTrans,
+			ap1->dimensions[0], ap1->dimensions[1],
+			1.0, (double *)ap1->data, lda,
 			(double *)ap2->data, ap2s, 0.0, (double *)ret->data, 1);
 	}
 	else if (typenum == PyArray_FLOAT) {
-	    cblas_sgemv(Order, CblasNoTrans,  
-			ap1->dimensions[0], ap1->dimensions[1], 
-			1.0, (float *)ap1->data, lda, 
+	    cblas_sgemv(Order, CblasNoTrans,
+			ap1->dimensions[0], ap1->dimensions[1],
+			1.0, (float *)ap1->data, lda,
 			(float *)ap2->data, ap2s, 0.0, (float *)ret->data, 1);
 	}
 	else if (typenum == PyArray_CDOUBLE) {
-	    cblas_zgemv(Order, 
-			CblasNoTrans,  ap1->dimensions[0], ap1->dimensions[1], 
-			oneD, (double *)ap1->data, lda, 
-			(double *)ap2->data, ap2s, zeroD, 
+	    cblas_zgemv(Order,
+			CblasNoTrans,  ap1->dimensions[0], ap1->dimensions[1],
+			oneD, (double *)ap1->data, lda,
+			(double *)ap2->data, ap2s, zeroD,
 			(double *)ret->data, 1);
 	}
 	else if (typenum == PyArray_CFLOAT) {
-	    cblas_cgemv(Order, 
-			CblasNoTrans,  ap1->dimensions[0], ap1->dimensions[1], 
-			oneF, (float *)ap1->data, lda, 
-			(float *)ap2->data, ap2s, zeroF, 
+	    cblas_cgemv(Order,
+			CblasNoTrans,  ap1->dimensions[0], ap1->dimensions[1],
+			oneF, (float *)ap1->data, lda,
+			(float *)ap2->data, ap2s, zeroF,
 			(float *)ret->data, 1);
 	}
 	NPY_END_ALLOW_THREADS
@@ -602,33 +602,33 @@
 	    ap1s = ap1->strides[0] / ap1->descr->elsize;
 	}
 	if (typenum == PyArray_DOUBLE) {
-	    cblas_dgemv(Order, 
-			CblasTrans,  ap2->dimensions[0], ap2->dimensions[1], 
+	    cblas_dgemv(Order,
+			CblasTrans,  ap2->dimensions[0], ap2->dimensions[1],
 			1.0, (double *)ap2->data, lda,
 			(double *)ap1->data, ap1s, 0.0, (double *)ret->data, 1);
 	}
 	else if (typenum == PyArray_FLOAT) {
 	    cblas_sgemv(Order,
-			CblasTrans,  ap2->dimensions[0], ap2->dimensions[1], 
+			CblasTrans,  ap2->dimensions[0], ap2->dimensions[1],
 			1.0, (float *)ap2->data, lda,
 			(float *)ap1->data, ap1s, 0.0, (float *)ret->data, 1);
 	}
 	else if (typenum == PyArray_CDOUBLE) {
 	    cblas_zgemv(Order,
-			CblasTrans,  ap2->dimensions[0], ap2->dimensions[1], 
+			CblasTrans,  ap2->dimensions[0], ap2->dimensions[1],
 			oneD, (double *)ap2->data, lda,
 			(double *)ap1->data, ap1s, zeroD, (double *)ret->data, 1);
 	}
 	else if (typenum == PyArray_CFLOAT) {
 	    cblas_cgemv(Order,
-			CblasTrans,  ap2->dimensions[0], ap2->dimensions[1], 
+			CblasTrans,  ap2->dimensions[0], ap2->dimensions[1],
 			oneF, (float *)ap2->data, lda,
 			(float *)ap1->data, ap1s, zeroF, (float *)ret->data, 1);
 	}
 	NPY_END_ALLOW_THREADS
     }
     else { /* (ap1->nd == 2 && ap2->nd == 2) */
-	/* Matrix matrix multiplication -- Level 3 BLAS */  
+	/* Matrix matrix multiplication -- Level 3 BLAS */
 	/*  L x M  multiplied by M x N */
 	enum CBLAS_ORDER Order;
 	enum CBLAS_TRANSPOSE Trans1, Trans2;
@@ -638,7 +638,7 @@
 	/* We may be able to handle single-segment arrays here
 	   using appropriate values of Order, Trans1, and Trans2.
 	*/
-	
+
  	if (!PyArray_ISCONTIGUOUS(ap2)) {
 	    PyObject *new;
 	    new = PyArray_Copy(ap2);
@@ -655,7 +655,7 @@
 	}
 
 	NPY_BEGIN_ALLOW_THREADS
-	
+
 	Order = CblasRowMajor;
 	Trans1 = CblasNoTrans;
 	Trans2 = CblasNoTrans;
@@ -664,9 +664,9 @@
 	M = ap2->dimensions[0];
 	lda = (ap1->dimensions[1] > 1 ? ap1->dimensions[1] : 1);
 	ldb = (ap2->dimensions[1] > 1 ? ap2->dimensions[1] : 1);
-	ldc = (ret->dimensions[1] > 1 ? ret->dimensions[1] : 1);	    
+	ldc = (ret->dimensions[1] > 1 ? ret->dimensions[1] : 1);
 	if (typenum == PyArray_DOUBLE) {
-	    cblas_dgemm(Order, Trans1, Trans2, 
+	    cblas_dgemm(Order, Trans1, Trans2,
 			L, N, M,
 			1.0, (double *)ap1->data, lda,
 			(double *)ap2->data, ldb,
@@ -674,14 +674,14 @@
 	}
 	else if (typenum == PyArray_FLOAT) {
 	    cblas_sgemm(Order, Trans1, Trans2,
-			L, N, M, 
+			L, N, M,
 			1.0, (float *)ap1->data, lda,
 			(float *)ap2->data, ldb,
 			0.0, (float *)ret->data, ldc);
 	}
 	else if (typenum == PyArray_CDOUBLE) {
 	    cblas_zgemm(Order, Trans1, Trans2,
-			L, N, M, 
+			L, N, M,
 			oneD, (double *)ap1->data, lda,
 			(double *)ap2->data, ldb,
 			zeroD, (double *)ret->data, ldc);
@@ -700,7 +700,7 @@
     Py_DECREF(ap1);
     Py_DECREF(ap2);
     return PyArray_Return(ret);
-	
+
  fail:
     Py_XDECREF(ap1);
     Py_XDECREF(ap2);
@@ -712,7 +712,7 @@
 static char doc_innerproduct[] = "innerproduct(a,b)\nReturns the inner product of a and b for arrays of floating point types.\nLike the generic NumPy equivalent the product sum is over\nthe last dimension of a and b.\nNB: The first argument is not conjugated.";
 
 static PyObject *
-dotblas_innerproduct(PyObject *dummy, PyObject *args) 
+dotblas_innerproduct(PyObject *dummy, PyObject *args)
 {
     PyObject *op1, *op2;
     PyArrayObject *ap1, *ap2, *ret;
@@ -727,15 +727,15 @@
     double prior1, prior2;
 
     if (!PyArg_ParseTuple(args, "OO", &op1, &op2)) return NULL;
-	
-    /* 
+
+    /*
      * Inner product using the BLAS.  The product sum is taken along the last
      * dimensions of the two arrays.
      * Only speeds things up for float double and complex types.
      */
 
 
-    typenum = PyArray_ObjectType(op1, 0);  
+    typenum = PyArray_ObjectType(op1, 0);
     typenum = PyArray_ObjectType(op2, typenum);
 
     /* This function doesn't handle other types */
@@ -750,7 +750,7 @@
     ap2 = (PyArrayObject *)PyArray_ContiguousFromObject(op2, typenum, 0, 0);
     if (ap2 == NULL) goto fail;
 
-    if ((ap1->nd > 2) || (ap2->nd > 2)) {  
+    if ((ap1->nd > 2) || (ap2->nd > 2)) {
 	/* This function doesn't handle dimensions greater than 2 -- other
 	   than to ensure the dot function is altered
 	*/
@@ -759,12 +759,12 @@
 	    PyObject *tmp1, *tmp2;
 	    tmp1 = PyTuple_New(0);
 	    tmp2 = dotblas_alterdot(NULL, tmp1);
-	    Py_DECREF(tmp1); 
+	    Py_DECREF(tmp1);
 	    Py_DECREF(tmp2);
 	}
-	ret = (PyArrayObject *)PyArray_InnerProduct((PyObject *)ap1, 
+	ret = (PyArrayObject *)PyArray_InnerProduct((PyObject *)ap1,
 						    (PyObject *)ap2);
-	Py_DECREF(ap1); 
+	Py_DECREF(ap1);
 	Py_DECREF(ap2);
 	return PyArray_Return(ret);
     }
@@ -785,14 +785,14 @@
     else { /* (ap1->nd <= 2 && ap2->nd <= 2) */
 	/*  Both ap1 and ap2 are vectors or matrices */
 	l = ap1->dimensions[ap1->nd-1];
-	
+
 	if (ap2->dimensions[ap2->nd-1] != l) {
 	    PyErr_SetString(PyExc_ValueError, "matrices are not aligned");
 	    goto fail;
 	}
 	nd = ap1->nd+ap2->nd-2;
- 
-	if (nd == 1) 
+
+	if (nd == 1)
 	    dimensions[0] = (ap1->nd == 2) ? ap1->dimensions[0] : ap2->dimensions[0];
 	else if (nd == 2) {
 	    dimensions[0] = ap1->dimensions[0];
@@ -804,12 +804,12 @@
     prior2 = PyArray_GetPriority((PyObject *)ap2, 0.0);
     prior1 = PyArray_GetPriority((PyObject *)ap1, 0.0);
     subtype = (prior2 > prior1 ? ap2->ob_type : ap1->ob_type);
-    
-    ret = (PyArrayObject *)PyArray_New(subtype, nd, dimensions, 
-				       typenum, NULL, NULL, 0, 0, 
+
+    ret = (PyArrayObject *)PyArray_New(subtype, nd, dimensions,
+				       typenum, NULL, NULL, 0, 0,
 				       (PyObject *)\
 				       (prior2 > prior1 ? ap2 : ap1));
-    
+
     if (ret == NULL) goto fail;
     NPY_BEGIN_ALLOW_THREADS
     memset(ret->data, 0, PyArray_NBYTES(ret));
@@ -819,7 +819,7 @@
 	if (typenum == PyArray_DOUBLE) {
 	    cblas_daxpy(l, *((double *)ap2->data), (double *)ap1->data, 1,
 			(double *)ret->data, 1);
-	} 
+	}
 	else if (typenum == PyArray_CDOUBLE) {
 	    cblas_zaxpy(l, (double *)ap2->data, (double *)ap1->data, 1,
 			(double *)ret->data, 1);
@@ -836,21 +836,21 @@
     else if (ap1->nd == 1 && ap2->nd == 1) {
 	/* Dot product between two vectors -- Level 1 BLAS */
 	if (typenum == PyArray_DOUBLE) {
-	    double result = cblas_ddot(l, (double *)ap1->data, 1, 
+	    double result = cblas_ddot(l, (double *)ap1->data, 1,
 				       (double *)ap2->data, 1);
 	    *((double *)ret->data) = result;
 	}
 	else if (typenum == PyArray_CDOUBLE) {
-	    cblas_zdotu_sub(l, (double *)ap1->data, 1, 
+	    cblas_zdotu_sub(l, (double *)ap1->data, 1,
 			    (double *)ap2->data, 1, (double *)ret->data);
 	}
 	else if (typenum == PyArray_FLOAT) {
-	    float result = cblas_sdot(l, (float *)ap1->data, 1, 
+	    float result = cblas_sdot(l, (float *)ap1->data, 1,
 				      (float *)ap2->data, 1);
 	    *((float *)ret->data) = result;
 	}
 	else if (typenum == PyArray_CFLOAT) {
-	    cblas_cdotu_sub(l, (float *)ap1->data, 1, 
+	    cblas_cdotu_sub(l, (float *)ap1->data, 1,
 			    (float *)ap2->data, 1, (float *)ret->data);
 	}
     }
@@ -858,26 +858,26 @@
 	/* Matrix-vector multiplication -- Level 2 BLAS */
 	lda = (ap1->dimensions[1] > 1 ? ap1->dimensions[1] : 1);
 	if (typenum == PyArray_DOUBLE) {
-	    cblas_dgemv(CblasRowMajor, 
-			CblasNoTrans,  ap1->dimensions[0], ap1->dimensions[1], 
+	    cblas_dgemv(CblasRowMajor,
+			CblasNoTrans,  ap1->dimensions[0], ap1->dimensions[1],
 			1.0, (double *)ap1->data, lda,
 			(double *)ap2->data, 1, 0.0, (double *)ret->data, 1);
 	}
 	else if (typenum == PyArray_CDOUBLE) {
-	    cblas_zgemv(CblasRowMajor, 
-			CblasNoTrans,  ap1->dimensions[0], ap1->dimensions[1], 
+	    cblas_zgemv(CblasRowMajor,
+			CblasNoTrans,  ap1->dimensions[0], ap1->dimensions[1],
 			oneD, (double *)ap1->data, lda,
 			(double *)ap2->data, 1, zeroD, (double *)ret->data, 1);
 	}
 	else if (typenum == PyArray_FLOAT) {
-	    cblas_sgemv(CblasRowMajor, 
-			CblasNoTrans,  ap1->dimensions[0], ap1->dimensions[1], 
+	    cblas_sgemv(CblasRowMajor,
+			CblasNoTrans,  ap1->dimensions[0], ap1->dimensions[1],
 			1.0, (float *)ap1->data, lda,
 			(float *)ap2->data, 1, 0.0, (float *)ret->data, 1);
 	}
 	else if (typenum == PyArray_CFLOAT) {
-	    cblas_cgemv(CblasRowMajor, 
-			CblasNoTrans,  ap1->dimensions[0], ap1->dimensions[1], 
+	    cblas_cgemv(CblasRowMajor,
+			CblasNoTrans,  ap1->dimensions[0], ap1->dimensions[1],
 			oneF, (float *)ap1->data, lda,
 			(float *)ap2->data, 1, zeroF, (float *)ret->data, 1);
 	}
@@ -886,32 +886,32 @@
 	/* Vector matrix multiplication -- Level 2 BLAS */
 	lda = (ap2->dimensions[1] > 1 ? ap2->dimensions[1] : 1);
 	if (typenum == PyArray_DOUBLE) {
-	    cblas_dgemv(CblasRowMajor, 
-			CblasNoTrans,  ap2->dimensions[0], ap2->dimensions[1], 
+	    cblas_dgemv(CblasRowMajor,
+			CblasNoTrans,  ap2->dimensions[0], ap2->dimensions[1],
 			1.0, (double *)ap2->data, lda,
 			(double *)ap1->data, 1, 0.0, (double *)ret->data, 1);
 	}
 	else if (typenum == PyArray_CDOUBLE) {
-	    cblas_zgemv(CblasRowMajor, 
-			CblasNoTrans,  ap2->dimensions[0], ap2->dimensions[1], 
+	    cblas_zgemv(CblasRowMajor,
+			CblasNoTrans,  ap2->dimensions[0], ap2->dimensions[1],
 			oneD, (double *)ap2->data, lda,
 			(double *)ap1->data, 1, zeroD, (double *)ret->data, 1);
 	}
 	else if (typenum == PyArray_FLOAT) {
-	    cblas_sgemv(CblasRowMajor, 
-			CblasNoTrans,  ap2->dimensions[0], ap2->dimensions[1], 
+	    cblas_sgemv(CblasRowMajor,
+			CblasNoTrans,  ap2->dimensions[0], ap2->dimensions[1],
 			1.0, (float *)ap2->data, lda,
 			(float *)ap1->data, 1, 0.0, (float *)ret->data, 1);
 	}
 	else if (typenum == PyArray_CFLOAT) {
-	    cblas_cgemv(CblasRowMajor, 
-			CblasNoTrans,  ap2->dimensions[0], ap2->dimensions[1], 
+	    cblas_cgemv(CblasRowMajor,
+			CblasNoTrans,  ap2->dimensions[0], ap2->dimensions[1],
 			oneF, (float *)ap2->data, lda,
 			(float *)ap1->data, 1, zeroF, (float *)ret->data, 1);
 	}
     }
-    else { /* (ap1->nd == 2 && ap2->nd == 2) */  
-	/* Matrix matrix multiplication -- Level 3 BLAS */  
+    else { /* (ap1->nd == 2 && ap2->nd == 2) */
+	/* Matrix matrix multiplication -- Level 3 BLAS */
 	lda = (ap1->dimensions[1] > 1 ? ap1->dimensions[1] : 1);
 	ldb = (ap2->dimensions[1] > 1 ? ap2->dimensions[1] : 1);
 	ldc = (ret->dimensions[1] > 1 ? ret->dimensions[1] : 1);
@@ -948,7 +948,7 @@
     Py_DECREF(ap1);
     Py_DECREF(ap2);
     return PyArray_Return(ret);
-	
+
  fail:
     Py_XDECREF(ap1);
     Py_XDECREF(ap2);
@@ -969,31 +969,31 @@
     PyArray_Descr *type;
 
     if (!PyArg_ParseTuple(args, "OO", &op1, &op2)) return NULL;
-	
-    /* 
+
+    /*
      * Conjugating dot product using the BLAS for vectors.
      * Multiplies op1 and op2, each of which must be vector.
      */
 
-    typenum = PyArray_ObjectType(op1, 0);  
+    typenum = PyArray_ObjectType(op1, 0);
     typenum = PyArray_ObjectType(op2, typenum);
-    
+
     type = PyArray_DescrFromType(typenum);
-    Py_INCREF(type);   
+    Py_INCREF(type);
     ap1 = (PyArrayObject *)PyArray_FromAny(op1, type, 0, 0, 0, NULL);
     if (ap1==NULL) {Py_DECREF(type); goto fail;}
     op1 = PyArray_Flatten(ap1, 0);
     if (op1==NULL) {Py_DECREF(type); goto fail;}
     Py_DECREF(ap1);
     ap1 = (PyArrayObject *)op1;
-    
+
     ap2 = (PyArrayObject *)PyArray_FromAny(op2, type, 0, 0, 0, NULL);
     if (ap2==NULL) goto fail;
     op2 = PyArray_Flatten(ap2, 0);
     if (op2 == NULL) goto fail;
     Py_DECREF(ap2);
     ap2 = (PyArrayObject *)op2;
-    
+
     if (typenum != PyArray_FLOAT && typenum != PyArray_DOUBLE &&
 	typenum != PyArray_CFLOAT && typenum != PyArray_CDOUBLE) {
 	if (!altered) {
@@ -1001,7 +1001,7 @@
 	    PyObject *tmp1, *tmp2;
 	    tmp1 = PyTuple_New(0);
 	    tmp2 = dotblas_alterdot(NULL, tmp1);
-	    Py_DECREF(tmp1); 
+	    Py_DECREF(tmp1);
 	    Py_DECREF(tmp2);
 	}
 	if (PyTypeNum_ISCOMPLEX(typenum)) {
@@ -1009,10 +1009,10 @@
 	    if (op1==NULL) goto fail;
 	    Py_DECREF(ap1);
 	    ap1 = (PyArrayObject *)op1;
-	}	
-	ret = (PyArrayObject *)PyArray_InnerProduct((PyObject *)ap1, 
+	}
+	ret = (PyArrayObject *)PyArray_InnerProduct((PyObject *)ap1,
 						    (PyObject *)ap2);
-	Py_DECREF(ap1); 
+	Py_DECREF(ap1);
 	Py_DECREF(ap2);
 	return PyArray_Return(ret);
     }
@@ -1022,7 +1022,7 @@
 	goto fail;
     }
     l = ap1->dimensions[ap1->nd-1];
-  
+
     ret = (PyArrayObject *)PyArray_SimpleNew(0, dimensions, typenum);
     if (ret == NULL) goto fail;
 
@@ -1030,19 +1030,19 @@
 
     /* Dot product between two vectors -- Level 1 BLAS */
     if (typenum == PyArray_DOUBLE) {
-	*((double *)ret->data) = cblas_ddot(l, (double *)ap1->data, 1, 
+	*((double *)ret->data) = cblas_ddot(l, (double *)ap1->data, 1,
 					    (double *)ap2->data, 1);
     }
     else if (typenum == PyArray_FLOAT) {
-	*((float *)ret->data) = cblas_sdot(l, (float *)ap1->data, 1, 
+	*((float *)ret->data) = cblas_sdot(l, (float *)ap1->data, 1,
 					   (float *)ap2->data, 1);
     }
     else if (typenum == PyArray_CDOUBLE) {
-	cblas_zdotc_sub(l, (double *)ap1->data, 1, 
+	cblas_zdotc_sub(l, (double *)ap1->data, 1,
 			(double *)ap2->data, 1, (double *)ret->data);
     }
     else if (typenum == PyArray_CFLOAT) {
-	cblas_cdotc_sub(l, (float *)ap1->data, 1, 
+	cblas_cdotc_sub(l, (float *)ap1->data, 1,
 			(float *)ap2->data, 1, (float *)ret->data);
     }
 
@@ -1051,7 +1051,7 @@
     Py_DECREF(ap1);
     Py_DECREF(ap2);
     return PyArray_Return(ret);
-	
+
  fail:
     Py_XDECREF(ap1);
     Py_XDECREF(ap2);
@@ -1072,7 +1072,7 @@
 PyMODINIT_FUNC init_dotblas(void) {
     int i;
     PyObject *d, *s;
-    
+
     /* Create the module and add the functions */
     Py_InitModule3("_dotblas", dotblas_module_methods, module_doc);
 
@@ -1088,5 +1088,5 @@
     s = dotblas_alterdot(NULL, d);
     Py_DECREF(d);
     Py_DECREF(s);
-    
+
 }

Modified: branches/multicore/numpy/core/blasdot/cblas.h
===================================================================
--- branches/multicore/numpy/core/blasdot/cblas.h	2007-04-11 17:41:19 UTC (rev 3704)
+++ branches/multicore/numpy/core/blasdot/cblas.h	2007-04-11 20:38:46 UTC (rev 3705)
@@ -4,7 +4,7 @@
 
 /* Allow the use in C++ code.  */
 #ifdef __cplusplus
-extern "C" 
+extern "C"
 {
 #endif
 
@@ -77,39 +77,39 @@
  * ===========================================================================
  */
 
-/* 
+/*
  * Routines with standard 4 prefixes (s, d, c, z)
  */
-void cblas_sswap(const int N, float *X, const int incX, 
+void cblas_sswap(const int N, float *X, const int incX,
                  float *Y, const int incY);
-void cblas_scopy(const int N, const float *X, const int incX, 
+void cblas_scopy(const int N, const float *X, const int incX,
                  float *Y, const int incY);
 void cblas_saxpy(const int N, const float alpha, const float *X,
                  const int incX, float *Y, const int incY);
 
-void cblas_dswap(const int N, double *X, const int incX, 
+void cblas_dswap(const int N, double *X, const int incX,
                  double *Y, const int incY);
-void cblas_dcopy(const int N, const double *X, const int incX, 
+void cblas_dcopy(const int N, const double *X, const int incX,
                  double *Y, const int incY);
 void cblas_daxpy(const int N, const double alpha, const double *X,
                  const int incX, double *Y, const int incY);
 
-void cblas_cswap(const int N, void *X, const int incX, 
+void cblas_cswap(const int N, void *X, const int incX,
                  void *Y, const int incY);
-void cblas_ccopy(const int N, const void *X, const int incX, 
+void cblas_ccopy(const int N, const void *X, const int incX,
                  void *Y, const int incY);
 void cblas_caxpy(const int N, const void *alpha, const void *X,
                  const int incX, void *Y, const int incY);
 
-void cblas_zswap(const int N, void *X, const int incX, 
+void cblas_zswap(const int N, void *X, const int incX,
                  void *Y, const int incY);
-void cblas_zcopy(const int N, const void *X, const int incX, 
+void cblas_zcopy(const int N, const void *X, const int incX,
                  void *Y, const int incY);
 void cblas_zaxpy(const int N, const void *alpha, const void *X,
                  const int incX, void *Y, const int incY);
 
 
-/* 
+/*
  * Routines with S and D prefix only
  */
 void cblas_srotg(float *a, float *b, float *c, float *s);
@@ -127,7 +127,7 @@
                 double *Y, const int incY, const double *P);
 
 
-/* 
+/*
  * Routines with S D C Z CS and ZD prefixes
  */
 void cblas_sscal(const int N, const float alpha, float *X, const int incX);
@@ -143,7 +143,7 @@
  * ===========================================================================
  */
 
-/* 
+/*
  * Routines with standard 4 prefixes (S, D, C, Z)
  */
 void cblas_sgemv(const enum CBLAS_ORDER order,
@@ -158,11 +158,11 @@
                  const int incX, const float beta, float *Y, const int incY);
 void cblas_strmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
                  const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
-                 const int N, const float *A, const int lda, 
+                 const int N, const float *A, const int lda,
                  float *X, const int incX);
 void cblas_stbmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
                  const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
-                 const int N, const int K, const float *A, const int lda, 
+                 const int N, const int K, const float *A, const int lda,
                  float *X, const int incX);
 void cblas_stpmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
                  const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
@@ -191,11 +191,11 @@
                  const int incX, const double beta, double *Y, const int incY);
 void cblas_dtrmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
                  const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
-                 const int N, const double *A, const int lda, 
+                 const int N, const double *A, const int lda,
                  double *X, const int incX);
 void cblas_dtbmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
                  const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
-                 const int N, const int K, const double *A, const int lda, 
+                 const int N, const int K, const double *A, const int lda,
                  double *X, const int incX);
 void cblas_dtpmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
                  const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
@@ -224,11 +224,11 @@
                  const int incX, const void *beta, void *Y, const int incY);
 void cblas_ctrmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
                  const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
-                 const int N, const void *A, const int lda, 
+                 const int N, const void *A, const int lda,
                  void *X, const int incX);
 void cblas_ctbmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
                  const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
-                 const int N, const int K, const void *A, const int lda, 
+                 const int N, const int K, const void *A, const int lda,
                  void *X, const int incX);
 void cblas_ctpmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
                  const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
@@ -257,11 +257,11 @@
                  const int incX, const void *beta, void *Y, const int incY);
 void cblas_ztrmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
                  const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
-                 const int N, const void *A, const int lda, 
+                 const int N, const void *A, const int lda,
                  void *X, const int incX);
 void cblas_ztbmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
                  const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
-                 const int N, const int K, const void *A, const int lda, 
+                 const int N, const int K, const void *A, const int lda,
                  void *X, const int incX);
 void cblas_ztpmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
                  const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
@@ -279,7 +279,7 @@
                  const int N, const void *Ap, void *X, const int incX);
 
 
-/* 
+/*
  * Routines with S and D prefixes only
  */
 void cblas_ssymv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
@@ -341,7 +341,7 @@
                 const int incX, const double *Y, const int incY, double *A);
 
 
-/* 
+/*
  * Routines with C and Z prefixes only
  */
 void cblas_chemv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
@@ -412,7 +412,7 @@
  * ===========================================================================
  */
 
-/* 
+/*
  * Routines with standard 4 prefixes (S, D, C, Z)
  */
 void cblas_sgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA,
@@ -536,7 +536,7 @@
                  void *B, const int ldb);
 
 
-/* 
+/*
  * Routines with prefixes C and Z only
  */
 void cblas_chemm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side,
@@ -573,6 +573,6 @@
 
 #ifdef __cplusplus
 }
-#endif 
+#endif
 
 #endif

Modified: branches/multicore/numpy/doc/swig/numpy.i
===================================================================
--- branches/multicore/numpy/doc/swig/numpy.i	2007-04-11 17:41:19 UTC (rev 3704)
+++ branches/multicore/numpy/doc/swig/numpy.i	2007-04-11 20:38:46 UTC (rev 3705)
@@ -9,7 +9,7 @@
 #include <numpy/arrayobject.h>
 
 /* The following code originally appeared in
- * enthought/kiva/agg/src/numeric.i, author unknown.  It was
+ * enthought/kiva/agg/src/numeric.i written by Eric Jones.  It was
  * translated from C++ to C by John Hunter.  Bill Spotz has modified
  * it slightly to fix some minor bugs, upgrade to numpy (all
  * versions), add some comments and some functionality.
@@ -445,7 +445,7 @@
 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY)
   (DATA_TYPE IN_ARRAY1[ANY])
 {
-  $1 = ($input != NULL);
+  $1 = is_array($input) || PySequence_Check($input);
 }
 %typemap(in)
   (DATA_TYPE IN_ARRAY1[ANY])
@@ -467,7 +467,7 @@
 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY)
   (DATA_TYPE* IN_ARRAY1, DIM_TYPE DIM1)
 {
-  $1 = ($input != NULL);
+  $1 = is_array($input) || PySequence_Check($input);
 }
 %typemap(in)
   (DATA_TYPE* IN_ARRAY1, DIM_TYPE DIM1)
@@ -490,7 +490,7 @@
 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY)
   (DIM_TYPE DIM1, DATA_TYPE* IN_ARRAY1)
 {
-  $1 = ($input != NULL);
+  $1 = is_array($input) || PySequence_Check($input);
 }
 %typemap(in)
   (DIM_TYPE DIM1, DATA_TYPE* IN_ARRAY1)
@@ -513,7 +513,7 @@
 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY)
   (DATA_TYPE IN_ARRAY2[ANY][ANY])
 {
-  $1 = ($input != NULL);
+  $1 = is_array($input) || PySequence_Check($input);
 }
 %typemap(in)
   (DATA_TYPE IN_ARRAY2[ANY][ANY])
@@ -535,7 +535,7 @@
 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY)
   (DATA_TYPE* IN_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
 {
-  $1 = ($input != NULL);
+  $1 = is_array($input) || PySequence_Check($input);
 }
 %typemap(in)
   (DATA_TYPE* IN_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
@@ -559,7 +559,7 @@
 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY)
   (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_ARRAY2)
 {
-  $1 = ($input != NULL);
+  $1 = is_array($input) || PySequence_Check($input);
 }
 %typemap(in)
   (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_ARRAY2)
@@ -583,7 +583,7 @@
 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY)
   (DATA_TYPE IN_ARRAY3[ANY][ANY][ANY])
 {
-  $1 = ($input != NULL);
+  $1 = is_array($input) || PySequence_Check($input);
 }
 %typemap(in)
   (DATA_TYPE IN_ARRAY3[ANY][ANY][ANY])
@@ -606,7 +606,7 @@
 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY)
   (DATA_TYPE* IN_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
 {
-  $1 = ($input != NULL);
+  $1 = is_array($input) || PySequence_Check($input);
 }
 %typemap(in)
   (DATA_TYPE* IN_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
@@ -632,7 +632,7 @@
 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY)
   (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_ARRAY3)
 {
-  $1 = ($input != NULL);
+  $1 = is_array($input) || PySequence_Check($input);
 }
 %typemap(in)
   (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_ARRAY3)



More information about the Numpy-svn mailing list