Skip to content

Commit 6467855

Browse files
committed
projective_morphism.py: Simplify LCM of normalize_coordinates
1 parent 8493ce2 commit 6467855

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

src/sage/schemes/projective/projective_morphism.py

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -985,26 +985,14 @@ def normalize_coordinates(self, **kwds):
985985

986986
# Only clear denominators from the coefficients in the ring of integers
987987
if R in NumberFields():
988-
denom_list = []
989-
990-
for entry in self:
991-
if entry == 0:
992-
continue
993-
994-
O = R.maximal_order()
995-
996-
if O is ZZ:
997-
denom_list.append(entry.denominator())
998-
elif is_NumberFieldOrder(O):
999-
frac_ideal = O.fractional_ideal(entry)
1000-
if K.is_relative():
1001-
frac_ideal_norm = frac_ideal.absolute_norm()
1002-
else:
1003-
frac_ideal_norm = frac_ideal.norm()
988+
O = R.maximal_order()
1004989

1005-
denom_list.append(frac_ideal_norm.denominator())
990+
if O is ZZ:
991+
denom = lcm([self[i].denominator() for i in range(len(list(self)))])
992+
else:
993+
denom = R.ideal(list(self)).absolute_norm().denominator()
1006994

1007-
self.scale_by(lcm(denom_list))
995+
self.scale_by(denom)
1008996

1009997
# There are cases, such as the example above over GF(7),
1010998
# where we want to compute GCDs, but NOT in the case

0 commit comments

Comments
 (0)