/// <summary>Evidence message for EP.</summary> /// <param name="sum">Constant value for <c>sum</c>.</param> /// <param name="array">Constant value for <c>array</c>.</param> /// <returns>Logarithm of the factor's average value across the given argument distributions.</returns> /// <remarks> /// <para>The formula for the result is <c>log(factor(sum,array))</c>.</para> /// </remarks> public static double LogAverageFactor(Vector sum, IList <Vector> array) { if (sum == null) { throw new ArgumentNullException("sum"); } if (array == null) { throw new ArgumentNullException("array"); } if (array.Count == 0) { return((sum == Vector.Zero(sum.Count)) ? 0.0 : double.NegativeInfinity); } return((sum == Factor.Sum(array)) ? 0.0 : double.NegativeInfinity); }
/// <summary>Evidence message for EP.</summary> /// <param name="sum">Constant value for <c>sum</c>.</param> /// <param name="array">Constant value for <c>array</c>.</param> /// <returns>Logarithm of the factor's average value across the given argument distributions.</returns> /// <remarks> /// <para>The formula for the result is <c>log(factor(sum,array))</c>.</para> /// </remarks> public static double LogAverageFactor(double sum, IList <double> array) { return((sum == Factor.Sum(array)) ? 0.0 : Double.NegativeInfinity); }