+
+
+ def spectral_decomposition(self):
+ """
+ Return the spectral decomposition of this operator as a list of
+ (eigenvalue, orthogonal projector) pairs.
+
+ SETUP::
+
+ sage: from mjo.eja.eja_algebra import RealSymmetricEJA
+
+ EXAMPLES::
+
+ sage: J = RealSymmetricEJA(4,AA)
+ sage: x = sum(J.gens())
+ sage: A = x.subalgebra_generated_by(orthonormalize_basis=True)
+ sage: L0x = A(x).operator()
+ sage: Ps = [ P*l for (l,P) in L0x.spectral_decomposition() ]
+ sage: Ps[0] + Ps[1] == L0x
+ True
+
+ """
+ if not self.matrix().is_symmetric():
+ raise ValueError('algebra basis is not orthonormal')
+
+ D,P = self.matrix().jordan_form(subdivide=False,transformation=True)
+ eigenvalues = D.diagonal()
+ us = P.columns()
+ projectors = []
+ for i in range(len(us)):
+ # they won't be normalized, but they have to be
+ # for the spectral theorem to work.
+ us[i] = us[i]/us[i].norm()
+ mat = us[i].column()*us[i].row()
+ Pi = FiniteDimensionalEuclideanJordanAlgebraOperator(
+ self.domain(),
+ self.codomain(),
+ mat)
+ projectors.append(Pi)
+ return zip(eigenvalues, projectors)