From 7dc61e259969f86d4f31706fcfe411e1677389f2 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sun, 14 Feb 2021 11:06:24 -0500 Subject: [PATCH] eja: drop a pointless "solve" in the EJA charpoly system. --- makefile | 2 +- mjo/eja/eja_algebra.py | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/makefile b/makefile index 63b577a..b4a41e4 100644 --- a/makefile +++ b/makefile @@ -1,7 +1,7 @@ SAGE = $(shell which sage) check: - PYTHONPATH="." $(SAGE) -t --timeout=0 --long --exitfirst mjo/ + PYTHONPATH="." $(SAGE) -t --timeout=0 --memlimit=0 --long --exitfirst mjo/ clean: find ./ -type f -name '*.pyc' -delete find ./ -type d -name '__pycache__' -delete diff --git a/mjo/eja/eja_algebra.py b/mjo/eja/eja_algebra.py index 7c8adc7..c35bf25 100644 --- a/mjo/eja/eja_algebra.py +++ b/mjo/eja/eja_algebra.py @@ -1151,10 +1151,17 @@ class FiniteDimensionalEJA(CombinatorialFreeModule): # The theory says that only the first "r" coefficients are # nonzero, and they actually live in the original polynomial - # ring and not the fraction field. We negate them because - # in the actual characteristic polynomial, they get moved - # to the other side where x^r lives. - return -A_rref.solve_right(E*b).change_ring(R)[:r] + # ring and not the fraction field. We negate them because in + # the actual characteristic polynomial, they get moved to the + # other side where x^r lives. We don't bother to trim A_rref + # down to a square matrix and solve the resulting system, + # because the upper-left r-by-r portion of A_rref is + # guaranteed to be the identity matrix, so e.g. + # + # A_rref.solve_right(Y) + # + # would just be returning Y. + return (-E*b)[:r].change_ring(R) @cached_method def rank(self): @@ -1215,7 +1222,7 @@ class FiniteDimensionalEJA(CombinatorialFreeModule): sage: set_random_seed() # long time sage: J = random_eja() # long time - sage: caches = J.rank() # long time + sage: cached = J.rank() # long time sage: J.rank.clear_cache() # long time sage: J.rank() == cached # long time True -- 2.44.2