/// <summary>
        /// Returns a new instance of the <see cref="BernoulliIntegerSubset"/> class from a sparse list of Bernoulli distributions.
        /// </summary>
        /// <param name="bernoullis">The sparse list of Bernoulli distributions.</param>
        /// <param name="tolerance">The tolerance.</param>
        /// <returns>The new <see cref="BernoulliIntegerSubset"/> instance.</returns>
        public static BernoulliIntegerSubset FromSparseList(ISparseList <Bernoulli> bernoullis, double tolerance)
        {
            var result = new BernoulliIntegerSubset();

            result.SparseBernoulliList = SparseBernoulliList.FromSparseList(bernoullis, tolerance);
            return(result);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="BernoulliIntegerSubset"/> class
        /// with the specified number of elements all of which are set to the specified <see cref="Bernoulli"/> instance.
        /// </summary>
        /// <param name="size">The size of the list.</param>
        /// <param name="commonValue">The common value.</param>
        /// <param name="tolerance">The tolerance for the approximation.</param>
        /// <returns>The new <see cref="BernoulliIntegerSubset"/> instance.</returns>
        public static BernoulliIntegerSubset FromBernoulli(int size, Bernoulli commonValue, double tolerance)
        {
            var result = new BernoulliIntegerSubset();

            result.SparseBernoulliList = SparseBernoulliList.Constant(size, commonValue, tolerance);
            return(result);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="BernoulliIntegerSubset"/> class
        /// with the specified number of elements all of which are set to uniform.
        /// </summary>
        /// <param name="size">The size of the list.</param>
        /// <param name="tolerance">The tolerance for the approximation.</param>
        /// <returns>The new <see cref="BernoulliIntegerSubset"/> instance.</returns>
        public static BernoulliIntegerSubset FromSize(int size, double tolerance)
        {
            var result = new BernoulliIntegerSubset();

            result.SparseBernoulliList = SparseBernoulliList.FromSize(size, tolerance);
            return(result);
        }
        /// <summary>
        /// Returns a new instance of the <see cref="BernoulliIntegerSubset"/> class of a given size
        /// from a sparse list of log odds.
        /// </summary>
        /// <param name="logOdds">The sparse list of log odds.</param>
        /// <param name="tolerance">The tolerance for the approximation.</param>
        /// <returns>The new <see cref="BernoulliIntegerSubset"/> instance.</returns>
        public static BernoulliIntegerSubset FromLogOdds(
            ISparseList <double> logOdds, double tolerance)
        {
            BernoulliIntegerSubset result = new BernoulliIntegerSubset();

            result.SparseBernoulliList = SparseBernoulliList.FromLogOdds(logOdds, tolerance);
            return(result);
        }
        /// <summary>
        /// Returns a new instance of the <see cref="BernoulliIntegerSubset"/> class of a given size
        /// from a sparse list of probability true.
        /// </summary>
        /// <param name="probTrue">The sparse list of probability of true.</param>
        /// <param name="tolerance">The tolerance for the approximation.</param>
        /// <returns>The new <see cref="BernoulliIntegerSubset"/> instance.</returns>
        public static BernoulliIntegerSubset FromProbTrue(
            ISparseList <double> probTrue, double tolerance)
        {
            BernoulliIntegerSubset result = new BernoulliIntegerSubset();

            result.SparseBernoulliList = SparseBernoulliList.FromProbTrue(probTrue, tolerance);
            return(result);
        }
        public static BernoulliIntegerSubset FromSparseValues(
            int size,
            Bernoulli commonValue,
            List <ValueAtIndex <Bernoulli> > sortedSparseValues,
            double tolerance)
        {
            var result = new BernoulliIntegerSubset();

            result.SparseBernoulliList = SparseBernoulliList.FromSparseValues(size, commonValue, sortedSparseValues, tolerance);
            return(result);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="BernoulliIntegerSubset"/> class from a <see cref="SparseBernoulliList"/> instance.
 /// </summary>
 /// <param name="sparseBernoulliList"><see cref="SparseBernoulliList"/> instance.</param>
 protected BernoulliIntegerSubset(SparseBernoulliList sparseBernoulliList)
 {
     SparseBernoulliList = (SparseBernoulliList)SparseBernoulliList.Clone();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="BernoulliIntegerSubset"/> class from a sparse list of <see cref="Bernoulli"/> distributions.
 /// </summary>
 /// <param name="bernoullis">The sparse list of Bernoulli distributions.</param>
 protected BernoulliIntegerSubset(ISparseList <Bernoulli> bernoullis)
 {
     SparseBernoulliList = SparseBernoulliList.FromSparseList(bernoullis);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="BernoulliIntegerSubset"/> class
 /// of a given length and assigns all elements the given value,
 /// except for the specified list of sparse values. This list is stored internally as is,
 /// so MUST be sorted by index and must not be modified externally after being passed in.
 /// </summary>
 /// <param name="size">The size of the list.</param>
 /// <param name="commonValue">The common value.</param>
 /// <param name="sortedSparseValues">The sorted list of non-common values.</param>
 protected BernoulliIntegerSubset(int size, Bernoulli commonValue, List <ValueAtIndex <Bernoulli> > sortedSparseValues)
 {
     SparseBernoulliList = SparseBernoulliList.FromSparseValues(size, commonValue, sortedSparseValues);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="BernoulliIntegerSubset"/> class
 /// of the given size, and assigns all elements to the specified common value.
 /// </summary>
 /// <param name="size">The size of the list.</param>
 /// <param name="commonValue">The common value.</param>
 protected BernoulliIntegerSubset(int size, Bernoulli commonValue)
 {
     SparseBernoulliList = SparseBernoulliList.Constant(size, commonValue);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="BernoulliIntegerSubset"/> class
 /// with the specified number of elements all of which are set to uniform.
 /// </summary>
 /// <param name="size">The size of the list.</param>
 protected BernoulliIntegerSubset(int size)
 {
     SparseBernoulliList = SparseBernoulliList.FromSize(size);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="BernoulliIntegerSubset"/> class.
 /// </summary>
 public BernoulliIntegerSubset()
 {
     SparseBernoulliList = new SparseBernoulliList();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="BernoulliIntegerSubset"/> class from a sparse list of Bernoulli distributions.
 /// </summary>
 /// <param name="bernoullis">The sparse list of Bernoulli distributions.</param>
 /// <param name="tolerance">The tolerance.</param>
 protected BernoulliIntegerSubset(ISparseList <Bernoulli> bernoullis, double tolerance)
 {
     SparseBernoulliList = SparseBernoulliList.FromSparseList(bernoullis, tolerance);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="BernoulliIntegerSubset"/> class
 /// with the specified number of elements all of which are set to uniform.
 /// </summary>
 /// <param name="size">The size of the list.</param>
 /// <param name="tolerance">The tolerance for the approximation.</param>
 protected BernoulliIntegerSubset(int size, double tolerance)
 {
     SparseBernoulliList = SparseBernoulliList.FromSize(size, tolerance);
 }