public class GeneratorUtils
extends java.lang.Object
Constructor and Description |
---|
GeneratorUtils() |
Modifier and Type | Method and Description |
---|---|
static double |
algorKS(double[] data,
PhaseVar var)
This method implements the KS algorithm proposed by
González, Sahni and Franta in "An efficient algorithm for the
Kolmogorov-Smirnov and Lilliefors Tests" in ACM Transactions
on Mathematical Software, Vol 3, No. 1, March 1977, pages 60-64.
|
static void |
aliasCut(double[] dist,
int[] alias,
double[] cutoff)
This method generates the aliases and cutoff values
according to the distribution specified.
|
static void |
aliasCut(no.uib.cipr.matrix.Vector dist,
int[] alias,
double[] cutoff)
This method generates the aliases and cutoff values
according to the distribution specified.
|
static int |
argmax(double[] data)
Returns the index of the maximum value in the data
|
static int |
argmin(double[] data)
Returns the index of the minimum value in the data
|
static double |
erlang(double lambda,
int r,
java.util.Random rand)
Returns a random number with Erlang(lambda, r) distribution.
|
static int |
getNumber(double[] dist,
int[] alias,
double[] cutoff,
java.util.Random rand)
Returns a random number with discrete distribution dist in {0,...
|
static double |
sum(double[] data)
Returns the sum of the elements of the data array
|
static double |
sumAbs(double[] data)
Returns the sum of the absolute values of the elements
of the data array
|
public static int argmin(double[] data)
data
- array of datapublic static int argmax(double[] data)
data
- array of datapublic static double sum(double[] data)
data
- array of datapublic static double sumAbs(double[] data)
data
- array of datapublic static void aliasCut(no.uib.cipr.matrix.Vector dist, int[] alias, double[] cutoff)
dist
- Distribution from which the aliases and cutoff vectors
must be generated. Represented by an MTJ Vector.alias
- vector of the distributioncutoff
- values of the distributionpublic static void aliasCut(double[] dist, int[] alias, double[] cutoff)
dist
- Distribution from which the aliases and cutoff vectors
must be generated. Represented by array of doubles.alias
- vector of the distributioncutoff
- values of the distributionpublic static int getNumber(double[] dist, int[] alias, double[] cutoff, java.util.Random rand)
dist
- Discrete distribution in {0,...,n}alias
- Aliases of the distributions pointscutoff
- Cutoff values to generate the random numbersrand
- Random type object to use as generator of random numberspublic static double erlang(double lambda, int r, java.util.Random rand)
lambda
- Erlang rater
- number of phases in the Erlang Distributionrand
- Random number sourcepublic static double algorKS(double[] data, PhaseVar var)
data
- data trace to be testedvar
- theoretical phase variable to be compared against the trace