From 89868b0bee2843c64160f4cd67aa333be0a2e5d1 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Fri, 20 Nov 2020 19:22:35 -0500 Subject: [PATCH] eja: move the TrivialEJA random_instance() into an override method. --- mjo/eja/eja_algebra.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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""" -- 2.43.2