public class DistributionUtils
extends java.lang.Object
Constructor and Description |
---|
DistributionUtils() |
Modifier and Type | Method and Description |
---|---|
static java.util.Map<java.lang.Integer,java.lang.Double> |
discretizeDistribution(org.apache.commons.math3.distribution.RealDistribution dist,
double binwidth) |
static org.apache.commons.math3.analysis.UnivariateFunction |
getDensityFunction(org.apache.commons.math3.distribution.RealDistribution dist)
Simply returns a wrapper function that returns the density.
|
static int |
getIndex(double value,
double binwidth)
The bin index starting with 0 for values between 0 inclusive and binwidth exclusive
|
static double[] |
getRealPart(org.apache.commons.math3.complex.Complex[] complexValues)
Useful after operations in Fourier space.
|
static double |
getReliableUpperBound(org.apache.commons.math3.distribution.RealDistribution dist) |
static double |
getValue(int index,
double binwidth) |
static double[] |
getVectorLength(org.apache.commons.math3.complex.Complex[] complexValues) |
static org.apache.commons.math3.analysis.UnivariateFunction |
getWeightedFunction(org.apache.commons.math3.distribution.RealDistribution dist)
Used for numerical integration to compute the mean.
|
static org.apache.commons.math3.analysis.UnivariateFunction |
getWeightedSecondMomentFunction(org.apache.commons.math3.distribution.RealDistribution dist)
Used for numerical integration to compute the variance.
|
static double |
integrateReliably(org.apache.commons.math3.analysis.UnivariateFunction f,
double fromValue,
double toValue)
Integrates a function numerically with the
SimpsonIntegrator . |
static double[] |
shuffle(double[] values) |
public static org.apache.commons.math3.analysis.UnivariateFunction getWeightedFunction(org.apache.commons.math3.distribution.RealDistribution dist)
dist
- public static org.apache.commons.math3.analysis.UnivariateFunction getWeightedSecondMomentFunction(org.apache.commons.math3.distribution.RealDistribution dist)
dist
- public static org.apache.commons.math3.analysis.UnivariateFunction getDensityFunction(org.apache.commons.math3.distribution.RealDistribution dist)
dist
- the distribution to extract the density from.UnivariateFunction
public static double[] getRealPart(org.apache.commons.math3.complex.Complex[] complexValues)
complexValues
- public static double[] getVectorLength(org.apache.commons.math3.complex.Complex[] complexValues)
public static double[] shuffle(double[] values)
public static java.util.Map<java.lang.Integer,java.lang.Double> discretizeDistribution(org.apache.commons.math3.distribution.RealDistribution dist, double binwidth)
public static int getIndex(double value, double binwidth)
value
- binwidth
- public static double getValue(int index, double binwidth)
public static double integrateReliably(org.apache.commons.math3.analysis.UnivariateFunction f, double fromValue, double toValue)
SimpsonIntegrator
. Does so 10 times with less and less accuracy.f
- the function to be integratedfromValue
- the lower boundary of the integraltoValue
- the upper boundary of the integraljava.lang.IllegalArgumentException
- if integration fails 10 times (with less and less accuracy)public static double getReliableUpperBound(org.apache.commons.math3.distribution.RealDistribution dist)