#18940: Polynomials ignore the step argument in __getitem__
-------------------------------------+-------------------------------------
Reporter: pbruin | Owner:
Type: defect | Status: needs_info
Priority: major | Milestone: sage-6.10
Component: algebra | Resolution:
Keywords: | Merged in:
Authors: Peter Bruin | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/pbruin/18940-getitem_step | 1c56779b3140d12fbe5d0973cdcad0ac9dbb8054
Dependencies: #19409 | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by jdemeyer):
A new idea, let's call it '''double slicing'''. The argument to
`__getitem__` can be a pair of slices `i, j`, where the slice `i` is used
to define the coefficients and the second slice `j` is used to define the
exponents. It would allow for example:
{{{
sage: pol = PolynomialRing(QQ, 'x')(range(10))
sage: pol[:, ::2]
9*x^18 + 8*x^16 + 7*x^14 + 6*x^12 + 5*x^10 + 4*x^8 + 3*x^6 + 2*x^4 + x^2
sage: pol[:5, 100:]
4*x^104 + 3*x^103 + 2*x^102 + x^101
}}}
We could define shorthands `pol[i]` equivalent to `pol[i, i]` for degree-
keeping slicing and `pol[i,]` equivalent to `pol[i, :]` for degree-
reducing slicing.
This would be very general and cover all possible use-cases. The question
is: is it over-engineered? Do we really need this?
--
Ticket URL: <http://trac.sagemath.org/ticket/18940#comment:40>
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/d/optout.