r1374 - packages/libmath-combinatorics-perl/trunk/lib/Math
Carlo Segre
segre-guest at costa.debian.org
Thu Sep 22 13:12:24 UTC 2005
Author: segre-guest
Date: 2005-09-22 13:12:23 +0000 (Thu, 22 Sep 2005)
New Revision: 1374
Modified:
packages/libmath-combinatorics-perl/trunk/lib/Math/Combinatorics.pm
Log:
Modified the man page entries to avoid ugly line wraps
Modified: packages/libmath-combinatorics-perl/trunk/lib/Math/Combinatorics.pm
===================================================================
--- packages/libmath-combinatorics-perl/trunk/lib/Math/Combinatorics.pm 2005-09-22 12:30:44 UTC (rev 1373)
+++ packages/libmath-combinatorics-perl/trunk/lib/Math/Combinatorics.pm 2005-09-22 13:12:23 UTC (rev 1374)
@@ -188,9 +188,10 @@
Usage : my @combinations = combine($k, at n);
Function: implements nCk (n choose k), or n!/(k!*(n-k!)).
- returns all unique unorderd combinations of k items from set n.
- items in n are assumed to be character data, and are
- copied into the return data structure (see "Returns" below).
+ returns all unique unorderd combinations of k items from
+ set n. items in n are assumed to be character data, and
+ are copied into the return data structure (see "Returns"
+ below).
Example : my @n = qw(a b c);
my @c = combine(2, at n);
print join "\n", map { join " ", @$_ } @c;
@@ -198,14 +199,15 @@
# b c
# a c
# a b
- Returns : a list of arrays, where each array contains a unique combination
- of k items from n
+ Returns : a list of arrays, where each array contains a unique
+ combination of k items from n
Args : a list of items to be combined
- Notes : data is internally assumed to be alphanumeric. this is necessary
- to efficiently generate combinations of large sets. if you need
- combinations of non-alphanumeric data, or on data
- C<sort {$a cmp $b}> would not be appropriate, use the
- object-oriented API. See L</new()> and the B<compare> option.
+ Notes : data is internally assumed to be alphanumeric. this is
+ necessary to efficiently generate combinations of large
+ sets. if you need combinations of non-alphanumeric data,
+ or on data C<sort {$a cmp $b}> would not be appropriate,
+ use the object-oriented API. See L</new()> and the
+ B<compare> option.
=cut
@@ -246,11 +248,12 @@
Note : k should really be parameterizable. this will happen
in a later version of the module. send me a patch to
make that version come out sooner.
- Notes : data is internally assumed to be alphanumeric. this is necessary
- to efficiently generate combinations of large sets. if you need
- combinations of non-alphanumeric data, or on data
+ Notes : data is internally assumed to be alphanumeric. this is
+ necessary to efficiently generate combinations of large sets.
+ if you need combinations of non-alphanumeric data, or on data
C<sort {$a cmp $b}> would not be appropriate, use the
- object-oriented API. See L</new()>, and the B<compare> option.
+ object-oriented API. See L</new()>, and the B<compare>
+ option.
=cut
@@ -301,13 +304,16 @@
);
Function: build a new Math::Combinatorics object.
Returns : a Math::Combinatorics object
- Args : count - required for combinatoric functions/methods. number of elements to be
- present in returned set(s).
- data - required for combinatoric B<AND> permutagenic functions/methods. this is the
- set elements are chosen from. B<NOTE>: this array is modified in place; make
- a copy of your array if the order matters in the caller's space.
- frequency - optional vector of data frequencies. must be the same length as the B<data>
- constructor argument. These two constructor calls here are equivalent:
+ Args : count - required for combinatoric functions/methods.
+ number of elements to be present in returned set(s).
+ data - required for combinatoric B<AND> permutagenic
+ functions/methods. this is the set elements are
+ chosen from. B<NOTE>: this array is modified in
+ place; make a copy of your array if the order matters
+ in the caller's space.
+ frequency - optional vector of data frequencies. must be the same
+ length as the B<data> constructor argument. These two
+ constructor calls here are equivalent:
$a = 'a';
$b = 'b';
@@ -315,9 +321,11 @@
Math::Combinatorics->new( count=>2, data=>[\$a,\$a,\$a,\$a,\$a,\$b,\$b] );
Math::Combinatorics->new( count=>2, data=>[\$a,\$b], frequency=>[5,2] );
- so why use this? sometimes it's useful to have multiple identical entities in
- a set (in set theory jargon, this is called a "bag", See L<Set::Bag>).
- compare - optional subroutine reference used in sorting elements of the set. examples:
+ so why use this? sometimes it's useful to have
+ multiple identical entities in a set (in set theory
+ jargon, this is called a "bag", See L<Set::Bag>).
+ compare - optional subroutine reference used in sorting elements
+ of the set. examples:
#appropriate for character elements
compare => sub { $_[0] cmp $_[1] }
@@ -370,9 +378,10 @@
Usage : my @combo = $c->next_combination();
Function: get combinations of size $count from @data.
- Returns : returns a combination of $count items from @data (see L</new()>).
- repeated calls retrieve all unique combinations of $count elements.
- a returned empty list signifies all combinations have been iterated.
+ Returns : returns a combination of $count items from @data
+ (see L</new()>). repeated calls retrieve all unique
+ combinations of $count elements. a returned empty list
+ signifies all combinations have been iterated.
Args : none.
=cut
@@ -446,8 +455,9 @@
Usage : my @permu = $c->next_permutation();
Function: get permutations of elements in @data.
Returns : returns a permutation of items from @data (see L</new()>).
- repeated calls retrieve all unique permutations of @data elements.
- a returned empty list signifies all permutations have been iterated.
+ repeated calls retrieve all unique permutations of @data
+ elements. a returned empty list signifies all permutations
+ have been iterated.
Args : none.
=cut
@@ -502,7 +512,8 @@
=head2 sum()
Usage : my $sum = sum(1,2,3); # returns 6
- Function: sums a list of integers. non-integer list elements are ignored
+ Function: sums a list of integers. non-integer list elements are
+ ignored
Returns : sum of integer items in arguments passed in
Args : a list of integers
Note : this function is used internally by combine()
More information about the Pkg-perl-cvs-commits
mailing list