コード例 #1
0
        /// <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);
        }
コード例 #2
0
        /// <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);
        }
コード例 #3
0
        /// <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);
        }
コード例 #4
0
        /// <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);
        }
コード例 #5
0
        /// <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);
        }
コード例 #6
0
        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);
        }
コード例 #7
0
 /// <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();
 }
コード例 #8
0
 /// <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);
 }
コード例 #9
0
 /// <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);
 }
コード例 #10
0
 /// <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);
 }
コード例 #11
0
 /// <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);
 }
コード例 #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BernoulliIntegerSubset"/> class.
 /// </summary>
 public BernoulliIntegerSubset()
 {
     SparseBernoulliList = new SparseBernoulliList();
 }
コード例 #13
0
 /// <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);
 }
コード例 #14
0
 /// <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);
 }