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