/// <summary> /// Creates a new Gamma which the product of two other Gammas /// </summary> /// <param name="a">First Gamma</param> /// <param name="b">Second Gamma</param> /// <returns>Result</returns> public static Gamma operator *(Gamma a, Gamma b) { Gamma result = new Gamma(); result.SetToProduct(a, b); return(result); }
/// <summary> /// Set this distribution equal to the product of a and b /// </summary> /// <param name="a"></param> /// <param name="b"></param> public void SetToProduct(TruncatedGamma a, TruncatedGamma b) { LowerBound = Math.Max(a.LowerBound, b.LowerBound); UpperBound = Math.Min(a.UpperBound, b.UpperBound); if (LowerBound > UpperBound) { throw new AllZeroException(); } if (LowerBound == UpperBound) { Gamma.Point = LowerBound; } else { Gamma.SetToProduct(a.Gamma, b.Gamma); } }