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

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

  11. class NegativeProbabilityException extends InvalidDistributionException

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

  13. abstract class Resampler[T] extends AnyRef

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

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

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

  15. class ZeroTotalUnnormalizedProbabilityException extends InvalidDistributionException

Value Members

  1. object ColorGradient

  2. object HashMultiSet

  3. object PriorityMap

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

    Finds the index of the maximal element in the sequence.

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

    Returns logp if all conditions are true.

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

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

  7. def getNextHashCode: Int

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

  9. def getSeed(): Long

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

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

    Returns all indices of the given element in the traversable.

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

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

    Sums two probabilities in log space.

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

    Computes the sum of many probabilities in log space.

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

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

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

  18. lazy val random: Random

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

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

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

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

  22. var seed: Long

  23. def setSeed(s: Long): Unit

    A random number generator.

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

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

  26. package visualization

Inherited from AnyRef

Inherited from Any

Ungrouped