C# Class Redzen.Numerics.NumericsUtils

Exibir arquivo Open project: colgreen/Redzen

Public Methods

Method Description
BuildHistogramData ( double valArr, int categoryCount ) : HistogramData

Calculate a frequency distribution for the provided array of values. 1) The minimum and maximum values are found. 2) The resulting value range is divided into equal sized sub-ranges (categoryCount). 3) The number of values that fall into each category is determined.

CalculateMedian ( IList valueList ) : double

Calculates the median value in a list of sorted values.

ProbabilisticRound ( double val, XorShiftRandom rng ) : double

Rounds up or down to a whole number by using the fractional part of the input value as the probability that the value will be rounded up. This is useful if we wish to round values and then sum them without generating a rounding bias. For monetary rounding this problem is solved with rounding to e.g. the nearest even number which then causes a bias towards even numbers. This solution is more appropriate for certain types of scientific values.

Method Details

BuildHistogramData() public static method

Calculate a frequency distribution for the provided array of values. 1) The minimum and maximum values are found. 2) The resulting value range is divided into equal sized sub-ranges (categoryCount). 3) The number of values that fall into each category is determined.
public static BuildHistogramData ( double valArr, int categoryCount ) : HistogramData
valArr double
categoryCount int
return HistogramData

CalculateMedian() public static method

Calculates the median value in a list of sorted values.
public static CalculateMedian ( IList valueList ) : double
valueList IList
return double

ProbabilisticRound() public static method

Rounds up or down to a whole number by using the fractional part of the input value as the probability that the value will be rounded up. This is useful if we wish to round values and then sum them without generating a rounding bias. For monetary rounding this problem is solved with rounding to e.g. the nearest even number which then causes a bias towards even numbers. This solution is more appropriate for certain types of scientific values.
public static ProbabilisticRound ( double val, XorShiftRandom rng ) : double
val double
rng XorShiftRandom
return double