README

NAME

Math::Libgsl::Combination - An interface to libgsl, the Gnu Scientific Library - Combinations.

SYNOPSIS

use Math::Libgsl::Combination;

DESCRIPTION

Math::Libgsl::Combination is an interface to the combination functions of libgsl, the Gnu Scientific Library.

This package provides both the low-level interface to the C library (Raw) and a more comfortable interface layer for the Raku programmer.

new(:k!)

new(k!)

The constructor accepts two parameters: the total number of elements in the set and the number of elements chosen from the set; the parameters can be passed as Pair-s or as single values. The combination object is already initialized in lexicographically first combination, i.e. (0, 1, 2, ā€¦, $k āˆ’ 1).

init(:$start? = TOP)

This method initialize the combination object and returns self. The default is to initialize the object in lexicographically first combination, but by specifying the optional parameter **n āˆ’ n āˆ’ n āˆ’ 1). TOP and BOTTOM are declared as values of the Starting-point enum.

copy($src! where * ~~ Math::Libgsl::Combination)

This method copies the combination $src into the current combination object and returns self.

get(Int $elem! --> Int)

This method returns the combination value at position $elem.

all(--> Seq)

This method returns a Seq of all the elements of the current combination.

size(--> List)

This method returns the (n, k) parameters of the current combination object.

is-valid(--> Bool)

This method checks whether the current combination is valid: the k elements should lie in the range 0 to $n āˆ’ 1, with each value occurring once at most and in increasing order.

next()

prev()

These functions advance or step backwards the combination and return self, useful for method chaining.

bnext(--> Bool)

bprev(--> Bool)

These functions advance or step backwards the combination and return a Bool: True if successful or False if there's no more combination to produce.

write(Str $filename! --> Int)

This method writes the combination data to a file.

read(Str $filename! --> Int)

This method reads the combination data from a file. The combination must be of the same size of the one to be read.

fprintf(Str format! --> Int)

This method writes the combination data to a file, using the format specifier.

fscanf(Str $filename!)

This method reads the combination data from a file. The combination must be of the same size of the one to be read.

C Library Documentation

For more details on libgsl see https://www.gnu.org/software/gsl/. The excellent C Library manual is available here https://www.gnu.org/software/gsl/doc/html/index.html, or here https://www.gnu.org/software/gsl/doc/latex/gsl-ref.pdf in PDF format.

Prerequisites

This module requires the libgsl library to be installed. Please follow the instructions below based on your platform:

Debian Linux and Ubuntu 20.04+

sudo apt install libgsl23 libgsl-dev libgslcblas0

That command will install libgslcblas0 as well, since it's used by the GSL.

Ubuntu 18.04

libgsl23 and libgslcblas0 have a missing symbol on Ubuntu 18.04. I solved the issue installing the Debian Buster version of those three libraries:

Installation

To install it using zef (a module management tool):

$ zef install Math::Libgsl::Combination

AUTHOR

Fernando Santagata [email protected]

COPYRIGHT AND LICENSE

Copyright 2020 Fernando Santagata

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.

Math::Libgsl::Combination v0.0.2

An interface to libgsl, the Gnu Scientific Library - Combinations.

Authors

  • Fernando Santagata

License

Artistic-2.0

Dependencies

Distribution::Builder::MakeFromJSONMath::Libgsl::Constants

Test Dependencies

Provides

  • Math::Libgsl::Combination
  • Math::Libgsl::Raw::Combination

Documentation

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.