X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;ds=sidebyside;f=mjo%2Feja%2Feja_algebra.py;h=4e66b2db251274d3091875a20056692f33849513;hb=d1b6531a00fcaec57e4cd1a24b08d3a217712b26;hp=055bbbda83d7576fda8f5e1794d759c2eee467bc;hpb=f807c8c9046723a059eb4eea03dff89293510160;p=sage.d.git diff --git a/mjo/eja/eja_algebra.py b/mjo/eja/eja_algebra.py index 055bbbd..4e66b2d 100644 --- a/mjo/eja/eja_algebra.py +++ b/mjo/eja/eja_algebra.py @@ -438,8 +438,15 @@ class FiniteDimensionalEuclideanJordanAlgebra(CombinatorialFreeModule): """ Return the matrix space in which this algebra's natural basis elements live. + + Generally this will be an `n`-by-`1` column-vector space, + except when the algebra is trivial. There it's `n`-by-`n` + (where `n` is zero), to ensure that two elements of the + natural basis space (empty matrices) can be multiplied. """ - if self._natural_basis is None or len(self._natural_basis) == 0: + if self.is_trivial(): + return MatrixSpace(self.base_ring(), 0) + elif self._natural_basis is None or len(self._natural_basis) == 0: return MatrixSpace(self.base_ring(), self.dimension(), 1) else: return self._natural_basis[0].matrix_space() @@ -666,7 +673,7 @@ class FiniteDimensionalEuclideanJordanAlgebra(CombinatorialFreeModule): # there's only one. return cls(field) - n = ZZ.random_element(cls._max_test_case_size()) + 1 + n = ZZ.random_element(cls._max_test_case_size() + 1) return cls(n, field, **kwargs) @cached_method