PSCF v1.1
|
Class for binomial coefficients (all static members) More...
#include <Binomial.h>
Static Public Member Functions | |
static void | setup (int nMax) |
Precompute all combinations C(n, m) up to n = nMax. More... | |
static void | clear () |
Release all static memory. More... | |
static int | coeff (int n, int m) |
Return coefficient "n choose m", or C(n, m) = n!/(m!(n-m)!). More... | |
Class for binomial coefficients (all static members)
Definition at line 27 of file Binomial.h.
|
static |
Precompute all combinations C(n, m) up to n = nMax.
Algorithm: Construct rows [0,...,nMax] of Pascal's triangle.
nMax | maximum value of n to precompute. |
Definition at line 17 of file Binomial.cpp.
References Util::GArray< Data >::resize(), and UTIL_CHECK.
Referenced by coeff(), and Util::Polynomial< T >::shift().
|
static |
Release all static memory.
Definition at line 47 of file Binomial.cpp.
References Util::GArray< Data >::capacity(), and Util::GArray< Data >::deallocate().
|
static |
Return coefficient "n choose m", or C(n, m) = n!/(m!(n-m)!).
Algorithm: Returns precomputed value C(n,m) if already known. Otherwise, calls setup(n) to computes and stores values of C(n', m) for all n' <= n, then returns desired value.
n | larger integer (overall power in binomial) |
m | parameter in range [0,n] |
Definition at line 55 of file Binomial.cpp.
References setup(), and UTIL_CHECK.
Referenced by Util::Polynomial< T >::shift().