Class DistributionUtils
- java.lang.Object
-
- org.processmining.plugins.stochasticpetrinet.distribution.DistributionUtils
-
public class DistributionUtils extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description DistributionUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method 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.UnivariateFunctiongetDensityFunction(org.apache.commons.math3.distribution.RealDistribution dist)Simply returns a wrapper function that returns the density.static intgetIndex(double value, double binwidth)The bin index starting with 0 for values between 0 inclusive and binwidth exclusivestatic double[]getRealPart(org.apache.commons.math3.complex.Complex[] complexValues)Useful after operations in Fourier space.static doublegetReliableUpperBound(org.apache.commons.math3.distribution.RealDistribution dist)static doublegetValue(int index, double binwidth)static double[]getVectorLength(org.apache.commons.math3.complex.Complex[] complexValues)static org.apache.commons.math3.analysis.UnivariateFunctiongetWeightedFunction(org.apache.commons.math3.distribution.RealDistribution dist)Used for numerical integration to compute the mean.static org.apache.commons.math3.analysis.UnivariateFunctiongetWeightedSecondMomentFunction(org.apache.commons.math3.distribution.RealDistribution dist)Used for numerical integration to compute the variance.static doubleintegrateReliably(org.apache.commons.math3.analysis.UnivariateFunction f, double fromValue, double toValue)Integrates a function numerically with theSimpsonIntegrator.static double[]shuffle(double[] values)
-
-
-
Method Detail
-
getWeightedFunction
public static org.apache.commons.math3.analysis.UnivariateFunction getWeightedFunction(org.apache.commons.math3.distribution.RealDistribution dist)
Used for numerical integration to compute the mean. given a distribution with a density, it returns a function of x * density(x)- Parameters:
dist-- Returns:
-
getWeightedSecondMomentFunction
public static org.apache.commons.math3.analysis.UnivariateFunction getWeightedSecondMomentFunction(org.apache.commons.math3.distribution.RealDistribution dist)
Used for numerical integration to compute the variance. given a distribution with a density, it returns a function of x * density(x)- Parameters:
dist-- Returns:
-
getDensityFunction
public static org.apache.commons.math3.analysis.UnivariateFunction getDensityFunction(org.apache.commons.math3.distribution.RealDistribution dist)
Simply returns a wrapper function that returns the density.- Parameters:
dist- the distribution to extract the density from.- Returns:
UnivariateFunction
-
getRealPart
public static double[] getRealPart(org.apache.commons.math3.complex.Complex[] complexValues)
Useful after operations in Fourier space.- Parameters:
complexValues-- Returns:
- extracts the real part of the complex numbers
-
getVectorLength
public static double[] getVectorLength(org.apache.commons.math3.complex.Complex[] complexValues)
-
shuffle
public static double[] shuffle(double[] values)
-
discretizeDistribution
public static java.util.Map<java.lang.Integer,java.lang.Double> discretizeDistribution(org.apache.commons.math3.distribution.RealDistribution dist, double binwidth)
-
getIndex
public static int getIndex(double value, double binwidth)The bin index starting with 0 for values between 0 inclusive and binwidth exclusive- Parameters:
value-binwidth-- Returns:
-
getValue
public static double getValue(int index, double binwidth)
-
integrateReliably
public static double integrateReliably(org.apache.commons.math3.analysis.UnivariateFunction f, double fromValue, double toValue)Integrates a function numerically with theSimpsonIntegrator. Does so 10 times with less and less accuracy.- Parameters:
f- the function to be integratedfromValue- the lower boundary of the integraltoValue- the upper boundary of the integral- Returns:
- double the value of the integral
- Throws:
java.lang.IllegalArgumentException- if integration fails 10 times (with less and less accuracy)
-
getReliableUpperBound
public static double getReliableUpperBound(org.apache.commons.math3.distribution.RealDistribution dist)
-
-