package util
 Alphabetic
 By Inheritance
 util
 AnyRef
 Any
 Hide All
 Show All
 Public
 All
Type Members
 class ColorGradient extends AnyRef
 case class ColorPoint (red: Float, green: Float, blue: Float, value: Float) extends Product with Serializable

class
HashMultiSet
[T] extends MultiSet[T]
An implementation of a MultiSet backed by a HashMap.

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.

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.
 class InvalidDistributionException extends RuntimeException
 class InvalidMultinomialIndexException extends RuntimeException
 class LessThanOneTotalProbabilityException extends InvalidDistributionException

case class
LogStatistics
(logMean: Double, logVariance: Double, count: Int) extends Product with Serializable
Represents basic statistics of a sample from a nonnegativevalued univariate distribution.
Represents basic statistics of a sample from a nonnegativevalued 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.

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).

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
 class NegativeProbabilityException extends InvalidDistributionException

trait
OnlineLogStatistics
extends AnyRef
Trait for computing mean in variance in log space in an online fashion.

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.

abstract
class
Resampler
[T] extends AnyRef
A resampler allows resampling from a set of weighted samples provided as the inputs.

trait
SelectableSet
[T] extends Set[T]
A set that supports selection of an element uniformly at random, in addition to the usual set operations.
 class ZeroTotalUnnormalizedProbabilityException extends InvalidDistributionException
Value Members

def
argmax(seq: Seq[Double]): Int
Finds the index of the maximal element in the sequence.

def
bound(logp: Double, conditions: Boolean*): Double
Returns logp if all conditions are true.
Returns logp if all conditions are true. Else returns Inf.

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.
 def getNextHashCode: Int

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.
 def getSeed(): Long

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.

def
indices[T](traversable: Traversable[T], x: T): List[Int]
Returns all indices of the given element in the traversable.

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.

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

def
logSum(p1: Double, p2: Double): Double
Sums two probabilities in log space.

def
logSumMany(xs: Traversable[Double]): Double
Computes the sum of many probabilities in log space.

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.

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.

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.
 lazy val random: Random

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.

def
round(target: Double, points: Iterable[Double]): Double
Round the given double to the nearest element of the nonempty ordered list.

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.
 var seed: Long

def
setSeed(s: Long): Unit
A random number generator.

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.

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.
 object ColorGradient
 object HashMultiSet
 object LogStatistics extends Serializable
 object PriorityMap
 object TopSort