package util

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. util
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. class ColorGradient extends AnyRef
  2. case class ColorPoint (red: Float, green: Float, blue: Float, value: Float) extends Product with Serializable

  3. class HashMultiSet [T] extends MultiSet[T]

    An implementation of a MultiSet backed by a HashMap.

  4. class HashSelectableSet [T] extends SelectableSet[T]

    HashSelectableSet uses a hashset implementation to provide O(1) insertion, O(1) removal, O(1) search, O(n) listing elements, and O(log n) selecting an element uniformly at random.

  5. class HeapPriorityMap [T, U] extends PriorityMap[T, U]

    A priority map using a heap implementation.

    A priority map using a heap implementation. Provides O(log n) insertion, update, and extracting the minimum element.

  6. class InvalidDistributionException extends RuntimeException
  7. class InvalidMultinomialIndexException extends RuntimeException
  8. class LessThanOneTotalProbabilityException extends InvalidDistributionException
  9. case class LogStatistics (logMean: Double, logVariance: Double, count: Int) extends Product with Serializable

    Represents basic statistics of a sample from a nonnegative-valued univariate distribution.

    Represents basic statistics of a sample from a nonnegative-valued univariate distribution. All computations on these statistics are done in log space to prevent underflow.

    logMean

    The log of the mean of the samples.

    logVariance

    The log of the variance of the samples.

    count

    The number of samples taken.

  10. class MapResampler [T] extends Resampler[T]

    A resampler that allows efficient resampling from a set of weighted samples provided as the inputs.

    A resampler that allows efficient resampling from a set of weighted samples provided as the inputs. Creating the resampler takes O(N log N) time, where N is the number of input samples, and selecting M samples takes O(M log N).

  11. trait MultiSet [T] extends Traversable[T]

    Trait of multisets that can contain more than one instance of the same element.

    Trait of multisets that can contain more than one instance of the same element.

    T

    The type of values contained in the set

  12. class NegativeProbabilityException extends InvalidDistributionException
  13. trait OnlineLogStatistics extends AnyRef

    Trait for computing mean in variance in log space in an online fashion.

  14. trait PriorityMap [T, U] extends Map[T, U]

    A priority map is like a priority queue except that keys in the clue are mapped to values that determine their place in the queue.

    A priority map is like a priority queue except that keys in the clue are mapped to values that determine their place in the queue. The value associated with a key can be updated, resulting in the key being moved to a different place in the queue.

  15. abstract class Resampler [T] extends AnyRef

    A resampler allows resampling from a set of weighted samples provided as the inputs.

  16. trait SelectableSet [T] extends Set[T]

    A set that supports selection of an element uniformly at random, in addition to the usual set operations.

  17. class ZeroTotalUnnormalizedProbabilityException extends InvalidDistributionException

Value Members

  1. def argmax(seq: Seq[Double]): Int

    Finds the index of the maximal element in the sequence.

  2. def bound(logp: Double, conditions: Boolean*): Double

    Returns logp if all conditions are true.

    Returns logp if all conditions are true. Else returns -Inf.

  3. def cartesianProduct(args: List[_]*): List[List[Any]]

    Returns the Cartesian product of any number of inputs.

    Returns the Cartesian product of any number of inputs. The results are returned in lexicographic order.

  4. def getNextHashCode: Int
  5. def getOrElseInsert[T, U](map: Map[T, U], key: T, default: ⇒ U): U

    Gets the value associated with a key in a map, inserting a default value if it is not found.

    Gets the value associated with a key in a map, inserting a default value if it is not found. The default is only evaluated if the key is not found in the map.

  6. def getSeed(): Long
  7. def homogeneousCartesianProduct[T](args: List[T]*): List[List[T]]

    Returns the Cartesian product of any number of inputs of the same type.

    Returns the Cartesian product of any number of inputs of the same type. The results are returned in lexicographic order.

  8. def indices[T](traversable: Traversable[T], x: T): List[Int]

    Returns all indices of the given element in the traversable.

  9. def insertAtIndices[T](traversable: Traversable[T], indices: List[Int], value: T): List[T]

    Given a traversable, some indices, and a value, inserts the value at the given indices into the traversable.

    Given a traversable, some indices, and a value, inserts the value at the given indices into the traversable. The resulting list contains all the elements of the input traversable as well as the value at the appropriate indices. For example, insertAtIndices(List(1,2), List(0,2,4), 3) yields List(3,1,3,2,3). The indices must be in order to produce the correct result. If the indices are such that there would be a gap in the resulting traversable, IllegalArgumentException is thrown.

  10. def logDiff(p1: Double, p2: Double): Double

    Computes the difference of two probabilities in log space.

    Computes the difference of two probabilities in log space. Returns NaN if p2>p1, -Infinity if p2=p1

  11. def logSum(p1: Double, p2: Double): Double

    Sums two probabilities in log space.

  12. def logSumMany(xs: Traversable[Double]): Double

    Computes the sum of many probabilities in log space.

  13. def measureTime[T](f: () ⇒ T, warmup: Int, runs: Int): Double

    Computes the average time to run the given function.

    Computes the average time to run the given function. The second argument is the number of times to run it before starting to measure to warm up the JVM. The third argument is the number of times to run and measure.

  14. def memo[T, U](fn: (T) ⇒ U): (T) ⇒ U

    Memoize the given function so that it is only applied once to each input with the result stored.

  15. def normalize(unnormalized: List[Double]): List[Double]

    Normalize the given list of doubles so that the proportions remain constant and they sum to 1.

    Normalize the given list of doubles so that the proportions remain constant and they sum to 1. An exception will be thrown if the inputs sum to 0.

  16. lazy val random: Random
  17. def reachable[T](graph: (T) ⇒ Traversable[T], includeStart: Boolean, start: T*): Set[T]

    Find the elements that are reachable from given elements in a directed graph.

    Find the elements that are reachable from given elements in a directed graph. The implementation avoids following the exponential number of paths by marking which nodes have been checked. This technique also allows the algorithm to work on cyclic graphs.

    graph

    A function that given an element returns a collection of nodes to which there is a directed edge.

    includeStart

    Flag to indicate whether to explicitly include the start elements in the returned set or not.

    start

    Graph elements from which to begin searching.

    returns

    A set containing all nodes reachable by directed edges from the start nodes. Note: if a start node is reachable by a path from another start node (or by a cycle containing itself), the node will be included the set even if includeStart is set to false.

  18. def round(target: Double, points: Iterable[Double]): Double

    Round the given double to the nearest element of the non-empty ordered list.

  19. def sampleMultinomial[T](clauses: List[(Double, T)]): T

    Sample a value given a multinomial distribution.

    Sample a value given a multinomial distribution. The input is a list of pairs where each pair specifies a value and its associated probability. This method assumes the probabilities sum to 1.

  20. var seed: Long
  21. def setSeed(s: Long): Unit

    A random number generator.

  22. def timed[T](arg: ⇒ T, title: String): T

    Computes and returns the argument, timing how long it takes to produce the answer and printing the result.

  23. def upperTriangle[T](list: List[T]): List[(T, T)]

    Computes all pairs of elements in the list in which the first element appears before the second.

  24. object ColorGradient
  25. object HashMultiSet
  26. object LogStatistics extends Serializable
  27. object PriorityMap
  28. object TopSort

Inherited from AnyRef

Inherited from Any

Ungrouped