From 944ceb9212517941ca4b82d85459c46fe679ffd9 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 3 Mar 2021 07:41:24 -0500 Subject: [PATCH] matrix_algebra: use simpler indices. Using cartesian_product() and FiniteEnumeratedSet for my indices was obscuring the foo.basis() output. --- mjo/matrix_algebra.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/mjo/matrix_algebra.py b/mjo/matrix_algebra.py index a695b0b..668a1c4 100644 --- a/mjo/matrix_algebra.py +++ b/mjo/matrix_algebra.py @@ -193,15 +193,15 @@ class MatrixAlgebra(CombinatorialFreeModule): # sticking a "1" in each position doesn't give us a basis for # the space. We actually need to stick each of e0, e1, ... (a # basis for the entry algebra itself) into each position. - from sage.sets.finite_enumerated_set import FiniteEnumeratedSet - from sage.categories.sets_cat import cartesian_product - - I = FiniteEnumeratedSet(range(n)) - J = FiniteEnumeratedSet(range(n)) + I = range(n) + J = range(n) self._entry_algebra = entry_algebra entry_basis = entry_algebra.gens() - basis_indices = cartesian_product([I,J,entry_basis]) + basis_indices = [(i,j,e) for i in range(n) + for j in range(n) + for e in entry_algebra.gens()] + super().__init__(scalars, basis_indices, category=category, @@ -227,13 +227,14 @@ class MatrixAlgebra(CombinatorialFreeModule): ncols = nrows def product_on_basis(self, mon1, mon2): - (i,j,oct1) = mon1 - (k,l,oct2) = mon2 + (i,j,e1) = mon1 + (k,l,e2) = mon2 if j == k: - return self.monomial((i,l,oct1*oct2)) + return self.monomial((i,l,e1*e2)) else: return self.zero() + # TODO: only makes sense if I'm unital. def one(self): r""" SETUP:: -- 2.44.2