]>
gitweb.michael.orlitzky.com - sage.d.git/blob - mjo/eja/euclidean_jordan_algebra.py
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.
10 def eja_rn(dimension
, field
=QQ
):
12 Return the Euclidean Jordan Algebra corresponding to the set
13 `R^n` under the Hadamard product.
17 This multiplication table can be verified by hand::
20 sage: e0,e1,e2 = J.gens()
35 # The FiniteDimensionalAlgebra constructor takes a list of
36 # matrices, the ith representing right multiplication by the ith
37 # basis element in the vector space. So if e_1 = (1,0,0), then
38 # right (Hadamard) multiplication of x by e_1 picks out the first
39 # component of x; and likewise for the ith basis element e_i.
40 Qs
= [ matrix(field
, dimension
, dimension
, lambda k
,j
: 1*(k
== j
== i
))
41 for i
in xrange(dimension
) ]
42 A
= FiniteDimensionalAlgebra(QQ
,Qs
,assume_associative
=True)
43 return JordanAlgebra(A
)
46 def eja_ln(dimension
, field
=QQ
):
48 Return the Jordan algebra corresponding to the Lorenzt "ice cream"
49 cone of the given ``dimension``.
53 This multiplication table can be verified by hand::
56 sage: e0,e1,e2,e3 = J.gens()
72 In one dimension, this is the reals under multiplication::
81 id_matrix
= identity_matrix(field
,dimension
)
82 for i
in xrange(dimension
):
83 ei
= id_matrix
.column(i
)
84 Qi
= zero_matrix(field
,dimension
)
87 Qi
+= diagonal_matrix(dimension
, [ei
[0]]*dimension
)
88 # The addition of the diagonal matrix adds an extra ei[0] in the
89 # upper-left corner of the matrix.
90 Qi
[0,0] = Qi
[0,0] * ~
field(2)
93 A
= FiniteDimensionalAlgebra(QQ
,Qs
,assume_associative
=True)
94 return JordanAlgebra(A
)