Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Trac #33100: allow nonpositive tolerance for RDF/CDF is_hermitian().
Browse files Browse the repository at this point in the history
Our RDF/CDF matrix subclass has a check to ensure that the tolerance
passed to is_hermitian() is strictly positive. The superclass does not
do that, and there's _technically_ no problem with using a negative
tolerance -- all comparisons will simply fail -- so we remove the
check here to simplify the class hierarchy a bit.

The eventual goal is to consolidate and unify the API and behavior of
all these methods.
  • Loading branch information
orlitzky committed Feb 12, 2022
1 parent c4977c4 commit e5e8a0f
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions src/sage/matrix/matrix_double_dense.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2765,16 +2765,6 @@ cdef class Matrix_double_dense(Matrix_dense):
sage: A._is_hermitian_orthonormal(skew=True)
True
TESTS:
The tolerance must be strictly positive::
sage: A = matrix(RDF, 2, range(4))
sage: A._is_hermitian_orthonormal(tol = -3.1)
Traceback (most recent call last):
...
ValueError: tolerance must be positive, not -3.1
AUTHOR:
- Rob Beezer (2011-03-30)
Expand All @@ -2783,8 +2773,6 @@ cdef class Matrix_double_dense(Matrix_dense):
import sage.rings.complex_double
global numpy
tol = float(tol)
if tol <= 0:
raise ValueError('tolerance must be positive, not {0}'.format(tol))

key = ("_is_hermitian_orthonormal", tol, skew)
h = self.fetch(key)
Expand Down Expand Up @@ -2919,14 +2907,6 @@ cdef class Matrix_double_dense(Matrix_dense):
TESTS:
The tolerance must be strictly positive. ::
sage: A = matrix(RDF, 2, range(4))
sage: A.is_hermitian(tol = -3.1)
Traceback (most recent call last):
...
ValueError: tolerance must be positive, not -3.1
The ``algorithm`` keyword gets checked. ::
sage: A = matrix(RDF, 2, range(4))
Expand Down Expand Up @@ -3047,14 +3027,6 @@ cdef class Matrix_double_dense(Matrix_dense):
TESTS:
The tolerance must be strictly positive. ::
sage: A = matrix(RDF, 2, range(4))
sage: A.is_skew_hermitian(tol = -3.1)
Traceback (most recent call last):
...
ValueError: tolerance must be positive, not -3.1
The ``algorithm`` keyword gets checked. ::
sage: A = matrix(RDF, 2, range(4))
Expand Down

0 comments on commit e5e8a0f

Please sign in to comment.