From 40850626cb85d115363995ad6beaee8cb17d83da Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sat, 13 Mar 2021 15:27:02 -0500 Subject: [PATCH] eja: drop obsolete _vec2mat and _mat2vec helpers. --- mjo/eja/eja_algebra.py | 8 +++++--- mjo/eja/eja_utils.py | 10 ---------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/mjo/eja/eja_algebra.py b/mjo/eja/eja_algebra.py index 6fb4baa..d02b558 100644 --- a/mjo/eja/eja_algebra.py +++ b/mjo/eja/eja_algebra.py @@ -168,7 +168,7 @@ from sage.rings.all import (ZZ, QQ, AA, QQbar, RR, RLF, CLF, QuadraticField) from mjo.eja.eja_element import FiniteDimensionalEJAElement from mjo.eja.eja_operator import FiniteDimensionalEJAOperator -from mjo.eja.eja_utils import _all2list, _mat2vec +from mjo.eja.eja_utils import _all2list def EuclideanJordanAlgebras(field): r""" @@ -1281,7 +1281,9 @@ class FiniteDimensionalEJA(CombinatorialFreeModule): # # Of course, matrices aren't vectors in sage, so we have to # appeal to the "long vectors" isometry. - oper_vecs = [ _mat2vec(g.operator().matrix()) for g in self.gens() ] + + V = VectorSpace(self.base_ring(), self.dimension()**2) + oper_vecs = [ V(g.operator().matrix().list()) for g in self.gens() ] # Now we use basic linear algebra to find the coefficients, # of the matrices-as-vectors-linear-combination, which should @@ -1291,7 +1293,7 @@ class FiniteDimensionalEJA(CombinatorialFreeModule): # We used the isometry on the left-hand side already, but we # still need to do it for the right-hand side. Recall that we # wanted something that summed to the identity matrix. - b = _mat2vec( matrix.identity(self.base_ring(), self.dimension()) ) + b = V( matrix.identity(self.base_ring(), self.dimension()).list() ) # Now if there's an identity element in the algebra, this # should work. We solve on the left to avoid having to diff --git a/mjo/eja/eja_utils.py b/mjo/eja/eja_utils.py index a432861..79d8ecf 100644 --- a/mjo/eja/eja_utils.py +++ b/mjo/eja/eja_utils.py @@ -1,7 +1,4 @@ -from sage.functions.other import sqrt from sage.structure.element import is_Matrix -from sage.matrix.constructor import matrix -from sage.modules.free_module_element import vector def _charpoly_sage_input(s): r""" @@ -171,13 +168,6 @@ def _all2list(x): return sum( map(_all2list, xl) , []) - -def _mat2vec(m): - return vector(m.base_ring(), m.list()) - -def _vec2mat(v): - return matrix(v.base_ring(), sqrt(v.degree()), v.list()) - def gram_schmidt(v, inner_product=None): """ Perform Gram-Schmidt on the list ``v`` which are assumed to be -- 2.43.2