Math::GSL::Multiset(3pm) | User Contributed Perl Documentation | Math::GSL::Multiset(3pm) |
Math::GSL::Multiset - Multisets manipulation
use Math::GSL::Multiset qw/:all/; my $ms = Math::GSL::Multiset->($n, $k); my $value = $ms->get(2); # compute next multiset $ms->next; # compute the previous multiset # clone a multiset my $other = $ms->clone();
A multiset c is represented by an array of k integers in the range 0 to n-1, where each value c_i may occur more than once. The multiset c corresponds to indices of k elements chosen from an n element vector with replacement. In mathematical terms, n is the cardinality of the multiset while k is the maximum multiplicity of any value.
Handy Perl-style OO API for Multisets.
my $ms = Math::GSL::Multiset->($n, $k);
$ms->init_first;
$ms->init_last;
my $val = $ms->get($k-1);
$ms->next();
$ms->prev();
Steps backwards from the multiset to the previous multiset element in lexicographic order, returning GSL_SUCCESS. If no previous multiset is available it returns GSL_FAILURE and leaves the multiset unmodified.
@data = $ms->to_list;
my $new = $ms->clone;
For reference on these methds, please consult the GSL documentation.
Jonathan "Duke" Leto <jonathan@leto.net> and Thierry Moisan <thierry.moisan@gmail.com>
Copyright (C) 2008-2020 Jonathan "Duke" Leto and Thierry Moisan
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
2020-11-09 | perl v5.32.0 |