Esempio n. 1
0
        /// <summary />
        /// <param name="Uses">Incoming message from <c>Uses</c>.</param>
        /// <param name="Def">Incoming message from <c>Def</c>. Must be a proper distribution. If uniform, the result will be uniform.</param>
        /// <param name="result">Modified to contain the outgoing message.</param>
        /// <returns>
        ///   <paramref name="result" />
        /// </returns>
        /// <remarks>
        ///   <para />
        /// </remarks>
        /// <exception cref="ImproperMessageException">
        ///   <paramref name="Def" /> is not a proper distribution.</exception>
        /// <typeparam name="T">The type of the messages.</typeparam>
        public static T MarginalMaxConditional <T>(IList <T> Uses, [SkipIfUniform] T Def, T result)
            where T : SettableToProduct <T>, SettableTo <T>
        {
            T res = UsesEqualDefOp.MarginalAverageConditional <T>(Uses, Def, result);

            if (res is UnnormalizedDiscrete)
            {
                ((UnnormalizedDiscrete)(object)res).SetMaxToZero();
            }
            return(res);
        }
Esempio n. 2
0
        /// <summary />
        /// <param name="Uses">Incoming message from <c>Uses</c>.</param>
        /// <param name="Def">Incoming message from <c>Def</c>. Must be a proper distribution. If uniform, the result will be uniform.</param>
        /// <param name="resultIndex">Index of the <c>Uses</c> for which a message is desired.</param>
        /// <param name="result">Modified to contain the outgoing message.</param>
        /// <returns>
        ///   <paramref name="result" />
        /// </returns>
        /// <remarks>
        ///   <para />
        /// </remarks>
        /// <exception cref="ImproperMessageException">
        ///   <paramref name="Def" /> is not a proper distribution.</exception>
        /// <typeparam name="T">The type of the messages.</typeparam>
        public static T UsesMaxConditional <T>([AllExceptIndex] IList <T> Uses, [SkipIfUniform] T Def, int resultIndex, T result)
            where T : SettableToProduct <T>, SettableTo <T>
        {
            T res = UsesEqualDefOp.UsesAverageConditional <T>(Uses, Def, resultIndex, result);

            if (res is UnnormalizedDiscrete)
            {
                ((UnnormalizedDiscrete)(object)res).SetMaxToZero();
            }
            return(res);
        }
Esempio n. 3
0
 /// <summary />
 /// <param name="Uses">Incoming message from <c>Uses</c>. 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 />
 /// </remarks>
 /// <exception cref="ImproperMessageException">
 ///   <paramref name="Uses" /> is not a proper distribution.</exception>
 /// <typeparam name="T">The type of the messages.</typeparam>
 public static T DefMaxConditional <T>([SkipIfAllUniform] IList <T> Uses, T result)
     where T : SettableToProduct <T>, SettableTo <T>, SettableToUniform
 {
     return(UsesEqualDefOp.DefAverageConditional <T>(Uses, result));
 }