/// <summary> /// Returns 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> /// <param name="tolerance">The tolerance for the approximation.</param> /// <returns>The new <see cref="BernoulliIntegerSubset"/> instance.</returns> 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 /// 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); }