#16935: Faster palindromes function for the Words library
-------------------------------------+-------------------------------------
Reporter: nadialafreniere | Owner:
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-6.4
Component: combinatorics | Resolution:
Keywords: words, finite | Merged in:
words, palindromes | Reviewers:
Authors: Nadia Lafrenière | Work issues:
Report Upstream: N/A | Commit:
Branch: | d535b5f2f292d83d1dc952023dffe5506dd8f7f9
u/nadialafreniere/palindromes__list_of_lps_lengths_and_list_of_maximal_palindromes_length|
Stopgaps:
Dependencies: |
-------------------------------------+-------------------------------------
Comment (by slabbe):
Great. I think we are almost done now. I just looked at the code. Here are
some more fixes to do. Tomorrow (or the day after) after you do the below
changes, I will review everything again (doctests, documentation building
fine, etc).
1. The call to Integer is not necessary in the first method (sorry my
bad):
{{{
#!diff
- return Integer(jj - 2*i - 1)
+ return jj - 2*i - 1
}}}
2. (bis) There should be an empty line after OUTPUT. The reason is that
without the empty line, the documentation will not build correctly. You
may try to check how it looks on a method of an object by doing this (I do
not known if this still works) :
{{{
sage: m = matrix(2, range(4))
sage: browse_sage_doc(m.inverse)
}}}
3. spaces:
{{{
#!diff
- if LPC[k]+k-j != LPC[2*k - j]:
+ if LPC[k] + k - j != LPC[2*k - j]:
}}}
4. remove empty lines:
{{{
#!diff
-
- k = 0
-
+ k = 0
}}}
5. The creation of the list is not necessary:
{{{
#!diff
- return set([self[i-LPS[i] : i] for i in range(len(self)+1)])
+ return set(self[i-LPS[i] : i] for i in range(len(self)+1))
}}}
--
Ticket URL: <http://trac.sagemath.org/ticket/16935#comment:30>
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.