예제 #1
0
 public void SetToRatio(Pareto numerator, Pareto denominator, bool forceProper = false)
 {
     if (string.Empty.Length == 0)
     {
         throw new NotSupportedException();
     }
     if (numerator.IsPointMass)
     {
         if (denominator.IsPointMass)
         {
             if (numerator.Point.Equals(denominator.Point))
             {
                 SetToUniform();
             }
             else
             {
                 throw new DivideByZeroException();
             }
         }
         else
         {
             Point = numerator.Point;
         }
     }
     else if (denominator.IsPointMass || denominator.LowerBound > numerator.LowerBound)
     {
         throw new DivideByZeroException();
     }
     else
     {
         this.LowerBound = numerator.LowerBound;
         this.Shape      = numerator.Shape - denominator.Shape - 1;
     }
 }
예제 #2
0
        /// <summary>
        /// Static product operator. Create a Pareto distribution which is the product of
        /// two Pareto distributions
        /// </summary>
        /// <param name="a">The first distribution</param>
        /// <param name="b">The second distribution</param>
        /// <returns>The resulting distribution</returns>
        public static Pareto operator *(Pareto a, Pareto b)
        {
            Pareto result = new Pareto();

            result.SetToProduct(a, b);
            return(result);
        }
예제 #3
0
        public double MaxDiff(object that)
        {
            if (!(that is Pareto))
            {
                return(double.PositiveInfinity);
            }
            Pareto thatd = (Pareto)that;

            return(Math.Max(Math.Abs(this.LowerBound - thatd.LowerBound), Math.Abs(this.Shape - thatd.Shape)));
        }
예제 #4
0
 public double GetLogAverageOf(Pareto that)
 {
     if (IsPointMass)
     {
         return(that.GetLogProb(Point));
     }
     else if (that.IsPointMass)
     {
         return(GetLogProb(that.Point));
     }
     else
     {
         Pareto product = this * that;
         return(product.GetLogNormalizer() - this.GetLogNormalizer() - that.GetLogNormalizer());
     }
 }
예제 #5
0
 public void SetToProduct(Pareto a, Pareto b)
 {
     if (a.IsPointMass || b.IsUniform())
     {
         if (b.IsPointMass && !a.Point.Equals(b.Point))
         {
             throw new AllZeroException();
         }
         SetTo(a);
     }
     else if (b.IsPointMass || a.IsUniform())
     {
         SetTo(b);
     }
     else
     {
         this.LowerBound = Math.Max(a.LowerBound, b.LowerBound);
         this.Shape      = a.Shape + b.Shape + 1;
     }
 }
예제 #6
0
 public void SetTo(Pareto that)
 {
     this.Shape      = that.Shape;
     this.LowerBound = that.LowerBound;
 }
예제 #7
0
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="that"></param>
 public Pareto(Pareto that)
     : this(that.Shape, that.LowerBound)
 {
 }
예제 #8
0
 public double GetAverageLog(Pareto that)
 {
     throw new NotImplementedException();
 }
예제 #9
0
 public double GetLogAverageOfPower(Pareto that, double power)
 {
     throw new NotImplementedException();
 }
예제 #10
0
 public void SetToSum(double weight1, Pareto value1, double weight2, Pareto value2)
 {
     throw new NotImplementedException();
 }
예제 #11
0
 public void SetToPower(Pareto value, double exponent)
 {
     throw new NotImplementedException();
 }