2 Euclidean Jordan Algebras. These are formally-real Jordan Algebras;
3 specifically those where u^2 + v^2 = 0 implies that u = v = 0. They
4 are used in optimization, and have some additional nice methods beyond
5 what can be supported in a general Jordan Algebra.
8 from sage
.categories
.magmatic_algebras
import MagmaticAlgebras
9 from sage
.structure
.element
import is_Matrix
10 from sage
.structure
.category_object
import normalize_names
12 from sage
.algebras
.finite_dimensional_algebras
.finite_dimensional_algebra
import FiniteDimensionalAlgebra
13 from sage
.algebras
.finite_dimensional_algebras
.finite_dimensional_algebra_element
import FiniteDimensionalAlgebraElement
15 class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra
):
17 def __classcall_private__(cls
,
21 assume_associative
=False,
25 mult_table
= [b
.base_extend(field
) for b
in mult_table
]
28 if not (is_Matrix(b
) and b
.dimensions() == (n
, n
)):
29 raise ValueError("input is not a multiplication table")
30 mult_table
= tuple(mult_table
)
32 cat
= MagmaticAlgebras(field
).FiniteDimensional().WithBasis()
33 cat
.or_subcategory(category
)
34 if assume_associative
:
35 cat
= cat
.Associative()
37 names
= normalize_names(n
, names
)
39 fda
= super(FiniteDimensionalEuclideanJordanAlgebra
, cls
)
40 return fda
.__classcall
__(cls
,
43 assume_associative
=assume_associative
,
49 def __init__(self
, field
,
52 assume_associative
=False,
56 fda
= super(FiniteDimensionalEuclideanJordanAlgebra
, self
)
65 Return a string representation of ``self``.
67 fmt
= "Euclidean Jordan algebra of degree {} over {}"
68 return fmt
.format(self
.degree(), self
.base_ring())
72 Return the rank of this EJA.
74 if self
._rank
is None:
75 raise ValueError("no rank specified at genesis")
80 class Element(FiniteDimensionalAlgebraElement
):
82 An element of a Euclidean Jordan algebra.
87 Return ``self`` raised to the power ``n``.
89 Jordan algebras are always power-associative; see for
90 example Faraut and Koranyi, Proposition II.1.2 (ii).
94 We have to override this because our superclass uses row vectors
95 instead of column vectors! We, on the other hand, assume column
100 sage: set_random_seed()
101 sage: x = random_eja().random_element()
102 sage: x.matrix()*x.vector() == (x**2).vector()
112 return A
.element_class(A
, (self
.matrix()**(n
-1))*self
.vector())
115 def characteristic_polynomial(self
):
117 Return my characteristic polynomial (if I'm a regular
120 Eventually this should be implemented in terms of the parent
121 algebra's characteristic polynomial that works for ALL
124 if self
.is_regular():
125 return self
.minimal_polynomial()
127 raise NotImplementedError('irregular element')
132 Return my determinant, the product of my eigenvalues.
136 sage: J = JordanSpinSimpleEJA(2)
137 sage: e0,e1 = J.gens()
141 sage: J = JordanSpinSimpleEJA(3)
142 sage: e0,e1,e2 = J.gens()
143 sage: x = e0 + e1 + e2
148 cs
= self
.characteristic_polynomial().coefficients(sparse
=False)
151 return cs
[0] * (-1)**r
153 raise ValueError('charpoly had no coefficients')
158 Return the Jordan-multiplicative inverse of this element.
160 We can't use the superclass method because it relies on the
161 algebra being associative.
165 The identity element is its own inverse::
167 sage: set_random_seed()
168 sage: J = random_eja()
169 sage: J.one().inverse() == J.one()
172 If an element has an inverse, it acts like one. TODO: this
173 can be a lot less ugly once ``is_invertible`` doesn't crash
174 on irregular elements::
176 sage: set_random_seed()
177 sage: J = random_eja()
178 sage: x = J.random_element()
180 ....: x.inverse()*x == J.one()
186 if self
.parent().is_associative():
187 elt
= FiniteDimensionalAlgebraElement(self
.parent(), self
)
190 # TODO: we can do better once the call to is_invertible()
191 # doesn't crash on irregular elements.
192 #if not self.is_invertible():
193 # raise ArgumentError('element is not invertible')
195 # We do this a little different than the usual recursive
196 # call to a finite-dimensional algebra element, because we
197 # wind up with an inverse that lives in the subalgebra and
198 # we need information about the parent to convert it back.
199 V
= self
.span_of_powers()
200 assoc_subalg
= self
.subalgebra_generated_by()
201 # Mis-design warning: the basis used for span_of_powers()
202 # and subalgebra_generated_by() must be the same, and in
204 elt
= assoc_subalg(V
.coordinates(self
.vector()))
206 # This will be in the subalgebra's coordinates...
207 fda_elt
= FiniteDimensionalAlgebraElement(assoc_subalg
, elt
)
208 subalg_inverse
= fda_elt
.inverse()
210 # So we have to convert back...
211 basis
= [ self
.parent(v
) for v
in V
.basis() ]
212 pairs
= zip(subalg_inverse
.vector(), basis
)
213 return self
.parent().linear_combination(pairs
)
216 def is_invertible(self
):
218 Return whether or not this element is invertible.
220 We can't use the superclass method because it relies on
221 the algebra being associative.
223 return not self
.det().is_zero()
226 def is_nilpotent(self
):
228 Return whether or not some power of this element is zero.
230 The superclass method won't work unless we're in an
231 associative algebra, and we aren't. However, we generate
232 an assocoative subalgebra and we're nilpotent there if and
233 only if we're nilpotent here (probably).
237 The identity element is never nilpotent::
239 sage: set_random_seed()
240 sage: random_eja().one().is_nilpotent()
243 The additive identity is always nilpotent::
245 sage: set_random_seed()
246 sage: random_eja().zero().is_nilpotent()
250 # The element we're going to call "is_nilpotent()" on.
251 # Either myself, interpreted as an element of a finite-
252 # dimensional algebra, or an element of an associative
256 if self
.parent().is_associative():
257 elt
= FiniteDimensionalAlgebraElement(self
.parent(), self
)
259 V
= self
.span_of_powers()
260 assoc_subalg
= self
.subalgebra_generated_by()
261 # Mis-design warning: the basis used for span_of_powers()
262 # and subalgebra_generated_by() must be the same, and in
264 elt
= assoc_subalg(V
.coordinates(self
.vector()))
266 # Recursive call, but should work since elt lives in an
267 # associative algebra.
268 return elt
.is_nilpotent()
271 def is_regular(self
):
273 Return whether or not this is a regular element.
277 The identity element always has degree one, but any element
278 linearly-independent from it is regular::
280 sage: J = JordanSpinSimpleEJA(5)
281 sage: J.one().is_regular()
283 sage: e0, e1, e2, e3, e4 = J.gens() # e0 is the identity
284 sage: for x in J.gens():
285 ....: (J.one() + x).is_regular()
293 return self
.degree() == self
.parent().rank()
298 Compute the degree of this element the straightforward way
299 according to the definition; by appending powers to a list
300 and figuring out its dimension (that is, whether or not
301 they're linearly dependent).
305 sage: J = JordanSpinSimpleEJA(4)
306 sage: J.one().degree()
308 sage: e0,e1,e2,e3 = J.gens()
309 sage: (e0 - e1).degree()
312 In the spin factor algebra (of rank two), all elements that
313 aren't multiples of the identity are regular::
315 sage: set_random_seed()
316 sage: n = ZZ.random_element(1,10).abs()
317 sage: J = JordanSpinSimpleEJA(n)
318 sage: x = J.random_element()
319 sage: x == x.coefficient(0)*J.one() or x.degree() == 2
323 return self
.span_of_powers().dimension()
328 Return the matrix that represents left- (or right-)
329 multiplication by this element in the parent algebra.
331 We have to override this because the superclass method
332 returns a matrix that acts on row vectors (that is, on
335 fda_elt
= FiniteDimensionalAlgebraElement(self
.parent(), self
)
336 return fda_elt
.matrix().transpose()
339 def minimal_polynomial(self
):
343 sage: set_random_seed()
344 sage: x = random_eja().random_element()
345 sage: x.degree() == x.minimal_polynomial().degree()
350 sage: set_random_seed()
351 sage: x = random_eja().random_element()
352 sage: x.degree() == x.minimal_polynomial().degree()
355 The minimal polynomial and the characteristic polynomial coincide
356 and are known (see Alizadeh, Example 11.11) for all elements of
357 the spin factor algebra that aren't scalar multiples of the
360 sage: set_random_seed()
361 sage: n = ZZ.random_element(2,10).abs()
362 sage: J = JordanSpinSimpleEJA(n)
363 sage: y = J.random_element()
364 sage: while y == y.coefficient(0)*J.one():
365 ....: y = J.random_element()
366 sage: y0 = y.vector()[0]
367 sage: y_bar = y.vector()[1:]
368 sage: actual = y.minimal_polynomial()
369 sage: x = SR.symbol('x', domain='real')
370 sage: expected = x^2 - 2*y0*x + (y0^2 - norm(y_bar)^2)
371 sage: bool(actual == expected)
375 # The element we're going to call "minimal_polynomial()" on.
376 # Either myself, interpreted as an element of a finite-
377 # dimensional algebra, or an element of an associative
381 if self
.parent().is_associative():
382 elt
= FiniteDimensionalAlgebraElement(self
.parent(), self
)
384 V
= self
.span_of_powers()
385 assoc_subalg
= self
.subalgebra_generated_by()
386 # Mis-design warning: the basis used for span_of_powers()
387 # and subalgebra_generated_by() must be the same, and in
389 elt
= assoc_subalg(V
.coordinates(self
.vector()))
391 # Recursive call, but should work since elt lives in an
392 # associative algebra.
393 return elt
.minimal_polynomial()
396 def quadratic_representation(self
, other
=None):
398 Return the quadratic representation of this element.
402 The explicit form in the spin factor algebra is given by
403 Alizadeh's Example 11.12::
405 sage: set_random_seed()
406 sage: n = ZZ.random_element(1,10).abs()
407 sage: J = JordanSpinSimpleEJA(n)
408 sage: x = J.random_element()
409 sage: x_vec = x.vector()
411 sage: x_bar = x_vec[1:]
412 sage: A = matrix(QQ, 1, [x_vec.inner_product(x_vec)])
413 sage: B = 2*x0*x_bar.row()
414 sage: C = 2*x0*x_bar.column()
415 sage: D = identity_matrix(QQ, n-1)
416 sage: D = (x0^2 - x_bar.inner_product(x_bar))*D
417 sage: D = D + 2*x_bar.tensor_product(x_bar)
418 sage: Q = block_matrix(2,2,[A,B,C,D])
419 sage: Q == x.quadratic_representation()
422 Test all of the properties from Theorem 11.2 in Alizadeh::
424 sage: set_random_seed()
425 sage: J = random_eja()
426 sage: x = J.random_element()
427 sage: y = J.random_element()
431 sage: actual = x.quadratic_representation(y)
432 sage: expected = ( (x+y).quadratic_representation()
433 ....: -x.quadratic_representation()
434 ....: -y.quadratic_representation() ) / 2
435 sage: actual == expected
440 sage: alpha = QQ.random_element()
441 sage: actual = (alpha*x).quadratic_representation()
442 sage: expected = (alpha^2)*x.quadratic_representation()
443 sage: actual == expected
448 sage: Qy = y.quadratic_representation()
449 sage: actual = J(Qy*x.vector()).quadratic_representation()
450 sage: expected = Qy*x.quadratic_representation()*Qy
451 sage: actual == expected
456 sage: k = ZZ.random_element(1,10).abs()
457 sage: actual = (x^k).quadratic_representation()
458 sage: expected = (x.quadratic_representation())^k
459 sage: actual == expected
465 elif not other
in self
.parent():
466 raise ArgumentError("'other' must live in the same algebra")
468 return ( self
.matrix()*other
.matrix()
469 + other
.matrix()*self
.matrix()
470 - (self
*other
).matrix() )
473 def span_of_powers(self
):
475 Return the vector space spanned by successive powers of
478 # The dimension of the subalgebra can't be greater than
479 # the big algebra, so just put everything into a list
480 # and let span() get rid of the excess.
481 V
= self
.vector().parent()
482 return V
.span( (self
**d
).vector() for d
in xrange(V
.dimension()) )
485 def subalgebra_generated_by(self
):
487 Return the associative subalgebra of the parent EJA generated
492 sage: set_random_seed()
493 sage: x = random_eja().random_element()
494 sage: x.subalgebra_generated_by().is_associative()
497 Squaring in the subalgebra should be the same thing as
498 squaring in the superalgebra::
500 sage: set_random_seed()
501 sage: x = random_eja().random_element()
502 sage: u = x.subalgebra_generated_by().random_element()
503 sage: u.matrix()*u.vector() == (u**2).vector()
507 # First get the subspace spanned by the powers of myself...
508 V
= self
.span_of_powers()
511 # Now figure out the entries of the right-multiplication
512 # matrix for the successive basis elements b0, b1,... of
515 for b_right
in V
.basis():
516 eja_b_right
= self
.parent()(b_right
)
518 # The first row of the right-multiplication matrix by
519 # b1 is what we get if we apply that matrix to b1. The
520 # second row of the right multiplication matrix by b1
521 # is what we get when we apply that matrix to b2...
523 # IMPORTANT: this assumes that all vectors are COLUMN
524 # vectors, unlike our superclass (which uses row vectors).
525 for b_left
in V
.basis():
526 eja_b_left
= self
.parent()(b_left
)
527 # Multiply in the original EJA, but then get the
528 # coordinates from the subalgebra in terms of its
530 this_row
= V
.coordinates((eja_b_left
*eja_b_right
).vector())
531 b_right_rows
.append(this_row
)
532 b_right_matrix
= matrix(F
, b_right_rows
)
533 mats
.append(b_right_matrix
)
535 # It's an algebra of polynomials in one element, and EJAs
536 # are power-associative.
538 # TODO: choose generator names intelligently.
539 return FiniteDimensionalEuclideanJordanAlgebra(F
, mats
, assume_associative
=True, names
='f')
542 def subalgebra_idempotent(self
):
544 Find an idempotent in the associative subalgebra I generate
545 using Proposition 2.3.5 in Baes.
549 sage: set_random_seed()
551 sage: c = J.random_element().subalgebra_idempotent()
554 sage: J = JordanSpinSimpleEJA(5)
555 sage: c = J.random_element().subalgebra_idempotent()
560 if self
.is_nilpotent():
561 raise ValueError("this only works with non-nilpotent elements!")
563 V
= self
.span_of_powers()
564 J
= self
.subalgebra_generated_by()
565 # Mis-design warning: the basis used for span_of_powers()
566 # and subalgebra_generated_by() must be the same, and in
568 u
= J(V
.coordinates(self
.vector()))
570 # The image of the matrix of left-u^m-multiplication
571 # will be minimal for some natural number s...
573 minimal_dim
= V
.dimension()
574 for i
in xrange(1, V
.dimension()):
575 this_dim
= (u
**i
).matrix().image().dimension()
576 if this_dim
< minimal_dim
:
577 minimal_dim
= this_dim
580 # Now minimal_matrix should correspond to the smallest
581 # non-zero subspace in Baes's (or really, Koecher's)
584 # However, we need to restrict the matrix to work on the
585 # subspace... or do we? Can't we just solve, knowing that
586 # A(c) = u^(s+1) should have a solution in the big space,
589 # Beware, solve_right() means that we're using COLUMN vectors.
590 # Our FiniteDimensionalAlgebraElement superclass uses rows.
593 c_coordinates
= A
.solve_right(u_next
.vector())
595 # Now c_coordinates is the idempotent we want, but it's in
596 # the coordinate system of the subalgebra.
598 # We need the basis for J, but as elements of the parent algebra.
600 basis
= [self
.parent(v
) for v
in V
.basis()]
601 return self
.parent().linear_combination(zip(c_coordinates
, basis
))
606 Return my trace, the sum of my eigenvalues.
610 sage: J = JordanSpinSimpleEJA(3)
611 sage: e0,e1,e2 = J.gens()
612 sage: x = e0 + e1 + e2
617 cs
= self
.characteristic_polynomial().coefficients(sparse
=False)
621 raise ValueError('charpoly had fewer than 2 coefficients')
624 def trace_inner_product(self
, other
):
626 Return the trace inner product of myself and ``other``.
628 if not other
in self
.parent():
629 raise ArgumentError("'other' must live in the same algebra")
631 return (self
*other
).trace()
634 def eja_rn(dimension
, field
=QQ
):
636 Return the Euclidean Jordan Algebra corresponding to the set
637 `R^n` under the Hadamard product.
641 This multiplication table can be verified by hand::
644 sage: e0,e1,e2 = J.gens()
659 # The FiniteDimensionalAlgebra constructor takes a list of
660 # matrices, the ith representing right multiplication by the ith
661 # basis element in the vector space. So if e_1 = (1,0,0), then
662 # right (Hadamard) multiplication of x by e_1 picks out the first
663 # component of x; and likewise for the ith basis element e_i.
664 Qs
= [ matrix(field
, dimension
, dimension
, lambda k
,j
: 1*(k
== j
== i
))
665 for i
in xrange(dimension
) ]
667 return FiniteDimensionalEuclideanJordanAlgebra(field
,Qs
,rank
=dimension
)
673 Return a "random" finite-dimensional Euclidean Jordan Algebra.
677 For now, we choose a random natural number ``n`` (greater than zero)
678 and then give you back one of the following:
680 * The cartesian product of the rational numbers ``n`` times; this is
681 ``QQ^n`` with the Hadamard product.
683 * The Jordan spin algebra on ``QQ^n``.
685 * The ``n``-by-``n`` rational symmetric matrices with the symmetric
688 Later this might be extended to return Cartesian products of the
694 Euclidean Jordan algebra of degree...
697 n
= ZZ
.random_element(1,5).abs()
698 constructor
= choice([eja_rn
,
700 RealSymmetricSimpleEJA
,
701 ComplexHermitianSimpleEJA
])
702 return constructor(n
, field
=QQ
)
706 def _real_symmetric_basis(n
, field
=QQ
):
708 Return a basis for the space of real symmetric n-by-n matrices.
710 # The basis of symmetric matrices, as matrices, in their R^(n-by-n)
714 for j
in xrange(i
+1):
715 Eij
= matrix(field
, n
, lambda k
,l
: k
==i
and l
==j
)
719 # Beware, orthogonal but not normalized!
720 Sij
= Eij
+ Eij
.transpose()
725 def _complex_hermitian_basis(n
, field
=QQ
):
727 Returns a basis for the space of complex Hermitian n-by-n matrices.
731 sage: set_random_seed()
732 sage: n = ZZ.random_element(1,5).abs()
733 sage: all( M.is_symmetric() for M in _complex_hermitian_basis(n) )
737 F
= QuadraticField(-1, 'I')
740 # This is like the symmetric case, but we need to be careful:
742 # * We want conjugate-symmetry, not just symmetry.
743 # * The diagonal will (as a result) be real.
747 for j
in xrange(i
+1):
748 Eij
= matrix(field
, n
, lambda k
,l
: k
==i
and l
==j
)
750 Sij
= _embed_complex_matrix(Eij
)
753 # Beware, orthogonal but not normalized! The second one
754 # has a minus because it's conjugated.
755 Sij_real
= _embed_complex_matrix(Eij
+ Eij
.transpose())
757 Sij_imag
= _embed_complex_matrix(I
*Eij
- I
*Eij
.transpose())
762 def _multiplication_table_from_matrix_basis(basis
):
764 At least three of the five simple Euclidean Jordan algebras have the
765 symmetric multiplication (A,B) |-> (AB + BA)/2, where the
766 multiplication on the right is matrix multiplication. Given a basis
767 for the underlying matrix space, this function returns a
768 multiplication table (obtained by looping through the basis
769 elements) for an algebra of those matrices.
771 # In S^2, for example, we nominally have four coordinates even
772 # though the space is of dimension three only. The vector space V
773 # is supposed to hold the entire long vector, and the subspace W
774 # of V will be spanned by the vectors that arise from symmetric
775 # matrices. Thus for S^2, dim(V) == 4 and dim(W) == 3.
776 field
= basis
[0].base_ring()
777 dimension
= basis
[0].nrows()
780 return vector(field
, m
.list())
783 return matrix(field
, dimension
, v
.list())
785 V
= VectorSpace(field
, dimension
**2)
786 W
= V
.span( mat2vec(s
) for s
in basis
)
788 # Taking the span above reorders our basis (thanks, jerk!) so we
789 # need to put our "matrix basis" in the same order as the
790 # (reordered) vector basis.
791 S
= [ vec2mat(b
) for b
in W
.basis() ]
795 # Brute force the multiplication-by-s matrix by looping
796 # through all elements of the basis and doing the computation
797 # to find out what the corresponding row should be. BEWARE:
798 # these multiplication tables won't be symmetric! It therefore
799 # becomes REALLY IMPORTANT that the underlying algebra
800 # constructor uses ROW vectors and not COLUMN vectors. That's
801 # why we're computing rows here and not columns.
804 this_row
= mat2vec((s
*t
+ t
*s
)/2)
805 Q_rows
.append(W
.coordinates(this_row
))
806 Q
= matrix(field
, W
.dimension(), Q_rows
)
812 def _embed_complex_matrix(M
):
814 Embed the n-by-n complex matrix ``M`` into the space of real
815 matrices of size 2n-by-2n via the map the sends each entry `z = a +
816 bi` to the block matrix ``[[a,b],[-b,a]]``.
820 sage: F = QuadraticField(-1,'i')
821 sage: x1 = F(4 - 2*i)
822 sage: x2 = F(1 + 2*i)
825 sage: M = matrix(F,2,[x1,x2,x3,x4])
826 sage: _embed_complex_matrix(M)
836 raise ArgumentError("the matrix 'M' must be square")
837 field
= M
.base_ring()
842 blocks
.append(matrix(field
, 2, [[a
,-b
],[b
,a
]]))
844 # We can drop the imaginaries here.
845 return block_matrix(field
.base_ring(), n
, blocks
)
848 def _unembed_complex_matrix(M
):
850 The inverse of _embed_complex_matrix().
854 sage: A = matrix(QQ,[ [ 1, 2, 3, 4],
855 ....: [-2, 1, -4, 3],
856 ....: [ 9, 10, 11, 12],
857 ....: [-10, 9, -12, 11] ])
858 sage: _unembed_complex_matrix(A)
860 [ -10*i + 9 -12*i + 11]
864 raise ArgumentError("the matrix 'M' must be square")
865 if not n
.mod(2).is_zero():
866 raise ArgumentError("the matrix 'M' must be a complex embedding")
868 F
= QuadraticField(-1, 'i')
871 # Go top-left to bottom-right (reading order), converting every
872 # 2-by-2 block we see to a single complex element.
874 for k
in xrange(n
/2):
875 for j
in xrange(n
/2):
876 submat
= M
[2*k
:2*k
+2,2*j
:2*j
+2]
877 if submat
[0,0] != submat
[1,1]:
878 raise ArgumentError('bad real submatrix')
879 if submat
[0,1] != -submat
[1,0]:
880 raise ArgumentError('bad imag submatrix')
881 z
= submat
[0,0] + submat
[1,0]*i
884 return matrix(F
, n
/2, elements
)
887 def RealSymmetricSimpleEJA(n
, field
=QQ
):
889 The rank-n simple EJA consisting of real symmetric n-by-n
890 matrices, the usual symmetric Jordan product, and the trace inner
891 product. It has dimension `(n^2 + n)/2` over the reals.
895 sage: J = RealSymmetricSimpleEJA(2)
896 sage: e0, e1, e2 = J.gens()
906 The degree of this algebra is `(n^2 + n) / 2`::
908 sage: set_random_seed()
909 sage: n = ZZ.random_element(1,5).abs()
910 sage: J = RealSymmetricSimpleEJA(n)
911 sage: J.degree() == (n^2 + n)/2
915 S
= _real_symmetric_basis(n
, field
=field
)
916 Qs
= _multiplication_table_from_matrix_basis(S
)
918 return FiniteDimensionalEuclideanJordanAlgebra(field
,Qs
,rank
=n
)
921 def ComplexHermitianSimpleEJA(n
, field
=QQ
):
923 The rank-n simple EJA consisting of complex Hermitian n-by-n
924 matrices over the real numbers, the usual symmetric Jordan product,
925 and the real-part-of-trace inner product. It has dimension `n^2` over
930 The degree of this algebra is `n^2`::
932 sage: set_random_seed()
933 sage: n = ZZ.random_element(1,5).abs()
934 sage: J = ComplexHermitianSimpleEJA(n)
935 sage: J.degree() == n^2
939 S
= _complex_hermitian_basis(n
)
940 Qs
= _multiplication_table_from_matrix_basis(S
)
941 return FiniteDimensionalEuclideanJordanAlgebra(field
, Qs
, rank
=n
)
944 def QuaternionHermitianSimpleEJA(n
):
946 The rank-n simple EJA consisting of self-adjoint n-by-n quaternion
947 matrices, the usual symmetric Jordan product, and the
948 real-part-of-trace inner product. It has dimension `2n^2 - n` over
953 def OctonionHermitianSimpleEJA(n
):
955 This shit be crazy. It has dimension 27 over the reals.
960 def JordanSpinSimpleEJA(n
, field
=QQ
):
962 The rank-2 simple EJA consisting of real vectors ``x=(x0, x_bar)``
963 with the usual inner product and jordan product ``x*y =
964 (<x_bar,y_bar>, x0*y_bar + y0*x_bar)``. It has dimension `n` over
969 This multiplication table can be verified by hand::
971 sage: J = JordanSpinSimpleEJA(4)
972 sage: e0,e1,e2,e3 = J.gens()
988 In one dimension, this is the reals under multiplication::
990 sage: J1 = JordanSpinSimpleEJA(1)
997 id_matrix
= identity_matrix(field
, n
)
999 ei
= id_matrix
.column(i
)
1000 Qi
= zero_matrix(field
, n
)
1002 Qi
.set_column(0, ei
)
1003 Qi
+= diagonal_matrix(n
, [ei
[0]]*n
)
1004 # The addition of the diagonal matrix adds an extra ei[0] in the
1005 # upper-left corner of the matrix.
1006 Qi
[0,0] = Qi
[0,0] * ~
field(2)
1009 # The rank of the spin factor algebra is two, UNLESS we're in a
1010 # one-dimensional ambient space (the rank is bounded by the
1011 # ambient dimension).
1012 return FiniteDimensionalEuclideanJordanAlgebra(field
, Qs
, rank
=min(n
,2))