|
Boost : |
From: Hervé Brönnimann (hervebronnimann_at_[hidden])
Date: 2007-11-13 07:33:17
Jens: It is possible to specify r == 0 or r == n in the
combinations. Definitely. "a middle position in the input
range [first, last)" can refer to last, same as inserting at a
position in a vector can be begin(), end(), or anything in between.
Although it is not very interesting (only one combination in the case
r == n), it's not a reason to disallow it. The doc can point that
out in passing, though, so I'll add a note. Examples would also help.
The sentence you don't understand can be improved, and k should be
r. What can be sorted is: Permutations and combinations. i.e., the
(unsorted: for permutations, sorted: for combinations) subsequences
of length r. I'll work on a better sentence.
Examples are sorely needed, but I wanted to get Ben to start thinking
first. and save him time. Definitely examples would/should explain a
lot more. I'll be working on those too.
Thanks for your comments, let's work together to make this into a
solid proposal.
--HB
On Nov 13, 2007, at 5:46 AM, Jens Seidel wrote:
> On Tue, Nov 13, 2007 at 04:33:51PM +0800, Ben Bear wrote:
>> 2007/11/13, Hervé Brönnimann <hervebronnimann_at_[hidden]>:
>>> coherent interfaces. Please look at:
>>>
>>> http://photon.poly.edu/~hbr/boost/combinations.html
>>
>> I'll read this proposal. It's a little long for me.
>
> I did so already and found two minor issue:
>
> To get all (n,r) combinations I have to specify r as value "middle".
> According to the document it is possible to specify r=0 but not r=n?
> ("Without repetitions, r is specified by a middle position in the
> input
> range [first, last) which is r positions away from first.") If r=n is
> possible, middle=last would be a valid choice ==> [first, last)=>
> [first,
> last].
>
> I also do not understand
> "Permutations and combinations can be ordered lexicographically,
> starting with the subset at the first k positions of the sorted total
> range, and ending with the subset at the last k positions of the same
> range. Thus the effects of the algorithms are completely and
> unambiguously defined."
>
> What can be sorted? The elements of each r-tuple or do you want to say
> that all determined permutations and combinations are sorted (provided
> in a special order)?
>
> Probably you want to use r instead of k in the text above? I first
> thougth that I can get all values in a single r-tuple unsorted by
> specifying a parameter k=0 and wondered that it affects the beginning
> and end of some data.
>
> Could you please try to improve it a little bit? Maybe by giving some
> examples in the documentation?
>
> Thanks,
> Jens
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/
> listinfo.cgi/boost
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk