From: Michael Orlitzky Date: Sat, 21 Nov 2020 00:22:35 +0000 (-0500) Subject: eja: move the TrivialEJA random_instance() into an override method. X-Git-Url: http://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=89868b0bee2843c64160f4cd67aa333be0a2e5d1;p=sage.d.git eja: move the TrivialEJA random_instance() into an override method. --- diff --git a/mjo/eja/eja_algebra.py b/mjo/eja/eja_algebra.py index a7a076b..7089c50 100644 --- a/mjo/eja/eja_algebra.py +++ b/mjo/eja/eja_algebra.py @@ -839,11 +839,6 @@ class FiniteDimensionalEuclideanJordanAlgebra(CombinatorialFreeModule): Beware, this will crash for "most instances" because the constructor below looks wrong. """ - if cls is TrivialEJA: - # The TrivialEJA class doesn't take an "n" argument because - # there's only one. - return cls(field) - n = ZZ.random_element(cls._max_random_instance_size() + 1) return cls(n, field, **kwargs) @@ -2305,6 +2300,11 @@ class TrivialEJA(FiniteDimensionalEuclideanJordanAlgebra): # largest subalgebra generated by any element. self.rank.set_cache(0) + @classmethod + def random_instance(cls, field=AA, **kwargs): + # We don't take a "size" argument so the superclass method is + # inappropriate for us. + return cls(field, **kwargs) class DirectSumEJA(FiniteDimensionalEuclideanJordanAlgebra): r"""