Class BoxedPDFImpl
java.lang.Object
de.uka.ipd.sdq.probfunction.math.impl.ProbabilityFunctionImpl
de.uka.ipd.sdq.probfunction.math.impl.ProbabilityDensityFunctionImpl
de.uka.ipd.sdq.probfunction.math.impl.BoxedPDFImpl
- All Implemented Interfaces:
IBoxedPDF
,IProbabilityDensityFunction
,IProbabilityFunction
-
Nested Class Summary
Nested classes/interfaces inherited from class de.uka.ipd.sdq.probfunction.math.impl.ProbabilityDensityFunctionImpl
ProbabilityDensityFunctionImpl.CompareOperation
-
Field Summary
Fields inherited from class de.uka.ipd.sdq.probfunction.math.impl.ProbabilityFunctionImpl
pfFactory, randomGenerator
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAdds two ProbabilityDensityFunctions on a "per value" basis:
h(x) = f(x) + g(x)
An addition can only be performed if both functions are in the same domain (frequency or time).void
checks whether the following constraints are fulfilled : the sum of all probabilities is one.Divides two ProbabilityDensityFunctions on a "per value" basis:
h(x) = f(x) / g(x)
A division can only be performed if both functions are in the same domain (frequency or time).double
Generates a random number of the probability function's domain, whose distribution is defined by the probability function.boolean
double
Get the mean value of the BoxedPDFreturns the cumulative probability function associated with this probability function.Computes the fourier transform of the probability density function.Computes the inverse fourier transform of the probability density function.double
Returns the smallest values of the domain.A median is a number dividing the higher half of a sample, a population, or a probability distribution from the lower half.getPercentile
(int p) In descriptive statistics, the 'p'th percentile is a scale value for a data series equal to the p/100 quantile.double
Computes the sum of all probabilities specified in the function.Ordered list of ContinuousSamples, which define the sequence of boxes.double
Computes the probability that the random variable specified by this PDF is greater than the random variable specified by pdf.boolean
True, if the probability density function is in the frequency domain (frequency domain graph shows how much of the signal lies within each given frequency band over a range of frequencies).boolean
True, if the probability density function is the time domain (a time domain graph shows how a signal changes over time).double
Computes the probability that the random variable specified by this PDF is less than the random variable specified by pdf.Multiplies two ProbabilityDensityFunctions on a "per value" basis:
h(x) = f(x) * g(x)
A multiplication can only be performed if both functions are in the same domain (frequency or time).double
Computes the probability that two random variables characterised by the given PDFs are equal.scale
(double scalar) Scales a ProbabilityDensityFunctions on a "per value" basis:
h(x) = a * f(x)void
setSamples
(List<IContinuousSample> samples) shiftDomain
(double scalar) Shifts the domain values of the PDF by the given scalarstretchDomain
(double scalar) Stretches the domain values of the PDF.Subtracts two ProbabilityDensityFunctions on a "per value" basis:
h(x) = f(x) - g(x)
A substraction can only be performed if both functions are in the same domain (frequency or time).toString()
Methods inherited from class de.uka.ipd.sdq.probfunction.math.impl.ProbabilityFunctionImpl
getRandomGenerator, getUnit, hasOrderedDomain, setInFrequencyDomain, setRandomGenerator, setUnit
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface de.uka.ipd.sdq.probfunction.math.IProbabilityFunction
getUnit, hasOrderedDomain
-
Constructor Details
-
BoxedPDFImpl
-
-
Method Details
-
add
public IProbabilityDensityFunction add(IProbabilityDensityFunction pdf) throws FunctionsInDifferenDomainsException, UnknownPDFTypeException, IncompatibleUnitsException Description copied from interface:IProbabilityDensityFunction
Adds two ProbabilityDensityFunctions on a "per value" basis:
h(x) = f(x) + g(x)
An addition can only be performed if both functions are in the same domain (frequency or time). If not a FunctionsInDifferenDomainsException is thrown.- Specified by:
add
in interfaceIProbabilityDensityFunction
- Parameters:
pdf
- g(x), probability density function to add.- Returns:
- The sum of this function (f(x)) and pdf (g(x))
- Throws:
FunctionsInDifferenDomainsException
- Thrown if both functions are in different domains.UnknownPDFTypeException
- Thrown if one of the function is of an unknown type (not SamplePDf or BoxedPDF).IncompatibleUnitsException
- Thrown if both functions have units that do not match.
-
mult
public IProbabilityDensityFunction mult(IProbabilityDensityFunction pdf) throws FunctionsInDifferenDomainsException, UnknownPDFTypeException, IncompatibleUnitsException Description copied from interface:IProbabilityDensityFunction
Multiplies two ProbabilityDensityFunctions on a "per value" basis:
h(x) = f(x) * g(x)
A multiplication can only be performed if both functions are in the same domain (frequency or time). If not a FunctionsInDifferenDomainsException is thrown.- Specified by:
mult
in interfaceIProbabilityDensityFunction
- Parameters:
pdf
- g(x), probability density function to multiply with.- Returns:
- The product of this function (f(x)) and pdf (g(x))
- Throws:
FunctionsInDifferenDomainsException
- Thrown if both functions are in different domains.UnknownPDFTypeException
- Thrown if one of the function is of an unknown type (not SamplePDf or BoxedPDF).IncompatibleUnitsException
- Thrown if both functions have units that do not match.
-
scale
Description copied from interface:IProbabilityDensityFunction
Scales a ProbabilityDensityFunctions on a "per value" basis:
h(x) = a * f(x)- Specified by:
scale
in interfaceIProbabilityDensityFunction
- Parameters:
scalar
- a, value to scale with.- Returns:
- The scaled function a*f(x)
-
getSamples
Description copied from interface:IBoxedPDF
Ordered list of ContinuousSamples, which define the sequence of boxes.- Specified by:
getSamples
in interfaceIBoxedPDF
- Returns:
- ContinuousSamples approximating the probability density function.
-
getValues
-
getProbabilities
-
setSamples
- Throws:
DoubleSampleException
-
div
public IProbabilityDensityFunction div(IProbabilityDensityFunction pdf) throws FunctionsInDifferenDomainsException, UnknownPDFTypeException, IncompatibleUnitsException Description copied from interface:IProbabilityDensityFunction
Divides two ProbabilityDensityFunctions on a "per value" basis:
h(x) = f(x) / g(x)
A division can only be performed if both functions are in the same domain (frequency or time). If not a FunctionsInDifferenDomainsException is thrown.- Specified by:
div
in interfaceIProbabilityDensityFunction
- Parameters:
pdf
- g(x), probability density function to divide by.- Returns:
- The fraction of this function (f(x)) and pdf (g(x))
- Throws:
FunctionsInDifferenDomainsException
UnknownPDFTypeException
IncompatibleUnitsException
-
drawSample
public double drawSample()Description copied from interface:IProbabilityDensityFunction
Generates a random number of the probability function's domain, whose distribution is defined by the probability function.- Specified by:
drawSample
in interfaceIProbabilityDensityFunction
- Returns:
- A sample of the PDF's domain.
-
getFourierTransform
Description copied from interface:IProbabilityDensityFunction
Computes the fourier transform of the probability density function. Can only be applied if 'isInTimeDomain()' is true, otherwise a FunctionNotInTimeDomain exception is thrown.- Specified by:
getFourierTransform
in interfaceIProbabilityDensityFunction
- Returns:
- fourier transform of the PDF (in frequency domain)
- Throws:
FunctionNotInTimeDomainException
-
getInverseFourierTransform
public IProbabilityDensityFunction getInverseFourierTransform() throws FunctionNotInFrequencyDomainExceptionDescription copied from interface:IProbabilityDensityFunction
Computes the inverse fourier transform of the probability density function. Can only be applied if 'isInFrequencyDomain()' is true, otherwise a FunctionNotInFrequencyDomainException is thrown.- Specified by:
getInverseFourierTransform
in interfaceIProbabilityDensityFunction
- Returns:
- inverse fourier transform of the PDF (in time domain)
- Throws:
FunctionNotInFrequencyDomainException
-
getLowerDomainBorder
public double getLowerDomainBorder()Description copied from interface:IProbabilityDensityFunction
Returns the smallest values of the domain. At the moment this will be zero. However, future implementations might allow arbitrary values here.- Specified by:
getLowerDomainBorder
in interfaceIProbabilityDensityFunction
- Returns:
- Smallest value of the domain.
-
sub
public IProbabilityDensityFunction sub(IProbabilityDensityFunction pdf) throws FunctionsInDifferenDomainsException, UnknownPDFTypeException, IncompatibleUnitsException Description copied from interface:IProbabilityDensityFunction
Subtracts two ProbabilityDensityFunctions on a "per value" basis:
h(x) = f(x) - g(x)
A substraction can only be performed if both functions are in the same domain (frequency or time). If not a FunctionsInDifferenDomainsException is thrown.- Specified by:
sub
in interfaceIProbabilityDensityFunction
- Parameters:
pdf
- g(x), probability density function to substract.- Returns:
- The difference of this function (f(x)) and pdf (g(x))
- Throws:
FunctionsInDifferenDomainsException
- Thrown if both functions are in different domains.UnknownPDFTypeException
- Thrown if one of the function is of an unknown type (not SamplePDf or BoxedPDF).IncompatibleUnitsException
- Thrown if both functions have units that do not match.
-
getArithmeticMeanValue
Get the mean value of the BoxedPDF- Specified by:
getArithmeticMeanValue
in interfaceIProbabilityFunction
- Parameters:
list
-- Returns:
- the mean value
- Throws:
DomainNotNumbersException
-
getMedian
Description copied from interface:IProbabilityFunction
A median is a number dividing the higher half of a sample, a population, or a probability distribution from the lower half. The median of a finite list of numbers can be found by arranging all the observations from lowest value to highest value and picking the middle one.- Specified by:
getMedian
in interfaceIProbabilityFunction
- Returns:
- Object that is the border for the median.
- Throws:
UnorderedDomainException
-
getPercentile
Description copied from interface:IProbabilityFunction
In descriptive statistics, the 'p'th percentile is a scale value for a data series equal to the p/100 quantile. Thus:
* The 1st percentile cuts off lowest 1% of data
* The 98th percentile cuts off lowest 98% of data
* The 25th percentile is the first quartile
* The 50th percentile is the median.
One definition is that the pth percentile of n ordered values is obtained by first calculating the rank k = p(n+1)/100, rounded to the nearest integer and then taking the value that corresponds to that rank.- Specified by:
getPercentile
in interfaceIProbabilityFunction
- Parameters:
p
- sets the percentile which shall be computed. p must take values between 0 and 100.- Returns:
- Object that is the border for the 'p'th percentile.
- Throws:
IndexOutOfBoundsException
UnorderedDomainException
-
isInFrequencyDomain
public boolean isInFrequencyDomain()Description copied from interface:IProbabilityFunction
True, if the probability density function is in the frequency domain (frequency domain graph shows how much of the signal lies within each given frequency band over a range of frequencies). This means it is the result of a Fourier transformation.- Specified by:
isInFrequencyDomain
in interfaceIProbabilityFunction
- Overrides:
isInFrequencyDomain
in classProbabilityFunctionImpl
- Returns:
- True, if in frequency domain, false otherwise.
-
isInTimeDomain
public boolean isInTimeDomain()Description copied from interface:IProbabilityFunction
True, if the probability density function is the time domain (a time domain graph shows how a signal changes over time). This means that it is not a result of a Fourier transform.- Specified by:
isInTimeDomain
in interfaceIProbabilityFunction
- Overrides:
isInTimeDomain
in classProbabilityFunctionImpl
- Returns:
- True, if in time domain; false otherwise.
-
getProbabilitySum
public double getProbabilitySum()Description copied from interface:IProbabilityFunction
Computes the sum of all probabilities specified in the function. For pdfs this is the area under the graph; for pmfs the sum of all probabilities.- Specified by:
getProbabilitySum
in interfaceIProbabilityFunction
- Returns:
- Sum of all probabilities in the function.
-
checkConstrains
public void checkConstrains() throws InvalidSampleValueException, UnitNameNotSetException, UnitNotSetException, ProbabilitySumNotOneExceptionDescription copied from interface:IProbabilityFunction
checks whether the following constraints are fulfilled : the sum of all probabilities is one. all values are greater or equal 0.- Specified by:
checkConstrains
in interfaceIProbabilityFunction
- Throws:
InvalidSampleValueException
UnitNameNotSetException
UnitNotSetException
ProbabilitySumNotOneException
-
getCumulativeFunction
Description copied from interface:IProbabilityDensityFunction
returns the cumulative probability function associated with this probability function.- Specified by:
getCumulativeFunction
in interfaceIProbabilityDensityFunction
- Returns:
- the computed cumulative probability function.
-
equals
-
probabilisticEquals
Description copied from interface:IProbabilityDensityFunction
Computes the probability that two random variables characterised by the given PDFs are equal. Note that the randomvariables have to be independent.- Specified by:
probabilisticEquals
in interfaceIProbabilityDensityFunction
- Parameters:
pdf
- PDF to compare to.- Returns:
- Probability that the two random variables characterised by the PDFs are equal.
-
greaterThan
Description copied from interface:IProbabilityDensityFunction
Computes the probability that the random variable specified by this PDF is greater than the random variable specified by pdf. Note that the randomvariables have to be independent.- Specified by:
greaterThan
in interfaceIProbabilityDensityFunction
- Parameters:
pdf
- PDF to compare to.- Returns:
- Probability X_this > X_pdf
-
lessThan
Description copied from interface:IProbabilityDensityFunction
Computes the probability that the random variable specified by this PDF is less than the random variable specified by pdf. Note that the randomvariables have to be independent.- Specified by:
lessThan
in interfaceIProbabilityDensityFunction
- Parameters:
pdf
- PDF to compare to.- Returns:
- Probability X_this < X_pdf
-
stretchDomain
Stretches the domain values of the PDF. This is equivalent to the multiplication of the specified random variable by the given scalar. Scalar must not be 0. If it is 0, a RuntimeException is thrown.- Specified by:
stretchDomain
in interfaceIProbabilityDensityFunction
- Parameters:
scalar
- must not be 0- Returns:
-
shiftDomain
Shifts the domain values of the PDF by the given scalar Returns itself if scalar == 0.- Specified by:
shiftDomain
in interfaceIProbabilityDensityFunction
- Returns:
- Throws:
DomainNotNumbersException
-
toString
-