/// <summary> /// EP message to 'fromArray' /// </summary> /// <param name="array">Incoming message from 'data'. Must be a proper distribution. If all elements are uniform, the result will be uniform.</param> /// <param name="result">Modified to contain the outgoing message</param> /// <returns><paramref name="result"/></returns> /// <remarks><para> /// The outgoing message is a distribution matching the moments of 'fromArray' as the random arguments are varied. /// The formula is <c>proj[p(fromArray) sum_(data) p(data) factor(fromArray,data)]/p(fromArray)</c>. /// </para></remarks> /// <exception cref="ImproperMessageException"><paramref name="array"/> is not a proper distribution</exception> // TM: SkipIfAllUniform would be more accurate but leads to half-uniform distributions public static VectorGaussian VectorAverageConditional([SkipIfAnyUniform] IList <Gaussian> array, VectorGaussian result) { return(ArrayFromVectorOp.VectorAverageConditional(array, result)); }
/// <summary> /// EP message to 'data' /// </summary> /// <param name="vector">Incoming message from 'fromArray'. Must be a proper distribution. If any element is uniform, the result will be uniform.</param> /// <param name="array">Incoming message from 'data'.</param> /// <param name="to_vector">Outgoing message to 'vector'.</param> /// <param name="result">Modified to contain the outgoing message</param> /// <returns><paramref name="result"/></returns> /// <remarks><para> /// The outgoing message is a distribution matching the moments of 'data' as the random arguments are varied. /// The formula is <c>proj[p(data) sum_(fromArray) p(fromArray) factor(fromArray,data)]/p(data)</c>. /// </para></remarks> /// <exception cref="ImproperMessageException"><paramref name="vector"/> is not a proper distribution</exception> public static GaussianList ArrayAverageConditional <GaussianList>([SkipIfUniform] VectorGaussian vector, IList <Gaussian> array, [Fresh] VectorGaussian to_vector, GaussianList result) where GaussianList : IList <Gaussian> { return(ArrayFromVectorOp.ArrayAverageConditional <GaussianList>(array, vector, to_vector, result)); }
/// <summary>EP message to <c>fromArray</c>.</summary> /// <param name="array">Incoming message from <c>data</c>.</param> /// <param name="result">Modified to contain the outgoing message.</param> /// <returns> /// <paramref name="result" /> /// </returns> /// <remarks> /// <para>The outgoing message is a distribution matching the moments of <c>fromArray</c> as the random arguments are varied. The formula is <c>proj[p(fromArray) sum_(data) p(data) factor(fromArray,data)]/p(fromArray)</c>.</para> /// </remarks> public static VectorGaussian VectorAverageConditional( [SkipIfAnyUniform] IList <Gaussian> array, VectorGaussian result) // TM: SkipIfAllUniform would be more accurate but leads to half-uniform distributions { return(ArrayFromVectorOp.VectorAverageConditional(array, result)); }