Hi All,
I am currently dabbling with the cryptically named WithRealizations code
and I was wondering if some one who is familiar with how this gadget works
would mind giving me a few pointers.
I am implementing an algebra which has two bases F and G. The transition
matrix between these two bases is triangular but to rewrite the G-basis in
terms of the F-basis is recursive and slightly unpleasant. The only way
that I know to write the F-basis in terms of the G-basis is then to
recursively strip off G-basis elements using their leading terms.
My first question is whether it would be more efficient to write the
F-basis to G-basis conversion explicitly or whether the following line
below in red will achieve the same result:
G_to_F = Psi.module_morphism(G._G_to_F_on_basis,
codomain=F,
triangular = 'upper', unitriangular = True,
cmp = self.indices_cmp
)
G_to_F.register_as_coercion()
(~G_to_F).register_as_coercion()
To implement F_to_G by hand I would simply find the leading term indexed by
x, say, strip off G(x) and repeat.
My second question concerns coercion and constructing elements. Initially
I had defined an _element_constructor_ for these bases which did some
pre-processing on their indexing set. This worked fine for constructions
like F(x) and G(x) but it failed for F(G(x)), F(F(x)), ... because I didn't
know how to test to see whether x was an element of the algebra, rather
than an element of the indexing set -- and if it did belong to the algebra
I wasn't sure how to return the element expressed in the right basis.
I initially thought that F(G(x)) would be handled automatically by the
coercion framework but instead G(x) ends up becoming an argument to
_element_constructor_(). Can some one please tell me how the
element_constructor should handle such arguments. If A is the parent
algebra, so that F=A.F() and G=A>G(), then my first hope was that I could
do something like
{{{
if isinstance(x, A): return self(x)
}}}
but I couldn't find the appropriate class to put inside isinstance(). I
also tried things like isinstance(x, F) but I couldn't get this to work
either -- this alternative wouldn't be ideal, however, as I would not want
to check every basis for A in this way (there are several other bases).
I haven't posted my code because the file already quite long and at this
stage it is contains only minimal documentation.
Cheers,
Andrew
--
You received this message because you are subscribed to the Google Groups
"sage-combinat-devel" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/sage-combinat-devel/-/jW_ZLQ8gLLAJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-combinat-devel?hl=en.