Skip to content

Commit

Permalink
Replace use of deprecated is_NumberFieldElement
Browse files Browse the repository at this point in the history
  • Loading branch information
mkoeppe committed Jun 26, 2024
1 parent 00328c7 commit 18c002c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cutgeneratingfunctionology/igp/crazy_perturbation.sage
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def is_in_ZZ_span(x, generators):
numbers = [x]+generators
if not is_all_the_same_number_field_fastpath(numbers):
numbers = nice_field_values(numbers, RealNumberField)
if not is_NumberFieldElement(numbers[0]):
if not isinstance(numbers[0], NumberFieldElement_base):
if is_all_QQ(numbers):
raise ValueError("generators are not Q-linear independent")
raise ValueError("Q-linear independence test only implemented for algebraic numbers")
Expand Down
6 changes: 3 additions & 3 deletions cutgeneratingfunctionology/igp/functions.sage
Original file line number Diff line number Diff line change
Expand Up @@ -3197,15 +3197,15 @@ def is_all_QQ_fastpath(values):
return False
return True

from sage.rings.number_field.number_field_element import is_NumberFieldElement
from sage.rings.number_field.number_field_element_base import NumberFieldElement_base

def is_all_the_same_number_field_fastpath(values):
r"""
This version does not try coercions and compares fields using ``is``, rather than their comparison operator.
"""
number_field_seen = None
for x in values:
if is_NumberFieldElement(x):
if isinstance(x, NumberFieldElement_base):
if number_field_seen:
if number_field_seen is not x.parent():
return False
Expand Down Expand Up @@ -3259,7 +3259,7 @@ def is_QQ_linearly_independent(*numbers):
if not is_all_the_same_number_field_fastpath(numbers):
# try to coerce to common number field
numbers = nice_field_values(numbers, RealNumberField)
if not is_NumberFieldElement(numbers[0]):
if not isinstance(numbers[0], NumberFieldElement_base):
is_QQ, QQ_numbers = is_all_QQ(numbers)
if is_QQ:
return False
Expand Down

0 comments on commit 18c002c

Please sign in to comment.