#15609: IntegerVectors_nk.rank() specialization
-------------------------------------+-------------------------------------
Reporter: f.poloni | Owner:
Type: enhancement | Status: needs_work
Priority: trivial | Milestone: sage-6.1
Component: combinatorics | Resolution:
Keywords: integervectors, | Merged in:
rank | Reviewers:
Authors: Federico Poloni | Work issues:
Report Upstream: N/A | Commit:
Branch: | f616301fefa44762f90fe7cc54aab3d78d842b9e
u/f.poloni/ticket/15609 | Stopgaps:
Dependencies: |
-------------------------------------+-------------------------------------
Changes (by ncohen):
* status: needs_review => needs_work
Comment:
Hellooooooooooooooo Federico !
Well, I don't know what you went through, but the patch looks nice in the
end `;-)`
It's a cool improvement, and it is well documented and tested. I have only
one thing to add :
{{{
sage: IV = IntegerVectors(4,5)
sage: IV.rank((0,0,4,0,0))
55
sage: IV.rank((0,1,-1,4,0))
55
}}}
That's because you check manually whether the given vector belongs to `IV`
instead of using the `__contains__` method, i.e. `x in self`.
The problem with this `x in self` is that it also computes the sum of the
vector, and that you will compute it a second time in your function
because you need it too. But that may not be soooo troublesome anyway,
it's not that costly. Especially compared with the current implementation.
Could you fix that ? Also, could you replace
{{{- ``x`` - any sequence with sum(x) == n and len(x) == k}}} i
n the docstring with that ?
{{{- ``x`` - any sequence with ``sum(x) == n`` and ``len(x) == k``}}}
This way it will all appear properly in the html documentation. Which you
can obtain with {{{sage -b && sage -docbuild reference/combinat html}}}
Thanks !
Nathann
--
Ticket URL: <http://trac.sagemath.org/ticket/15609#comment:4>
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/groups/opt_out.