Exemplo n.º 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;
     }
 }
Exemplo n.º 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);
        }
Exemplo n.º 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)));
        }
Exemplo n.º 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());
     }
 }
Exemplo n.º 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;
     }
 }
Exemplo n.º 6
0
 public void SetTo(Pareto that)
 {
     this.Shape      = that.Shape;
     this.LowerBound = that.LowerBound;
 }
Exemplo n.º 7
0
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="that"></param>
 public Pareto(Pareto that)
     : this(that.Shape, that.LowerBound)
 {
 }
Exemplo n.º 8
0
 public double GetAverageLog(Pareto that)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 9
0
 public double GetLogAverageOfPower(Pareto that, double power)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 10
0
 public void SetToSum(double weight1, Pareto value1, double weight2, Pareto value2)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 11
0
 public void SetToPower(Pareto value, double exponent)
 {
     throw new NotImplementedException();
 }