From: Michael Orlitzky Date: Tue, 2 Mar 2021 20:44:11 +0000 (-0500) Subject: octonions: rename octonions() accessor to entry_algebra(). X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=9c8a4f05eeef719ad3b20f8e2cd17074253aff29;p=sage.d.git octonions: rename octonions() accessor to entry_algebra(). This entire class can be made more generic. Here's phase one. --- diff --git a/mjo/octonions.py b/mjo/octonions.py index c2b829f..f786fcf 100644 --- a/mjo/octonions.py +++ b/mjo/octonions.py @@ -376,7 +376,7 @@ class OctonionMatrix(IndexedFreeModuleElement): [[e0 + 2*e3, 0, 0], [0, 0, 0], [0, 0, 0]] """ - zero = self.parent().octonions().zero() + zero = self.parent().entry_algebra().zero() l = [[zero for j in range(self.ncols())] for i in range(self.nrows())] for (k,v) in self.monomial_coefficients().items(): (i,j,e) = k @@ -464,7 +464,7 @@ class OctonionMatrix(IndexedFreeModuleElement): 3*e0 """ - zero = self.parent().octonions().zero() + zero = self.parent().entry_algebra().zero() return sum( (self[i,i] for i in range(self.nrows())), zero ) def matrix_space(self): @@ -530,8 +530,8 @@ class OctonionMatrixAlgebra(CombinatorialFreeModule): I = FiniteEnumeratedSet(range(n)) J = FiniteEnumeratedSet(range(n)) - self._octonions = Octonions(field=field) - entry_basis = self._octonions.gens() + self._entry_algebra = Octonions(field=field) + entry_basis = self._entry_algebra.gens() basis_indices = cartesian_product([I,J,entry_basis]) super().__init__(field, @@ -545,11 +545,11 @@ class OctonionMatrixAlgebra(CombinatorialFreeModule): " over the scalar ring %s" % (self.nrows(), self.ncols(), self.base_ring()) ) - def octonions(self): + def entry_algebra(self): r""" - Return the Octonion algebra that our elements' entries come from. + Return the algebra that our elements' entries come from. """ - return self._octonions + return self._entry_algebra def nrows(self): return self._nrows @@ -578,7 +578,7 @@ class OctonionMatrixAlgebra(CombinatorialFreeModule): True """ - return sum( (self.monomial((i,i,self._octonions.one())) + return sum( (self.monomial((i,i,self.entry_algebra().one())) for i in range(self.nrows()) ), self.zero() ) @@ -618,7 +618,7 @@ class OctonionMatrixAlgebra(CombinatorialFreeModule): # given octonion algebra to ours. Otherwise we can fail # to convert an element of (for example) Octonions(QQ) # to Octonions(AA). - return self.octonions().from_vector(e_ij.to_vector()) + return self.entry_algebra().from_vector(e_ij.to_vector()) return sum( (self.monomial( (i,j, convert(entries[i][j])) ) for i in range(nrows)