Class Algorithms


  • public class Algorithms
    extends java.lang.Object
    Algorithms class.
    Since:
    Ptolemy II 10.0
    Version:
    $Id$
    Author:
    ilgea
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Red (cxh)
    • Constructor Summary

      Constructors 
      Constructor Description
      Algorithms()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int _binaryIntervalSearch​(double[] A, double key)
      Do a binary interval search for the key in array A.
      static int _binaryIntervalSearch​(double[] A, double key, int imin, int imax)
      Do a binary interval search for the key in array A.
      static double mvnpdf​(double[] y, double[] mu, double[][] sigma)
      Compute the Gaussian pdf value with the given mean and covariance parameters at data point y.
      static double poissonPmf​(int k, double mean)
      Return the probability mass function P(x=k) ~ Poisson(mean) value at k, for the Poisson distribution with parameter mean.
      static double poissonPmf​(int k, double mean, double logFactorial)
      Return the probability mass function P(x=k) ~ Poisson(mean) value at k, for the poisson distribution with parameter mean.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Algorithms

        public Algorithms()
    • Method Detail

      • poissonPmf

        public static double poissonPmf​(int k,
                                        double mean)
                                 throws IllegalActionException
        Return the probability mass function P(x=k) ~ Poisson(mean) value at k, for the Poisson distribution with parameter mean.
        Parameters:
        k - The value at which the probability mass function will be computed
        mean - The mean (lambda) of the poisson distribution
        Returns:
        The PMF value at k.
        Throws:
        IllegalActionException - If k < 0.
      • poissonPmf

        public static double poissonPmf​(int k,
                                        double mean,
                                        double logFactorial)
                                 throws IllegalActionException
        Return the probability mass function P(x=k) ~ Poisson(mean) value at k, for the poisson distribution with parameter mean.
        Parameters:
        k - The value at which the probability mass function will be computed
        mean - The mean (lambda) of the poisson distribution
        logFactorial - The log factorial
        Returns:
        The PMF value at k.
        Throws:
        IllegalActionException - If k < 0.
      • _binaryIntervalSearch

        public static int _binaryIntervalSearch​(double[] A,
                                                double key)
        Do a binary interval search for the key in array A. The bin index in which key is found is returned.
        Parameters:
        A - The search array
        key - Key to be searched
        Returns:
        the found key index.
      • _binaryIntervalSearch

        public static int _binaryIntervalSearch​(double[] A,
                                                double key,
                                                int imin,
                                                int imax)
        Do a binary interval search for the key in array A. The bin index in which key is found is returned.
        Parameters:
        A - A The search array
        key - Key to be searched
        imin - minimum array index to look for key
        imax - maximum array index to look for key
        Returns:
        the found key index, or value of KEY_NOT_FOUND for not found.
      • mvnpdf

        public static double mvnpdf​(double[] y,
                                    double[] mu,
                                    double[][] sigma)
        Compute the Gaussian pdf value with the given mean and covariance parameters at data point y.
        Parameters:
        y - observation point
        mu - mean array
        sigma - covariance matrix
        Returns:
        value of the probability distribution