#17186: LatticePoset: faster is_modular
-------------------------------------+-------------------------------------
Reporter: jmantysalo | Owner:
Type: enhancement | Status: positive_review
Priority: minor | Milestone: sage-6.4
Component: combinatorics | Resolution:
Keywords: | Merged in:
Authors: Jori Mäntysalo | Reviewers: Nathann Cohen
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/jmantysalo/latticeposet__faster_is_modular|
3ca400619ffcac9c7bdb5f045f1b0d656fc32bf3
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by tscrim):
Two very minor things that if you don't want to change, you don't have to.
1 - Instead of a comment, I'd put the reference in the docstring
{{{
ALGORITHM:
Based on pp. 286-287 of Enumerative Combinatorics, Vol 1 [EnumComb1]_.
}}}
perhaps with some detail of the algorithm.
2 - Use `all`. It could be (marginally) faster, and makes it a little
easier to read IMO.
{{{#!diff
- for a in range(0, n):
- for b in range(a+1, n):
- if ( H._rank_dict[a]+H._rank_dict[b] !=
- H._rank_dict[H._meet[a,b]] + H._rank_dict[H._join[a,b]] ):
- return False
- return True
+ return all(H._rank_dict[a] + H._rank_dict[b]
+ == H._rank_dict[H._meet[a,b]] + H._rank_dict[H._join[a,b]]
+ for a in range(n) for b in range(a+1, n))
}}}
--
Ticket URL: <http://trac.sagemath.org/ticket/17186#comment:16>
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.