[Scipy-svn] r4991 - trunk/scipy/signal

scipy-svn@scip... scipy-svn@scip...
Tue Nov 4 02:34:10 CST 2008


Author: cdavid
Date: 2008-11-04 02:34:04 -0600 (Tue, 04 Nov 2008)
New Revision: 4991

Modified:
   trunk/scipy/signal/newsig.c
Log:
Raise a python exception if a[0] == 0.

Modified: trunk/scipy/signal/newsig.c
===================================================================
--- trunk/scipy/signal/newsig.c	2008-11-04 08:33:47 UTC (rev 4990)
+++ trunk/scipy/signal/newsig.c	2008-11-04 08:34:04 UTC (rev 4991)
@@ -15,8 +15,8 @@
 	PyObject *b, *a, *X, *Vi;
 	PyArrayObject *arY, *arb, *ara, *arX, *arVi, *arVf;
 	int axis, typenum, theaxis;
-	char *ara_ptr, input_flag = 0;
-	intp na, nb;
+	char *ara_ptr, input_flag = 0, *azero;
+	intp na, nb, nal;
 	BasicFilterFunction *basic_filter;
 
         axis = -1;
@@ -80,15 +80,16 @@
 	}
 
 	/* Skip over leading zeros in vector representing denominator (a) */
-	// XXX: TODO
-#if 0
+	/* XXX: handle this correctly */
+	azero = PyArray_Zero(ara);
 	ara_ptr = ara->data;
-	while (memcmp(ara_ptr, Va.zero, Va.elsize) == 0) {
-		ara_ptr += Va.elsize;
-		Va.data = ara_ptr;
-		Va.numels--;
+        nal = PyArray_ITEMSIZE(ara);
+	if (memcmp(ara_ptr, azero, nal) == 0) {
+		PyErr_SetString(PyExc_ValueError,
+				"BUG: filter coefficient a[0] == 0 not supported yet");
+                goto fail;
 	}
-#endif
+	PyDataMem_FREE(azero);
 
 	na = PyArray_SIZE(ara);
 	nb = PyArray_SIZE(arb);



More information about the Scipy-svn mailing list