Handy utility functions which have some Mathematical relavance.
@author Matthew Goode @author Alexei Drummond @author Gerton Lunter @version $Id: MathUtils.java,v 1.13 2006/08/31 14:57:24 rambaut Exp $
Handy utility functions which have some Mathematical relavance.
@author Matthew Goode @author Alexei Drummond @author Gerton Lunter @version $Id: MathUtils.java,v 1.13 2006/08/31 14:57:24 rambaut Exp $
01 Syntax
02 Methods
| Name | Overloads | Summary |
|---|---|---|
| randomChoice | 1 | Chooses one category if a cumulative probability distribution is given |
| randomChoicePDF | 1 | |
| getNormalized | 1 | |
| getTotal | 2 | |
| nextByte | 1 | Access a default instance of this class, access is synchronized |
| nextBoolean | 1 | Access a default instance of this class, access is synchronized |
| nextBytes | 1 | Access a default instance of this class, access is synchronized |
| nextGaussian | 1 | Access a default instance of this class, access is synchronized |
| randomLogDouble | 1 | |
| nextExponential | 1 | Access a default instance of this class, access is synchronized |
| nextInverseGaussian | 1 | Access a default instance of this class, access is synchronized |
| uniform | 1 | |
| shuffle | 2 | Shuffles an array. Shuffles numberOfShuffles times |
| shuffled | 1 | Returns an array of shuffled indices of length l. |
| permute | 1 | Permutes an array. |
| permuted | 1 | Returns a uniform random permutation of 0,...,l-1 |
| hypot | 1 | Returns sqrt(a^2 + b^2) without under/overflow. |
| sampleIndicesWithReplacement | 1 |
03 Properties
| Name | Overloads | Summary |
|---|---|---|
| Seed | 1 | Access a default instance of this class, access is synchronized |
04 Members
Double())Chooses one category if a cumulative probability distribution is given
| Name | Type | Description |
|---|---|---|
cf | Double() | - |
Double())| Name | Type | Description |
|---|---|---|
pdf | Double() | array of unnormalized probabilities |
a sample according to an unnormalized probability distribution
Double())| Name | Type | Description |
|---|---|---|
array | Double() | to normalize |
a new double array where all the values sum to 1. Relative ratios are preserved.
Double(), Int32, Int32)| Name | Type | Description |
|---|---|---|
array | Double() | entries to be summed |
start | Int32 | start position |
end | Int32 | the index of the element after the last one to be included |
the total of a the values in a range of an array
Double())| Name | Type | Description |
|---|---|---|
array | Double() | to sum over |
the total of the values in an array
Access a default instance of this class, access is synchronized
Access a default instance of this class, access is synchronized
SByte())Access a default instance of this class, access is synchronized
Access a default instance of this class, access is synchronized
log of random variable in [0,1]
Double)Access a default instance of this class, access is synchronized
Double, Double)Access a default instance of this class, access is synchronized
Double, Double)| Name | Type | Description |
|---|---|---|
low | Double | - |
high | Double | - |
uniform between low and high
Int32())Shuffles an array.
Int32(), Int32)Shuffles an array. Shuffles numberOfShuffles times
Int32)Returns an array of shuffled indices of length l.
| Name | Type | Description |
|---|---|---|
l | Int32 | length of the array required. |
Int32())Permutes an array.
Int32)Returns a uniform random permutation of 0,...,l-1
| Name | Type | Description |
|---|---|---|
l | Int32 | length of the array required. |
Double, Double)Returns sqrt(a^2 + b^2) without under/overflow.
Access a default instance of this class, access is synchronized
Int32)