5. Factor out the unit-norm basis (and operator symmetry) tests once
all of the algebras pass.
-
-6. Can we make the minimal and characteristic polynomial tests work
- for trivial algebras, too? Then we wouldn't need the "nontrivial"
- argument to random_eja(). This would also allow us to potentially
- pass a "size" of zero to the other constructors in random_eja() --
- a code path that is basically untested right now.
"""
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()
# 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