Class SampleCategoricalDistribution

java.lang.Object
dk.alexandra.fresco.stat.sampling.SampleCategoricalDistribution
All Implemented Interfaces:
dk.alexandra.fresco.framework.builder.Computation<dk.alexandra.fresco.framework.value.SInt,​dk.alexandra.fresco.framework.builder.numeric.ProtocolBuilderNumeric>

public class SampleCategoricalDistribution
extends Object
implements dk.alexandra.fresco.framework.builder.Computation<dk.alexandra.fresco.framework.value.SInt,​dk.alexandra.fresco.framework.builder.numeric.ProtocolBuilderNumeric>
Sample an element from a categorical distribution.
  • Constructor Details

    • SampleCategoricalDistribution

      public SampleCategoricalDistribution​(List<dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed>> probabilities, boolean normalized)
      Parameters:
      probabilities - The i'th element of this list is the probability of drawing i from this distribution.
      normalized - Does the probabilities sum to 1? If not, the computation handles the normalization.
    • SampleCategoricalDistribution

      public SampleCategoricalDistribution​(double[] probabilities)
  • Method Details

    • buildComputation

      public dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.framework.value.SInt> buildComputation​(dk.alexandra.fresco.framework.builder.numeric.ProtocolBuilderNumeric root)
      Specified by:
      buildComputation in interface dk.alexandra.fresco.framework.builder.Computation<dk.alexandra.fresco.framework.value.SInt,​dk.alexandra.fresco.framework.builder.numeric.ProtocolBuilderNumeric>