#19319: iterator over pairs on diagonals a la Cantor pairing
-------------------------------------+-------------------------------------
Reporter: dkrenn | Owner:
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-6.9
Component: misc | Resolution:
Keywords: | Merged in:
Authors: Daniel Krenn, | Reviewers: Daniel Krenn
Clemens Heuberger | Work issues:
Report Upstream: N/A | Commit:
Branch: | fde8e6d09f41645ec4faf9d071cf60c7b35ef9e3
u/dkrenn/product_cantor_pairing | Stopgaps:
Dependencies: |
-------------------------------------+-------------------------------------
Comment (by vdelecroix):
Replying to [comment:30 cheuberg]:
> Replying to [comment:29 vdelecroix]:
> > What is the point of having it only for pairs? What if I want to
iterate `ZZ x ZZ x ZZ`? Using towers of iterators is definitely not a
solution (hard to write/use and slow).
>
> Short answer: iterating over pairs is what we need right now.
I perfectly understand.
> Iteration over the product of n iterators will, as far as I can see,
always need some recursive algorithm. I do not know whether avoiding
iterators internally would make that much of a difference with respect of
speed; IMHO it will not make it more readable.
Nope. If you look at the code of `product` in Python there is no recursion
involved. It 70 lines long, with a lot of spaces and written in pure C.
> What about replacing `product_cantor_pairing(A, B)` by
`product_cantor_pairing([A, B])` and implementing products of `>= 3`
iterators by a recursive call to `product_cantor_pairing` (and flattening
the results) for the time being?
Is that the canonical order you want for a triple?
--
Ticket URL: <http://trac.sagemath.org/ticket/19319#comment:31>
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.