#13580: Parallel map reduce on SearchForest
-------------------------------------+-------------------------------------
Reporter: hivert | Owner: hivert
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-6.4
Component: combinatorics | Resolution:
Keywords: map-reduce, | Merged in:
days57 | Reviewers:
Authors: Florent Hivert, | Work issues:
Nathann Cohen | Commit:
Report Upstream: N/A | 14b086beac66e6a3fe3bf6be2cd7ae0e28c20152
Branch: | Stopgaps:
u/hivert/13580/map_reduce |
Dependencies: |
-------------------------------------+-------------------------------------
Comment (by slabbe):
Dear Florent, I know that you like multiline doctests, but for two reasons
I prefer to avoid them as much as possible in doctests:
1. It is not fun for the user who wants to adapt an example after a copy
paste in the console. The up arrow brings the multiline all at once and it
is not fun to change the value 10 to a value 25 let say.
2. Using variables to store the input before calling the method gives lot
of information easily to the user: what are the argument names, in what
order should they be used.
I know I am asking you to change your style by asking you this, but don't
you agree with me or can you provide some counter-arguments to mine? I
give an example below:
{{{
#!diff
diff --git a/src/sage/combinat/backtrack.py
b/src/sage/combinat/backtrack.py
index 9dee057..ac1243a 100644
--- a/src/sage/combinat/backtrack.py
+++ b/src/sage/combinat/backtrack.py
@@ -695,17 +695,19 @@ class SearchForest(Parent):
reduce_function = None,
reduce_init = None):
r"""
- Apply en Map Reduce algorithm on ``self``
+ Apply a Map Reduce algorithm on ``self``
EXAMPLES::
- sage: F = RecursivelyEnumeratedSet( [([i],i, i) for i in
range(1,10)],
- ....: lambda (list, sum, last):
- ....: [(list + [i], sum + i, i) for i in
range(1,last)],
- ....: structure='forest', enumeration='depth')
+ sage: seeds = [([i],i, i) for i in range(1,10)]
+ sage: succ = lambda (list, sum, last): [(list + [i], sum + i,
i) for i in range(1,last)]
+ sage: F = RecursivelyEnumeratedSet(seeds, succ,
structure='forest', enumeration='depth')
sage: y = var('y')
- sage: F.map_reduce(
- ....: lambda (li, sum, _): y**sum, lambda x,y: x + y, 0
)
+ sage: map_function = lambda (li, sum, _): y**sum
+ sage: reduce_function = lambda x,y: x + y
+ sage: F.map_reduce(map_function, reduce_function, 0)
y^45 + y^44 + y^43 + 2*y^42 + 2*y^41 + 3*y^40 + 4*y^39 +
5*y^38 + 6*y^37 + 8*y^36 + 9*y^35
.. SEEALSO:: :mod:`sage.parallel.map_reduce`
}}}
I noticed another typo on the same line as the one {{{parameters tu the}}}
: {{{On}}} -> {{{One}}}
--
Ticket URL: <http://trac.sagemath.org/ticket/13580#comment:35>
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 https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.