Skip to content

Commit

Permalink
reviewer comments
Browse files Browse the repository at this point in the history
  • Loading branch information
yyyyx4 committed Jan 18, 2024
1 parent 4a74567 commit b75a9a4
Showing 1 changed file with 9 additions and 19 deletions.
28 changes: 9 additions & 19 deletions src/sage/quadratic_forms/bqf_class_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,11 +355,11 @@ def _coerce_map_from_(self, other):
Class of 9*x^2 + 4*x*y + 9*y^2
"""
if not isinstance(other, BQFClassGroup):
return None
return super()._coerce_map_from_(other)
try:
proj = BQFClassGroupQuotientMorphism(other, self)
except (TypeError, ValueError):
return None
return super()._coerce_map_from_(other)

Check warning on line 362 in src/sage/quadratic_forms/bqf_class_group.py

View check run for this annotation

Codecov / codecov/patch

src/sage/quadratic_forms/bqf_class_group.py#L361-L362

Added lines #L361 - L362 were not covered by tests
return proj


Expand Down Expand Up @@ -651,6 +651,9 @@ def _project_bqf(bqf, q):
:class:`BQFClassGroup_element` of discriminant `D`
in the form class group of discriminant `D/q^2`.
ALGORITHM: Find a class representative with `q^2 \mid a`
(and `q \mid b`) and substitute `x\mapsto x/q`.
EXAMPLES::
sage: from sage.quadratic_forms.bqf_class_group import _project_bqf
Expand All @@ -671,9 +674,6 @@ def _project_bqf(bqf, q):
-1 * 2^2 * 101^2
sage: f2.discriminant().factor()
-1 * 2^2
ALGORITHM: Find a class representative with `q^2 \mid a`
(and `q\mid b`) and substitute `x\mapsto x/q`.
"""
q2 = q**2
disc = bqf.discriminant()
Expand Down Expand Up @@ -770,23 +770,13 @@ def __init__(self, G, H):
sage: from sage.quadratic_forms.bqf_class_group import BQFClassGroupQuotientMorphism
sage: G = BQFClassGroup(-4*117117)
sage: H = BQFClassGroup(-4*77)
sage: BQFClassGroupQuotientMorphism(G, H)
Generic morphism:
From: Form Class Group of Discriminant -468468
To: Form Class Group of Discriminant -308
sage: f = BQFClassGroupQuotientMorphism(G, H)
sage: TestSuite(f).run(skip='_test_category')
"""
if not isinstance(G, BQFClassGroup):
try:
disc = ZZ(G)
except Exception:
raise TypeError('G needs to be a BQFClassGroup')
G = BQFClassGroup(disc)
raise TypeError('G needs to be a BQFClassGroup')

Check warning on line 777 in src/sage/quadratic_forms/bqf_class_group.py

View check run for this annotation

Codecov / codecov/patch

src/sage/quadratic_forms/bqf_class_group.py#L777

Added line #L777 was not covered by tests
if not isinstance(H, BQFClassGroup):
try:
disc = ZZ(G)
except Exception:
raise TypeError('H needs to be a BQFClassGroup')
H = BQFClassGroup(disc)
raise TypeError('H needs to be a BQFClassGroup')

Check warning on line 779 in src/sage/quadratic_forms/bqf_class_group.py

View check run for this annotation

Codecov / codecov/patch

src/sage/quadratic_forms/bqf_class_group.py#L779

Added line #L779 was not covered by tests
try:
self.f = ZZ((G.discriminant() / H.discriminant()).sqrt(extend=False)).factor()
except ValueError:
Expand Down

0 comments on commit b75a9a4

Please sign in to comment.