Skip to content

Commit

Permalink
Trac #34355: avoid constructing list of all base-field elements in Qu…
Browse files Browse the repository at this point in the history
…aternionAlgebra_ab.modp_splitting_data()

This patch is from Rémy Oudompheng:

{{{#!patch
diff --git a/src/sage/algebras/quatalg/quaternion_algebra.py
b/src/sage/algebras/quatalg/quaternion_algebra.py
index 3bde7b2153..3e12785e14 100644
--- a/src/sage/algebras/quatalg/quaternion_algebra.py
+++ b/src/sage/algebras/quatalg/quaternion_algebra.py
@@ -1232,7 +1232,7 @@ class
QuaternionAlgebra_ab(QuaternionAlgebra_abstract):
             raise NotImplementedError("algorithm for computing local
splittings not implemented in general (currently require the first
invariant to be coprime to p)")
         i2inv = ~i2
         a = None
-        for b in list(F):
+        for b in F:
             if not b:
                 continue
             c = j2 + i2inv * b*b
}}}

Obviously, constructing a list of all elements is a very bad idea for
non-tiny base fields.

URL: https://trac.sagemath.org/34355
Reported by: lorenz
Ticket author(s): Rémy Oudompheng
Reviewer(s): Travis Scrimshaw
  • Loading branch information
Release Manager committed Aug 29, 2022
2 parents b56e1c9 + 91d3645 commit a41531c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions build/pkgs/configure/checksums.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
tarball=configure-VERSION.tar.gz
sha1=5e524f1afff2888475c49f1652efc292b3a4c7b6
md5=c3859fac3716ac64800f176c54389089
cksum=3271526260
sha1=4dc25b05edc28e9b3436019a0245925c0b3cd2b4
md5=512d3f6fe25eb62a4055c4115f4afdd8
cksum=3390252657
2 changes: 1 addition & 1 deletion build/pkgs/configure/package-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
02cbc86624701318edfee6cd1c2f59c226f4a588
8ef36794c478a588479e16472c4964d034c294ad
2 changes: 1 addition & 1 deletion src/sage/algebras/quatalg/quaternion_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -1232,7 +1232,7 @@ def modp_splitting_data(self, p):
raise NotImplementedError("algorithm for computing local splittings not implemented in general (currently require the first invariant to be coprime to p)")
i2inv = ~i2
a = None
for b in list(F):
for b in F:
if not b:
continue
c = j2 + i2inv * b*b
Expand Down

0 comments on commit a41531c

Please sign in to comment.