[Numpy-discussion] crash in np.poly

Charles R Harris charlesr.harris at gmail.com
Thu May 27 22:00:22 EDT 2010


On Thu, May 27, 2010 at 7:57 PM, Charles R Harris <charlesr.harris at gmail.com
> wrote:

>
>
> On Thu, May 27, 2010 at 5:19 PM, <josef.pktd at gmail.com> wrote:
>
>> I was tracking a test failure/crash in scipy.signal.ltisys
>>
>> numpy 1.4.0:
>>
>> >>> np.poly(np.zeros((0,0)))
>>  ** On entry to DGEEV  parameter number  5 had an illegal value
>>
>>
>> In current:
>
> In [1]: np.poly(np.zeros((0,0)))
> ---------------------------------------------------------------------------
> ValueError                                Traceback (most recent call last)
>
> /home/charris/<ipython console> in <module>()
>
> /usr/local/lib/python2.6/dist-packages/numpy/lib/polynomial.pyc in
> poly(seq_of_zeros)
>     126         pass
>     127     else:
> --> 128         raise ValueError, "input must be 1d or square 2d array."
>     129
>     130     if len(seq_of_zeros) == 0:
>
> ValueError: input must be 1d or square 2d array.
>
>
> Looks like it could use a better error message in this case, though. Could
> you open a low priority ticket for this?
>
>
The new Polynomial class does somewhat better:

In [6]: Poly(zeros((0,0)))
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)

/home/charris/<ipython console> in <module>()

/usr/local/lib/python2.6/dist-packages/numpy/polynomial/polynomial.pyc in
__init__(self, coef, domain)

/usr/local/lib/python2.6/dist-packages/numpy/polynomial/polyutils.pyc in
as_series(alist, trim)
    156     arrays = [np.array(a, ndmin=1, copy=0) for a in alist]
    157     if min([a.size for a in arrays]) == 0 :
--> 158         raise ValueError("Coefficient array is empty")
    159     if any([a.ndim != 1 for a in arrays]) :
    160         raise ValueError("Coefficient array is not 1-d")

ValueError: Coefficient array is empty

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20100527/7f182eb6/attachment.html>


More information about the NumPy-Discussion mailing list