Interface ISamplePDF

All Superinterfaces:
IProbabilityDensityFunction, IProbabilityFunction
All Known Implementing Classes:
SamplePDFImpl

public interface ISamplePDF extends IProbabilityDensityFunction
For the implementation of the SamplePDF, we used a simplified version of probability density functions to ease the following computations and analyses. The pdf is approximated by a number of sampling points, which are seperated by a fixed distance. Each sampling point contains the probability for a sample to lie in a certain interval. For example, if we have a pdf with a distance of 5 between the sampling points, the probability stored in the first point is for the interval [0, 2.5), the second for the interval [2.5, 7.5), and so on. The probabilities of the intervals [a, b) are derived from the original pdf by computing difference F(b) - F(a) of its integral, which is the the probability for a sample lying in the interval.
  • Method Details

    • expand

      void expand(int newSize) throws SizeTooSmallException
      Increases the number of sampling points. The new enries are filled with the value returned by 'getFillValue()'. The values are added at the end of the pdf.
      Parameters:
      newSize - the new number of sampling points. If newSize is smaller than the original size, an exception is thrown.
      Throws:
      SizeTooSmallException - Thrown if newSize is small than the current number of elements.
    • getDistance

      double getDistance()
      Returns the distance between the sampling points.
      Returns:
      distance between the sampling points.
    • getFunctionWithNewDistance

      ISamplePDF getFunctionWithNewDistance(double distance) throws NegativeDistanceException, FunctionNotInTimeDomainException
      Creates a new SamplePDF that describes the same PDF, but whose sampling points are computed according to a new distance.
      Parameters:
      distance - Distance of the new function.
      Returns:
      A new SamplePDF that describes the same PDF, but whose sampling points are adjusted to the new distance.
      Throws:
      FunctionNotInTimeDomainException
      NegativeDistanceException
    • getValuesAsDouble

      List<Double> getValuesAsDouble()
      Returns the real part of the function's samples. Copy only!
      Returns:
      Samples of the function.
    • getValues

      List<org.apache.commons.math.complex.Complex> getValues()
      Returns the sampling points of the function as complex numbers. Copy only!
      Returns:
      Samples of the function.
    • getValue

      org.apache.commons.math.complex.Complex getValue(int pos)
    • getValueAsDouble

      Double getValueAsDouble(int pos)
    • setValuesAsDouble

      void setValuesAsDouble(List<Double> values)
      /** Sets the sampling points of the function. As the values are doubles, only the real part of the complex numbers is set. The imaginary part is set to zero. The function is automatically set to the time domain. Note: The sum of all values has to be one, otherwise a ProbabilitySumNotOneException is thrown.
      Parameters:
      values - a new list of sampling points.
      Throws:
      ProbabilitySumNotOneException - Thrown, if the sum of the values is not one.
    • setValues

      void setValues(List<org.apache.commons.math.complex.Complex> values, boolean isInFrequencyDomain)
      Sets the sampling points of the function.
      Parameters:
      values - a new list of sampling points.
      Throws:
      ProbabilitySumNotOneException - Thrown, if the sum of the real part of the values is not one, if the function is in the time domain (isInFrequencyDomain == false).
    • getFillValueAsDouble

      double getFillValueAsDouble()
      Returns the real part of the value used to fill unset sampling points at the end of the function.
      Returns:
      Real part of the fill value.
    • getFillValue

      org.apache.commons.math.complex.Complex getFillValue()
      Returns the value used to fill unset sampling points at the end of the function.
      Returns:
      Fill value.
    • setFillValue

      void setFillValue(double fillValue)
      Sets the real part of the fill value to fillValue and the imaginary part to zero.
      Parameters:
      fillValue - the real part of the new fill value.
    • setFillValue

      void setFillValue(org.apache.commons.math.complex.Complex fillValue)
      Sets the new fill value.
      Parameters:
      fillValue - New fill value.
    • numberOfSamples

      int numberOfSamples()
      The number of samples used to approximate the pdf.
      Returns:
      Number of Samples.