Package jline.api.mam

Class RandpKt

  • All Implemented Interfaces:

    
    public final class RandpKt
    
                        
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final static Matrix randp(DoubleArray P, Integer rows, Integer cols) Pick random values with relative probability.
      final static Matrix randp(Matrix P, Integer rows, Integer cols) Pick random values with relative probability (Matrix version).
      final static Integer randp(DoubleArray P) Generate a single random sample with relative probability.
      final static Integer randp(Matrix P) Generate a single random sample with relative probability (Matrix version).
      • Methods inherited from class java.lang.Object

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

    • Method Detail

      • randp

         final static Matrix randp(DoubleArray P, Integer rows, Integer cols)

        Pick random values with relative probability.

        Returns integers in the range from 1 to PROB.size with a relative probability, so that the value X is present approximately (PROBX-1/sum(PROB)) times.

        All values of PROB should be equal to or larger than 0.

        Parameters:
        P - Probability vector (all values should be >= 0)
        rows - Number of rows for output matrix
        cols - Number of columns for output matrix (defaults to rows if not specified)
        Returns:

        Matrix of random integers with specified probabilities

      • randp

         final static Matrix randp(Matrix P, Integer rows, Integer cols)

        Pick random values with relative probability (Matrix version).

        Parameters:
        P - Probability matrix (flattened column-wise)
        rows - Number of rows for output matrix
        cols - Number of columns for output matrix (defaults to rows if not specified)
        Returns:

        Matrix of random integers with specified probabilities

      • randp

         final static Integer randp(DoubleArray P)

        Generate a single random sample with relative probability.

        Parameters:
        P - Probability vector
        Returns:

        Single random integer with specified probability

      • randp

         final static Integer randp(Matrix P)

        Generate a single random sample with relative probability (Matrix version).

        Parameters:
        P - Probability matrix
        Returns:

        Single random integer with specified probability