will be needed to get the actual matrix.
"""
return self.parent()._vector_space.sum_of_terms(self.items())
+
+
+ def inner_product(self, other):
+ r"""
+ The inner product of this element with ``other``.
+
+ EXAMPLES:
+
+ In the clan of real symmetric matrices under the Ishi norm,
+ it is easy to check that the idempotents all have norm 1/2::
+
+ sage: from mjo.clan.unital_clan import SnClan
+ sage: C = SnClan(3)
+ sage: all( e_ii.inner_product(e_ii) == 1/2
+ ....: for i in range(C.rank())
+ ....: if (e_ii := C.basis()[(i,i)]) )
+ True
+
+ """
+ return sum(
+ xi*yj*self.parent().inner_product_on_basis(bi, bj)
+ for (bi, xi) in self.items()
+ for (bj, yj) in other.items()
+ )
for j in basis.keys() }
for i in basis.keys() }
+ # And inner product table. We assume the supplied inner
+ # product is symmetric.
+ self._ipt = { i: { j : inner_product(basis[i], basis[j])
+ for j in basis.keys() if j <= i }
+ for i in basis.keys() }
+
# Use the vector_space basis keys so we can convert
# easily between them.
CombinatorialFreeModule.__init__(self,
return None
+ def inner_product_on_basis(self, i, j):
+ r"""
+ Return the inner product of the `i` and `j`th basis elements.
+
+ This completely defines the inner product.
+ """
+ if j <= i:
+ return self._ipt[i][j]
+ else:
+ return self._ipt[j][i]
+
+
def product_on_basis(self, i, j):
r"""
Returns the Jordan product of the `i` and `j`th basis elements.
"""
return self._mt[i][j]
+
def rank(self) -> int:
r"""
The rank of this clan. Not implemented by default,
class SnClan(UnitalClan):
r"""
- The clan of real symmetric matrices of a given size with the
- clan product and lower-triangular basis ordering of Ishi,
- based on the up-hat and down-hat products of Vinberg.
+ The normally-decomposed clan of real symmetric matrices of a
+ given size with the clan product and lower-triangular basis
+ ordering of Ishi, based on the up-hat and down-hat products of
+ Vinberg.
EXAMPLES:
def __init__(self, n, scalar_field=QQ, **kwargs):
self._rank = n
+ from sage.matrix.matrix_space import MatrixSpace
Mn = MatrixSpace(scalar_field, n)
b = Mn.basis()
"""
return f"Clan S^{self.rank()} over {self._vector_space().base_ring()}"
+
+
+ def one(self):
+ r"""
+ Return the unit element of this clan.
+
+ EXAMPLES::
+
+ sage: C = SnClan(4)
+ sage: I = C.one()
+ sage: I.lift().lift()
+ [1 0 0 0]
+ [0 1 0 0]
+ [0 0 1 0]
+ [0 0 0 1]
+ sage: all( I*b == b and b*I == b for b in C.basis() )
+ True
+
+ """
+ return sum( self.basis()[i,i] for i in range(self.rank()) )