public class Combinatorics extends Object
Modifier and Type | Field and Description |
---|---|
protected static double[] |
gammaLnCoefficients
A lookup table of coefficients in support of
gammaLn(double) . |
Modifier and Type | Method and Description |
---|---|
static double |
gamma(double x)
The gamma function.
|
static double |
gammaLn(double x)
The log-gamma function.
|
protected static void |
orderedPartition(DynamicObjectArray<int[]> acc,
int[] sizes,
int nSizes,
int nRemaining)
A helper method in support of
orderedPartition(int, int, int) . |
static int[][] |
orderedPartition(int n)
A facade for
orderedPartition(int, int, int) . |
static int[][] |
orderedPartition(int n,
int nPartsLower,
int nPartsUpper)
Calculates all ordered partitions of an
n element set into at least nPartsLower parts and at most
(exclusive) nPartsUpper parts. |
protected static void |
partition(DynamicObjectArray<int[]> acc,
int[] sizes,
int nSizes,
int currentSize,
int nRemaining)
A helper method in support of
partition(int, int, int) . |
static int[][] |
partition(int n)
A facade for
partition(int, int, int) . |
static int[][] |
partition(int n,
int nPartsLower,
int nPartsUpper)
Calculates all partitions of an
n element set into at least nPartsLower parts and at most
(exclusive) nPartsUpper parts. |
protected static final double[] gammaLnCoefficients
gammaLn(double)
.public static final int[][] partition(int n)
partition(int, int, int)
.n
- the number of elements.public static final int[][] partition(int n, int nPartsLower, int nPartsUpper)
n
element set into at least nPartsLower
parts and at most
(exclusive) nPartsUpper
parts.n
- the number of elements.nPartsLower
- the lower bound on the number of parts.nPartsUpper
- the upper bound (exclusive) on the number of parts.protected static final void partition(DynamicObjectArray<int[]> acc, int[] sizes, int nSizes, int currentSize, int nRemaining)
partition(int, int, int)
.acc
- the partition accumulator.sizes
- the partition sizes.nSizes
- the number of parts so far.currentSize
- the part size so far.nRemaining
- the number of remaining elements.public static final int[][] orderedPartition(int n)
orderedPartition(int, int, int)
.n
- the number of elements.public static final int[][] orderedPartition(int n, int nPartsLower, int nPartsUpper)
n
element set into at least nPartsLower
parts and at most
(exclusive) nPartsUpper
parts.n
- the number of elements.nPartsLower
- the lower bound on the number of parts.nPartsUpper
- the upper bound (exclusive) on the number of parts.protected static final void orderedPartition(DynamicObjectArray<int[]> acc, int[] sizes, int nSizes, int nRemaining)
orderedPartition(int, int, int)
.acc
- the ordered partition accumulator.sizes
- the ordered partition sizes.nSizes
- the number of parts so far.nRemaining
- the number of remaining elements.public static final double gamma(double x)
x
- the input value.public static final double gammaLn(double x)
x
- the input value.