com.cra.figaro

util

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
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

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

    An implementation of a MultiSet backed by a HashMap.

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

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

  4. class InvalidDistributionException extends RuntimeException

  5. class InvalidMultinomialIndexException extends RuntimeException

  6. class LessThanOneTotalProbabilityException extends InvalidDistributionException

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

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

  9. class NegativeProbabilityException extends InvalidDistributionException

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

  11. abstract class Resampler[T] extends AnyRef

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

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

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

  13. class ZeroTotalUnnormalizedProbabilityException extends InvalidDistributionException

Value Members

  1. object HashMultiSet

  2. object PriorityMap

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

    Finds the index of the maximal element in the sequence.

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

    Returns logp if all conditions are true.

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

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

  6. def getNextHashCode: Int

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

  8. def getSeed(): Long

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

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

    Returns all indices of the given element in the traversable.

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

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

    Sums two probabilities in log space.

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

    Computes the sum of many probabilities in log space.

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

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

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

  17. lazy val random: Random

  18. def reachable[T](t: T, graph: (T) ⇒ Traversable[T]): Traversable[T]

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

    Find the elements that are reachable from a given element in a directed graph. The graph is represented as a function from T to List[T], where the list associated with an element is the list of nodes to which there is a directed edge from the element. The element on which reachable is called is not returned as one of the reachable elements.

    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.

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

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

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

  21. var seed: Long

  22. def setSeed(s: Long): Unit

    A random number generator.

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

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

Inherited from AnyRef

Inherited from Any

Ungrouped