sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.34k stars 452 forks source link

Special case is_unitary() for trivial RDF/CDF matrices #29297

Closed orlitzky closed 4 years ago

orlitzky commented 4 years ago

We have a doctest ensuring that is_unitary() crashes for trivial RDF/CDF matrices:

The smallest cases.  The Schur decomposition used by the
orthonormal algorithm will fail on a matrix of size zero.  ::

    sage: P = matrix(CDF, 0, 0,)
    sage: P.is_unitary(algorithm='orthonormal')
    Traceback (most recent call last):
    ...
    error: ((lwork==-1)||(lwork >= MAX(1,2*n))) failed for 3rd keyword lwork: zgees:lwork=0

Ignoring the value of such a test for the time being... it's failing for me due to some change in a library:

Failed example:
    P.is_unitary(algorithm='orthonormal')
Expected:
    Traceback (most recent call last):
    ...
    error: ((lwork==-1)||(lwork >= MAX(1,2*n))) failed for 3rd keyword lwork: zgees:lwork=0
Got:
    ...
    ValueError: On entry to ZGEES parameter number 6 had an illegal value

Rather than try to accommodate both error messages... let's just make it work.

Component: doctest framework

Author: Michael Orlitzky

Branch/Commit: cc3eb9f

Reviewer: Markus Wageringel

Issue created by migration from https://trac.sagemath.org/ticket/29297

orlitzky commented 4 years ago

New commits:

cc3eb9fTrac #29297: add special case to is_unitary() for trivial RDF/CDF matrices.
orlitzky commented 4 years ago

Author: Michael Orlitzky

orlitzky commented 4 years ago

Commit: cc3eb9f

orlitzky commented 4 years ago

Branch: u/mjo/ticket/29297

mwageringel commented 4 years ago
comment:2

I have also observed this issue when building Sage with ATLAS. Thanks for the fix.

mwageringel commented 4 years ago

Reviewer: Markus Wageringel

vbraun commented 4 years ago

Changed branch from u/mjo/ticket/29297 to cc3eb9f