True
"""
- self._charpoly = None # for caching
self._rank = rank
self._natural_basis = natural_basis
self._multiplication_table = mult_table
+ @cached_method
def characteristic_polynomial(self):
"""
EXAMPLES:
t^2 - 2*t + 1
"""
- if self._charpoly is not None:
- return self._charpoly
-
r = self.rank()
n = self.dimension()
# assign a[r] goes out-of-bounds.
a.append(1) # corresponds to x^r
- self._charpoly = sum( a[k]*(t**k) for k in range(len(a)) )
- return self._charpoly
+ return sum( a[k]*(t**k) for k in range(len(a)) )
def inner_product(self, x, y):