]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
eja: move the TrivialEJA random_instance() into an override method.
authorMichael Orlitzky <michael@orlitzky.com>
Sat, 21 Nov 2020 00:22:35 +0000 (19:22 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Sat, 21 Nov 2020 00:22:35 +0000 (19:22 -0500)
mjo/eja/eja_algebra.py

index a7a076bb056a0e29c3e93d73ac881378cb518e4e..7089c50ab81c222b5be8ddca3c6667da9699cf98 100644 (file)
@@ -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"""