#15820: Implement sequences of bounded integers
--------------------------------------------+------------------------
Reporter: SimonKing | Owner:
Type: enhancement | Status: new
Priority: major | Milestone: sage-6.2
Component: algebra | Resolution:
Keywords: sequence bounded integer | Merged in:
Authors: | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
--------------------------------------------+------------------------
Comment (by SimonKing):
Hi Nathann,
Replying to [comment:19 ncohen]:
> I also wonder (because I hate them) how much time is spent dealing with
parents.
Well, at some point parents ''have'' to come into play, namely when I want
to implement not just sequences of bounded integers, but elements of the
path semigroup of a quiver.
The strategical question is: Should the data defining a path be stored in
an attribute of that path (the attribute would be an instance of
`BoundedIntegerSequence`), or should the path itself be an instance of
`BoundedIntegerSequence`? In the former case, it would be perfectly fine
to have sequences of bounded integers parent-less; but I worry about an
overhead of accessing the attribute. In the latter case,
`BoundedIntegerSequence` should already be a sub-class of
`sage.structure.element.Element` (and have a parent), since Cython does
not allow multiple inheritance.
I tend to the latter solution also for a different reason: Instances of
`BoundedIntegerSequence` have to know the bound for their elements,
because the data storage depends on that bound. For efficiency (see
attachment), several other constants are derived from that bound, and used
in the algorithms.
Should each instance of `BoundedIntegerSequence` know about all these
bounds? Or should there be a common parent for all sequences of integers
that are bounded by a number B?
I tend to the latter. If you assign ''several'' ints (the afore-mentioned
constants) to an instance of `BoundedIntegerSequence`, it will likely be
more time consuming (during initialisation) than to store just a single
data (namely the parent).
That said, looking up the constants via the parent would be more time-
consuming than looking up constants that are stored directly in the
element.
Difficult....
--
Ticket URL: <http://trac.sagemath.org/ticket/15820#comment:20>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.