/// <summary> /// Applies a specified map to a value with its associated likelyhood. /// </summary> /// <typeparam name="S">The result type</typeparam> /// <param name="f">The map.</param> /// <param name="v">The value.</param> /// <returns>The mapped value with its associated likelyhood.</returns> public static ProbValue <S> Map <S>(Func <T, S> f, ProbValue <T> v) { return(v.Map(f)); }
private static Dist <S> Map <S>(Dist <T> distribution, Func <T, S> f) { return(new Dist <S>(distribution.values.Select(v => ProbValue <T> .Map(f, v)))); }