Struct rgsl::types::multiset::MultiSet
[−]
[src]
pub struct MultiSet { /* fields omitted */ }
Methods
impl MultiSet
[src]
fn new(n: usize, k: usize) -> Option<MultiSet>
This function allocates memory for a new multiset with parameters n, k. The multiset is not initialized and its elements are undefined. Use the function gsl_multiset_calloc if you want to create a multiset which is initialized to the lexicographically first multiset element. A null pointer is returned if insufficient memory is available to create the multiset.
fn new_init(n: usize, k: usize) -> Option<MultiSet>
This function allocates memory for a new multiset with parameters n, k and initializes it to the lexicographically first multiset element. A null pointer is returned if insufficient memory is available to create the multiset.
fn init_first(&mut self)
This function initializes the multiset c to the lexicographically first multiset element, i.e. 0 repeated k times.
fn init_last(&mut self)
This function initializes the multiset c to the lexicographically last multiset element, i.e. n-1 repeated k times.
fn copy(&self, dest: &mut MultiSet) -> Value
This function copies the elements of the multiset self into the multiset dest. The two multisets must have the same size.
fn get(&self, i: usize) -> usize
This function returns the value of the i-th element of the multiset c. If i lies outside the allowed range of 0 to k-1 then the error handler is invoked and 0 is returned.
fn n(&self) -> usize
This function returns the range (n) of the multiset self.
fn k(&self) -> usize
This function returns the number of elements (k) in the multiset self.
fn data<'r>(&'r mut self) -> &'r mut [usize]
This function returns a pointer to the array of elements in the multiset self.
fn valid(&self) -> Value
This function checks that the multiset self is valid. The k elements should lie in the range 0 to n-1, with each value occurring in nondecreasing order.
fn next(&mut self) -> Value
This function advances the multiset self to the next multiset element in lexicographic order and returns ::Value::Success. If no further multisets elements are available it returns enums::value::Failure and leaves self unmodified. Starting with the first multiset and repeatedly applying this function will iterate through all possible multisets of a given order.
fn prev(&mut self) -> Value
This function steps backwards from the multiset self to the previous multiset element in lexicographic order, returning ::Value::Success. If no previous multiset is available it returns enums::value::Failure and leaves self unmodified.