/// <summary> /// The log-probability that two distributions would draw the same sample. /// </summary> /// <param name="that"></param> /// <returns><c>Math.Log(sum_x this.Evaluate(x)*that.Evaluate(x))</c></returns> /// <remarks>This can be considered a type of inner product between distributions. /// Another name might be "LogAverage" to go with "GetAverageLog". /// For a DistributionArray, this specializes to: /// <c>sum_i Math.Log(sum_x this[i].Evaluate(x)*that[i].Evaluate(x))</c> /// = <c>sum_i this[i].GetLogAverageOf(that[i])</c> /// </remarks> public double GetLogAverageOf(DistributionRefArray <T, DomainType> that) { return(Distribution.GetLogAverageOf(array, that.array)); }
/// <summary> /// Get the integral of this distribution times another distribution raised to a power. /// </summary> /// <param name="that"></param> /// <param name="power"></param> /// <returns></returns> public double GetLogAverageOfPower(DistributionRefArray <T, DomainType> that, double power) { return(Distribution.GetLogAverageOfPower(array, that.array, power)); }
/// <summary> /// Set the parameters to match the moments of a mixture of two distributions /// </summary> /// <param name="weight1">The first weight</param> /// <param name="a">The first distribution array</param> /// <param name="weight2">The second weight</param> /// <param name="b">The second distribution array</param> public void SetToSum(double weight1, DistributionRefArray <T, DomainType> a, double weight2, DistributionRefArray <T, DomainType> b) { Distribution.SetToSum(array, weight1, a.array, weight2, b.array); }
/// <summary> /// Set the parameters to represent the power of a source distribution to some exponent /// </summary> /// <param name="a">The source distribution array</param> /// <param name="exponent">The exponent</param> public void SetToPower(DistributionRefArray <T, DomainType> a, double exponent) { Distribution.SetToPower(array, a.array, exponent); }
/// <summary> /// Set the parameters to represent the ratio of two distributions /// </summary> /// <param name="numerator">The numerator distribution array</param> /// <param name="denominator">The denominator distribution array</param> /// <param name="forceProper">Argument passed to T.SetToRatio</param> public void SetToRatio(DistributionRefArray <T, DomainType> numerator, DistributionRefArray <T, DomainType> denominator, bool forceProper) { Distribution.SetToRatio(array, numerator.array, denominator.array, forceProper); }
/// <summary> /// Set the parameters to represent the product of two distributions /// </summary> /// <param name="a">The first distribution array</param> /// <param name="b">The second distribution array</param> public void SetToProduct(DistributionRefArray <T, DomainType> a, DistributionRefArray <T, DomainType> b) { Distribution.SetToProduct(array, a.array, b.array); }
/// <summary> /// Set the parameters of this distribution to match those of the given distribution (by value) /// </summary> /// <param name="that"></param> public void SetTo(DistributionRefArray <T, DomainType> that) { base.SetTo(that); }