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"""
#
# 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
# 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
-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"""
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