[Numpy-discussion] Bug: np.linalg.qr crash the python interpreter if getting a shape (0, x) array.

Skipper Seabold jsseabold at gmail.com
Sun May 8 14:24:01 EDT 2011


On Sun, May 8, 2011 at 11:42 AM, Skipper Seabold <jsseabold at gmail.com> wrote:
> On Fri, May 6, 2011 at 11:30 AM, Till Stensitzki <mail.till at gmx.de> wrote:
>> Hi,
>> discovered another small bug. Windows 7 32 bit, Python 2.6.
>>
>> In [1]: np.__version__
>> Out[1]: '1.5.1'
>>
>> In [2]: a=np.zeros((0,2))
>>
>> In [3]: np.linalg.qr(a)
>>  ** On entry to DGEQRF parameter number  4 had an illegal value
>>
>
> In [3]: a
> Out[3]: array([], shape=(0, 2), dtype=float64)
>
> It doesn't crash for me on 1.5.1, but returns error code -4 from
> dgeqrf. Maybe np.linalg.linalg._assertRank2 should also check that
> a.size > 0, or there should an _assertNotEmpty?
>
> Maybe you should file a ticket so it doesn't get lost.
>

Added an _assertNonEmpty to qr and filed a pull request.

https://github.com/jseabold/numpy/compare/master...qr-nonempty-check

Skipper



More information about the NumPy-Discussion mailing list