Struct binomial_iter::BinomialIter [] [src]

pub struct BinomialIter { /* fields omitted */ }

Provides methods to calculate the binomial coefficient for the next higher/lower n/k.

Methods

impl BinomialIter
[src]

Create a new BinomialIter. This will calculate the binomial coefficient once using the recursive definition.

Panics

If k > n

Access the current value of n.

Access the current value of k.

Access the current value of n choose k.

Increase n by one and update the internal state accordingly.

Returns None when calculating n + 1 choose k would overflow, otherwise Some((n + 1, binom)).

Decrease n by one and update the internal state accordingly.

Returns None when calculating n - 1 choose k would overflow or n - 1 < k, otherwise Some((n - 1, binom)).

Increase k by one and update the internal state accordingly.

Returns None when calculating n choose k + 1 would overflow or n < k + 1, otherwise Some((k + 1, binom)).

Decrease k by one and update the internal state accordingly.

Returns None when calculating n choose k - 1 would overflow or k - 1 < 0, otherwise Some((k - 1, binom))

impl BinomialIter
[src]

Returns an iterator which wraps this BinomialIter, returns the current value of n and binom on the first call to next and the result of calling inc_n on the underlying BinominalIter for subsequent calls to next.

impl BinomialIter
[src]

Returns an iterator which wraps this BinomialIter, returns the current value of n and binom on the first call to next and the result of calling dec_n on the underlying BinominalIter for subsequent calls to next.

impl BinomialIter
[src]

Returns an iterator which wraps this BinomialIter, returns the current value of k and binom on the first call to next and the result of calling inc_k on the underlying BinominalIter for subsequent calls to next.

impl BinomialIter
[src]

Returns an iterator which wraps this BinomialIter, returns the current value of k and binom on the first call to next and the result of calling dec_k on the underlying BinominalIter for subsequent calls to next.

Trait Implementations

impl Copy for BinomialIter
[src]

impl Clone for BinomialIter
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl PartialEq for BinomialIter
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Eq for BinomialIter
[src]