/// <summary>
        /// Returns the maximum difference between the parameters of this sparse Gamma list
        /// and another
        /// </summary>
        /// <param name="thatd">The other sparse Gamma list</param>
        /// <returns>The maximum difference</returns>
        /// <remarks><c>a.MaxDiff(b) == b.MaxDiff(a)</c></remarks>
        public double MaxDiff(object thatd)
        {
            SparseGammaList that = (SparseGammaList)thatd;

            return(Reduce <double, Gamma>(
                       double.NegativeInfinity, that, (x, y, z) => Math.Max(x, y.MaxDiff(z))));
        }
        /// <summary>
        /// Creates a sparse Gamma list of a given size with given shape and scale Vectors.
        /// </summary>
        /// <param name="shape">shape</param>
        /// <param name="scale">scale</param>
        /// <param name="tolerance">The tolerance for the approximation</param>
        public static SparseGammaList FromShapeAndScale(
            SparseVector shape, SparseVector scale, double tolerance)
        {
            var result = new SparseGammaList(shape.Count, tolerance);

            result.SetToFunction(shape, scale, (s, sc) => Gamma.FromShapeAndScale(s, sc));
            return(result);
        }
        /// <summary>
        /// Creates a sparse Gamma list of a given size with given shape and rate Vectors.
        /// </summary>
        /// <param name="shape">shape</param>
        /// <param name="rate">rate = 1/scale</param>
        /// <param name="tolerance">The tolerance for the approximation</param>
        public static SparseGammaList FromShapeAndRate(
            Vector shape, Vector rate, double tolerance)
        {
            var result = new SparseGammaList(shape.Count, tolerance);

            result.SetToFunction(shape, rate, (s, r) => Gamma.FromShapeAndRate(s, r));
            return(result);
        }
 /// <summary>
 /// Copy constructor
 /// </summary>
 /// <param name="that"></param>
 protected SparseGammaList(SparseGammaList that) : base(that)
 {
 }
 /// <summary>
 /// The expected logarithm of that sparse Gamma list under this sparse Gamma list.
 /// </summary>
 /// <param name="that"></param>
 /// <returns></returns>
 public double GetAverageLog(SparseGammaList that)
 {
     return(Reduce <double, Gamma>(0.0, that, (x, y, z) => x + y.GetAverageLog(z)));
 }
 /// <summary>
 /// Returns the log of the integral of the product of this sparse Gamma list and another sparse Gamma list raised to a power
 /// </summary>
 /// <param name="that"></param>
 public double GetLogAverageOfPower(SparseGammaList that, double power)
 {
     return(Reduce <double, Gamma>(0.0, that, (x, y, z) => x + y.GetLogAverageOfPower(z, power)));
 }
 /// <summary>
 /// Creates a sparse Gamma list whose elements match the means and variances
 /// of the weighted sums of the elements of two other sparse Gamma lists.
 /// </summary>
 /// <param name="weight1">The first weight</param>
 /// <param name="value1">The first sparse Gamma list</param>
 /// <param name="weight2">The second weight</param>
 /// <param name="value2">The second sparse Gamma list</param>
 public void SetToSum(double weight1, SparseGammaList value1, double weight2, SparseGammaList value2)
 {
     SetToFunction(value1, value2, (g1, g2) => { var g = new Gamma(); g.SetToSum(weight1, g1, weight2, g2); return(g); });
 }
 /// <summary>
 /// Sets this sparse Gamma list to the ratio of two other sparse Gamma lists
 /// </summary>
 /// <param name="numerator"></param>
 /// <param name="denominator"></param>
 public void SetToRatio(SparseGammaList numerator, SparseGammaList denominator)
 {
     SetToFunction(numerator, denominator, (gn, gd) => gn / gd);
 }
 /// <summary>
 /// Sets this sparse Gamma list to the power of another sparse Gamma list
 /// </summary>
 /// <param name="value"></param>
 /// <param name="exponent"></param>
 public void SetToPower(SparseGammaList value, double exponent)
 {
     SetToFunction(value, g => g ^ exponent);
 }
 /// <summary>
 /// Sets this sparse Gamma list to the product of two other sparse Gamma lists
 /// </summary>
 /// <param name="a"></param>
 /// <param name="b"></param>
 public void SetToProduct(SparseGammaList a, SparseGammaList b)
 {
     SetToFunction(a, b, (ga, gb) => ga * gb);
 }
 /// <summary>
 /// Sets this sparse Gamma list to another sparse Gamma list
 /// </summary>
 /// <param name="value"></param>
 public void SetTo(SparseGammaList value)
 {
     base.SetTo(value);
 }