/// <summary>
        /// Creates a point mass SparseBetaList
        /// </summary>
        /// <param name="probsTrue"></param>
        /// <returns></returns>
        public static SparseBetaList PointMass(SparseVector probsTrue)
        {
            var            falseCounts = SparseVector.Constant(probsTrue.Count, double.PositiveInfinity);
            SparseBetaList sbl         = new SparseBetaList(probsTrue, falseCounts);

            return(sbl);
        }
        /// <summary>
        /// The maximum 'difference' between corresponding Beta elements.
        /// </summary>
        public double MaxDiff(object thatd)
        {
            SparseBetaList that = (SparseBetaList)thatd;
            // differences in true counts
            SparseVector trueDiff = SparseVector.Zero(Count);

            trueDiff.SetToFunction(TrueCounts, that.TrueCounts, (a, b) => MMath.AbsDiff(a, b));
            // differences in false counts
            SparseVector falseDiff = SparseVector.Zero(Count);

            falseDiff.SetToFunction(FalseCounts, that.FalseCounts, (a, b) => MMath.AbsDiff(a, b));
            // max overall difference
            return(Math.Max(trueDiff.Max(), falseDiff.Max()));
        }
 public double GetLogAverageOfPower(SparseBetaList that, double power)
 {
     throw new NotImplementedException();
 }
 /// <summary>
 /// Gets the expected logarithm of that distribution under this distribution.
 /// </summary>
 /// <param name="that">The distribution to take the logarithm of.</param>
 /// <returns><c>sum_x this.Evaluate(x)*Math.Log(that.Evaluate(x))</c></returns>
 /// <remarks>Not yet implemented.</remarks>
 public double GetAverageLog(SparseBetaList that)
 {
     throw new NotImplementedException();
 }
 /// <summary>
 /// Sets this sparse Bernoulli list to the ratio of two others (which must be of the same size)
 /// </summary>
 /// <param name="numerator"></param>
 /// <param name="denominator"></param>
 public void SetToRatio(SparseBetaList numerator, SparseBetaList denominator)
 {
     throw new NotImplementedException();
 }
 /// <summary>
 /// Sets this sparse Bernoulli list to the weighted sum of two others (which must be of the same size)
 /// </summary>
 /// <param name="weight1"></param>
 /// <param name="value1"></param>
 /// <param name="weight2"></param>
 /// <param name="value2"></param>
 public void SetToSum(double weight1, SparseBetaList value1, double weight2, SparseBetaList value2)
 {
     throw new NotImplementedException();
 }
 /// <summary>
 /// Sets this Beta list to a copy of another Beta list.
 /// </summary>
 /// <param name="value">The list to copy</param>
 public void SetTo(SparseBetaList value)
 {
     TrueCounts.SetTo(value.TrueCounts);
     FalseCounts.SetTo(value.FalseCounts);
 }
 /// <summary>
 /// Sets the parameters to represent the list of sparse Betas raised to some power.
 /// </summary>
 /// <param name="betaList">The list of Betas</param>
 /// <param name="exponent">The exponent</param>
 public void SetToPower(SparseBetaList betaList, double exponent)
 {
     // TODO: handle point masses
     TrueCounts.SetToFunction(betaList.TrueCounts, x => exponent * (x - 1) + 1);
     FalseCounts.SetToFunction(betaList.FalseCounts, x => exponent * (x - 1) + 1);
 }
 /// <summary>
 /// Sets to the product of two sparse lists of Betas.
 /// </summary>
 /// <param name="a">The first sparse list of Betas</param>
 /// <param name="b">The second sparse list of Betas</param>
 /// <remarks>
 /// The result may not be proper, i.e. its parameters may be negative.
 /// For example, if you multiply Beta(0.1,0.1) by itself you get Beta(-0.8, -0.8).
 /// No error is thrown in this case.
 /// </remarks>
 public void SetToProduct(SparseBetaList a, SparseBetaList b)
 {
     // TODO: handle point masses
     TrueCounts.SetToFunction(a.TrueCounts, b.TrueCounts, (x, y) => x + y - 1);
     FalseCounts.SetToFunction(a.FalseCounts, b.FalseCounts, (x, y) => x + y - 1);
 }