.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Math::GSL::Multiset 3pm" .TH Math::GSL::Multiset 3pm 2024-03-07 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Math::GSL::Multiset \- Multisets manipulation .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& 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(); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" 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. .SS "Object Oriented API" .IX Subsection "Object Oriented API" Handy Perl-style OO API for Multisets. .ie n .IP """new""" 4 .el .IP \f(CWnew\fR 4 .IX Item "new" Creates a new multiset with parameters n, k and initializes it to the lexicographically first multiset element, i.e., 0 repeated k times. .Sp .Vb 1 \& my $ms = Math::GSL::Multiset\->($n, $k); .Ve .ie n .IP """init_first""" 4 .el .IP \f(CWinit_first\fR 4 .IX Item "init_first" Initializes the multiset to the lexicographically first multiset element, i.e. 0 repeated k times. .Sp .Vb 1 \& $ms\->init_first; .Ve .ie n .IP """init_last""" 4 .el .IP \f(CWinit_last\fR 4 .IX Item "init_last" Initializes the multiset c to the lexicographically last multiset element, i.e. n\-1 repeated k times. .Sp .Vb 1 \& $ms\->init_last; .Ve .ie n .IP """get""" 4 .el .IP \f(CWget\fR 4 .IX Item "get" Returns the value of the i\-th element of the multiset. If i lies outside the allowed range of 0 to k\-1 then the error handler is invoked and 0 is returned. .Sp .Vb 1 \& my $val = $ms\->get($k\-1); .Ve .ie n .IP """next""" 4 .el .IP \f(CWnext\fR 4 .IX Item "next" Advances the multiset to the next multiset element in lexicographic order and returns GSL_SUCCESS. If no further multisets elements are available it returns GSL_FAILURE and leaves the multiset unmodified. Starting with the first multiset and repeatedly applying this function will iterate through all possible multisets of a given order. .Sp .Vb 1 \& $ms\->next(); .Ve .ie n .IP """prev""" 4 .el .IP \f(CWprev\fR 4 .IX Item "prev" .Vb 1 \& $ms\->prev(); .Ve .Sp 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. .ie n .IP """to_list""" 4 .el .IP \f(CWto_list\fR 4 .IX Item "to_list" Creates a Perl list of integers with the values from the multiset, starting at index 0 and ending at index \f(CW$k\fR\-1. .Sp .Vb 1 \& @data = $ms\->to_list; .Ve .ie n .IP """clone""" 4 .el .IP \f(CWclone\fR 4 .IX Item "clone" Creates a new multiset with the same size, and same values. .Sp .Vb 1 \& my $new = $ms\->clone; .Ve .SS "GSL API" .IX Subsection "GSL API" For reference on these methds, please consult the GSL documentation. .ie n .IP """gsl_multiset_calloc""" 4 .el .IP \f(CWgsl_multiset_calloc\fR 4 .IX Item "gsl_multiset_calloc" .PD 0 .ie n .IP """gsl_multiset_alloc""" 4 .el .IP \f(CWgsl_multiset_alloc\fR 4 .IX Item "gsl_multiset_alloc" .ie n .IP """gsl_multiset_init_first""" 4 .el .IP \f(CWgsl_multiset_init_first\fR 4 .IX Item "gsl_multiset_init_first" .ie n .IP """gsl_multiset_init_last""" 4 .el .IP \f(CWgsl_multiset_init_last\fR 4 .IX Item "gsl_multiset_init_last" .ie n .IP """gsl_multiset_free""" 4 .el .IP \f(CWgsl_multiset_free\fR 4 .IX Item "gsl_multiset_free" .ie n .IP """gsl_multiset_memcpy""" 4 .el .IP \f(CWgsl_multiset_memcpy\fR 4 .IX Item "gsl_multiset_memcpy" .ie n .IP """gsl_multiset_get""" 4 .el .IP \f(CWgsl_multiset_get\fR 4 .IX Item "gsl_multiset_get" .ie n .IP """gsl_multiset_n""" 4 .el .IP \f(CWgsl_multiset_n\fR 4 .IX Item "gsl_multiset_n" .ie n .IP """gsl_multiset_k""" 4 .el .IP \f(CWgsl_multiset_k\fR 4 .IX Item "gsl_multiset_k" .ie n .IP """gsl_multiset_data""" 4 .el .IP \f(CWgsl_multiset_data\fR 4 .IX Item "gsl_multiset_data" .ie n .IP """gsl_multiset_valid""" 4 .el .IP \f(CWgsl_multiset_valid\fR 4 .IX Item "gsl_multiset_valid" .ie n .IP """gsl_multiset_next""" 4 .el .IP \f(CWgsl_multiset_next\fR 4 .IX Item "gsl_multiset_next" .ie n .IP """gsl_multiset_prev""" 4 .el .IP \f(CWgsl_multiset_prev\fR 4 .IX Item "gsl_multiset_prev" .ie n .IP """gsl_multiset_fwrite""" 4 .el .IP \f(CWgsl_multiset_fwrite\fR 4 .IX Item "gsl_multiset_fwrite" .ie n .IP """gsl_multiset_fread""" 4 .el .IP \f(CWgsl_multiset_fread\fR 4 .IX Item "gsl_multiset_fread" .ie n .IP """gsl_multiset_fprintf""" 4 .el .IP \f(CWgsl_multiset_fprintf\fR 4 .IX Item "gsl_multiset_fprintf" .ie n .IP """gsl_multiset_fscanf""" 4 .el .IP \f(CWgsl_multiset_fscanf\fR 4 .IX Item "gsl_multiset_fscanf" .PD .SH AUTHORS .IX Header "AUTHORS" Jonathan "Duke" Leto and Thierry Moisan .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" Copyright (C) 2008\-2023 Jonathan "Duke" Leto and Thierry Moisan .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.