Math::Combinatorics v.0.09

Math::Combinatorics is a Perl module that can perform combinations and permutations on lists. SYNOPSIS Available as an object oriented API. use Math::Combinatorics, my @n = qw(a b c), my $combinat = Math::Combinatorics->new(count => 2, data => [@n], ), print "combinations of 2 from: ".join(" ",@n)."n", print "------------------------".("--" x scalar(@n))."n", while(my @combo = $combinat->next_combination){ print join( , @combo)."n", } print "n", print "permutations of 3 from: ".join(" ",@n)."n", print "------------------------".("--" x scalar(@n))."n", while(my @permu = $combinat->next_permutation){ print join( , @permu)."n", } output: Or available via exported functions permute, combine, and factorial. use Math::Combinatorics, my @n = qw(a b c), print "combinations of 2 from: ".join(" ",@n)."n", print "------------------------".("--" x scalar(@n))."n", print join("n", map { join " ", @$_ } combine(2,@n)),"n", print "n", print "permutations of 3 from: ".join(" ",@n)."n", print "------------------------".("--" x scalar(@n))."n", print join("n", map { join " ", @$_ } permute(@n)),"n", Output: combinations of 2 from: a b c ------------------------------ a b a c b c permutations of 3 from: a b c ------------------------------ a b c a c b b a c b c a c a b c b a Output from both types of calls is the same, but the object-oriented approach consumes much less memory for large sets.

Math::Combinatorics is a Perl module that can perform combinations and permutations on lists. SYNOPSIS Available as an object oriented API. use Math::Combinatorics, my @n = qw(a b c), my $combinat = Math::Combinatorics->new(count => 2, data

 
  • Math::Combinatorics
  • 0.09
  • Allen Day
  • Any Platform
  • Perl Artistic
  • 10 Kb
  • 1
 
 

Review Math::Combinatorics

  • captcha
 

Other software of Allen Day
  • Bio::Graphics::Glyph::alignment  v.1.4Bio::Graphics::Glyph::alignment is the "alignment" glyph. SYNOPSIS See L< Bio::Graphics::Panel > and L< Bio::Graphics::Glyph >. This is identical to the "graded_segments" glyph, and is used for drawing features that consist of discontinuous
  • Bio::OntologyIO::simplehierarchy  v.1.4Bio::OntologyIO::simplehierarchy is a base class parser for simple hierarchy-by-indentation type formats. SYNOPSIS use Bio::OntologyIO, # do not use directly -- use via Bio::OntologyIO my $parser = Bio::OntologyIO->new ( -format =>
  • FFmpeg::FileFormat  v.6036FFmpeg::FileFormat is a multimedia file format supported by FFmpeg (eg avi, mov, mpeg, mp3, &c). SYNOPSIS $ff = FFmpeg->new(), #see FFmpeg $xx = $ff->file_format(mov), #...do something with $xx Objects of this class are not intended to be

New Components & Libraries software
  • .Net Grid  v.2.8.0.Net Grid. Hierarchical data binding, drag&drop, grouping, serialization, cell editors, custom drawing, cell tooltips, threadsafety. Realtime filtering, regrouping, multiple sorting, cell highlighting. Performance: 50000 upd/sec, 16MB/100000 rows
  • DC Form Translator  v.3.71Form Translator gives you multi-language functionality. It works by taking your original form and translating the code into several languages. That means you only need to write one program, rather than recoding and redesigning with every version.