#17436: fix bug with leading zeros in Necklaces
-------------------------------------+-------------------------------------
Reporter: zabrocki | Owner:
Type: defect | Status: needs_review
Priority: major | Milestone: sage-6.5
Component: combinatorics | Resolution:
Keywords: necklace, Lyndon | Merged in:
words | Reviewers: Travis Scrimshaw
Authors: Mike Zabrocki | Work issues:
Report Upstream: N/A | Commit:
Branch: | 0329a5afced3c0e20c665c663d6d36824ab1c966
public/ticket/17436/tscrim/necklaces| Stopgaps:
Dependencies: |
-------------------------------------+-------------------------------------
Changes (by tscrim):
* commit: f6fd71690bfe05bd1e4a127d7b062941275070bf =>
0329a5afced3c0e20c665c663d6d36824ab1c966
* branch: public/ticket/17436/zabrocki/necklaces =>
public/ticket/17436/tscrim/necklaces
* reviewer: => Travis Scrimshaw
Old description:
> Leading zeros in the input are not currently handled properly in
> `Necklaces`. This was already corrected in `LyndonWords` in #12997 which
> calls the code in necklace.py and removes leading zeros.
>
> The documentation in necklace.py should also be cleaned up to current
> standards.
New description:
Leading zeros in the input are not currently handled properly in
`Necklaces`. This was already corrected in `LyndonWords` in #12997 which
calls the code in necklace.py and removes leading zeros.
The documentation in necklace.py should also be cleaned up to current
standards and some small trivial speedups done.
--
Comment:
Looks good overall. I made some additional doc tweaks and some
(micro-)optimizations:
{{{
sage: x = 0
sage: %timeit if not x: pass
10000000 loops, best of 3: 105 ns per loop
sage: %timeit if x: pass
10000000 loops, best of 3: 89.7 ns per loop
sage: %timeit if x == 0: pass
1000000 loops, best of 3: 429 ns per loop
sage: %timeit if x != 0: pass
1000000 loops, best of 3: 418 ns per loop
sage: x = int(0)
sage: %timeit if not x: pass
10000000 loops, best of 3: 105 ns per loop
sage: %timeit if x: pass
10000000 loops, best of 3: 89.7 ns per loop
sage: y = int(0)
sage: %timeit if x != y: pass
10000000 loops, best of 3: 141 ns per loop
sage: %timeit if x == y: pass
10000000 loops, best of 3: 158 ns per loop
}}}
(similar timings for the list comparisons). Most importantly, I deprecated
the `e` attribute and changed `content` into a method calling `_content`
attribute (since it is suppose to be immutable). If you're happy with my
changes, then positive review.
----
New commits:
||[http://git.sagemath.org/sage.git/commit/?id=8e3bb6deae281ec575488e024d0cf8f22e8514de
8e3bb6d]||{{{Some additional doc tweaks and (micro-)optimizations.}}}||
||[http://git.sagemath.org/sage.git/commit/?id=0329a5afced3c0e20c665c663d6d36824ab1c966
0329a5a]||{{{Made e deprecated.}}}||
--
Ticket URL: <http://trac.sagemath.org/ticket/17436#comment:6>
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.