Skip to content

Commit 78fceb7

Browse files
author
Release Manager
committed
gh-40239: Simplify matrix construction in btquotient <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes #12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> Simplify matrix construction in btquotient.py to improve readability. <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes #12345". --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - #12345: short description why this is a dependency --> <!-- - #34567: ... --> URL: #40239 Reported by: Eloi Torrents Reviewer(s):
2 parents 62b611d + 81ad425 commit 78fceb7

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/sage/modular/btquotients/btquotient.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
from sage.interfaces.magma import magma
4646
from sage.matrix.constructor import Matrix
4747
from sage.matrix.matrix_space import MatrixSpace
48+
from sage.matrix.special import column_matrix
4849
from sage.misc.cachefunc import cached_method
4950
from sage.misc.latex import latex
5051
from sage.misc.lazy_attribute import lazy_attribute
@@ -2273,9 +2274,7 @@ def _compute_embedding_matrix(self, prec, force_computation=False):
22732274
else:
22742275
phi = self._local_splitting_map(prec)
22752276
B = self.get_eichler_order_basis()
2276-
return Matrix(Zmod(self._p ** prec), 4, 4,
2277-
[phi(B[kk])[ii, jj] for ii in range(2)
2278-
for jj in range(2) for kk in range(4)])
2277+
return column_matrix(Zmod(self._p ** prec), 4, 4, [phi(b).list() for b in B])
22792278

22802279
@cached_method
22812280
def get_extra_embedding_matrices(self):
@@ -2441,12 +2440,10 @@ def get_embedding_matrix(self, prec=None, exact=False):
24412440
verbose('self._prec = %s, prec = %s' % (self._prec, prec))
24422441
Iotamod = self._compute_embedding_matrix(prec)
24432442
self._Iotainv_lift = Iotamod.inverse().lift()
2444-
self._Iota = Matrix(self._R, 4, 4, [Iotamod[ii, jj]
2445-
for ii in range(4)
2446-
for jj in range(4)])
2443+
self._Iota = Matrix(self._R, Iotamod)
24472444

24482445
self._prec = prec
2449-
self._Iotainv = self._Mat_44([self._Iotainv_lift[ii, jj] % self._pN for ii in range(4) for jj in range(4)])
2446+
self._Iotainv = self._Mat_44(self._Iotainv_lift.apply_map(lambda x: x % self._pN))
24502447
return self._Iota
24512448

24522449
def embed_quaternion(self, g, exact=False, prec=None):
@@ -3152,8 +3149,7 @@ def _find_lattice(self, v1, v2, as_edges, m):
31523149
v1adj = v1.adjugate()
31533150
R = self._Mat_44
31543151
vecM = [v2 * X[ii] * v1adj for ii in range(4)]
3155-
M = self._Iotainv * R([[vecM[ii][jj, kk] for ii in range(4)]
3156-
for jj in range(2) for kk in range(2)])
3152+
M = self._Iotainv * column_matrix(4, 4, [m.list() for m in vecM])
31573153
M = M.augment(R(self._pN)).transpose()
31583154
E = M.echelon_form().submatrix(0, 0, 4, 4)
31593155
Et = E.transpose()

0 commit comments

Comments
 (0)