From: Michael Orlitzky Date: Fri, 10 Apr 2026 13:27:32 +0000 (-0400) Subject: mjo/clan/clan_element.py: fix parent of inner_product() X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=a2b5d0715f3b5324e44047354df0822db28ace1c;p=sage.d.git mjo/clan/clan_element.py: fix parent of inner_product() The inner product of two clan elements should live in the base ring of the clan. --- diff --git a/mjo/clan/clan_element.py b/mjo/clan/clan_element.py index 7c03142..b125d1c 100644 --- a/mjo/clan/clan_element.py +++ b/mjo/clan/clan_element.py @@ -24,6 +24,7 @@ class ClanElement(IndexedFreeModuleElement): SETUP:: + sage: from mjo.clan.random import random_clan sage: from mjo.clan.t_algebra_clan import RealSymmetricClan EXAMPLES: @@ -39,8 +40,18 @@ class ClanElement(IndexedFreeModuleElement): ....: if j == i ) True + TESTS: + + The result should live in the clan's base ring:: + + sage: C = random_clan() + sage: x = C.random_element() + sage: y = C.random_element() + sage: x.inner_product(y) in C.base_ring() + True + """ - return sum( + return self.base_ring().sum( xi*yj*self.parent().inner_product_on_basis(bi, bj) for (bi, xi) in self.items() for (bj, yj) in other.items()