ibis.util
Class Stats

java.lang.Object
  extended byibis.util.Stats

public final class Stats
extends java.lang.Object

Class for doing some recurring statistical calculations.


Method Summary
static double mbs(double bytes, double millis)
          Calculates a speed in Mb/s given the size in bytes and the time in milliseconds.
static double mbs(double bytes, double[] millis, int off, int len)
          Calculates a speed in Mb/s given the size in bytes and a number of times in milliseconds.
static double mean(double[] data)
          Calculates the mean of an array of numbers.
static double mean(double[] data, int off, int len)
          Calculates the mean of a subset of an array of numbers.
static double round(double v)
          Rounds up a double.
static double stdDev(double[] data)
          Calculates the standard deviation of an array of numbers.
static double stdDev(double[] data, int off, int len)
          Calculates the standard deviation of a subset of an array of numbers.
static double stdDevError(double[] data, int off, int len)
          Returns the standard deviation as a percentage of the mean.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

mean

public static double mean(double[] data)
Calculates the mean of an array of numbers.

Parameters:
data - the numbers to calculate the mean of.
Returns:
the mean.

mean

public static double mean(double[] data,
                          int off,
                          int len)
Calculates the mean of a subset of an array of numbers.

Parameters:
data - the numbers to calculate the mean of
off - offset
len - length
Returns:
the mean.

stdDev

public static double stdDev(double[] data)
Calculates the standard deviation of an array of numbers. See http://www.davidmlane.com/hyperstat/A16252.html

Parameters:
data - the numbers to calculate the standard deviation of.
Returns:
the standard deviation.

stdDev

public static double stdDev(double[] data,
                            int off,
                            int len)
Calculates the standard deviation of a subset of an array of numbers. See http://www.davidmlane.com/hyperstat/A16252.html

Parameters:
data - the numbers to calculate the standard deviation of
off - offset
len - length
Returns:
the standard deviation.

mbs

public static double mbs(double bytes,
                         double millis)
Calculates a speed in Mb/s given the size in bytes and the time in milliseconds. The result is rounded to one hundreth of an integer

Parameters:
bytes - size of the data in bytes
millis - the time of the measurement in milliseconds
Returns:
the speed.

mbs

public static double mbs(double bytes,
                         double[] millis,
                         int off,
                         int len)
Calculates a speed in Mb/s given the size in bytes and a number of times in milliseconds. The result is rounded to one hundreth of an integer.

Parameters:
bytes - size of the data in bytes
millis - a number of time measurements in milliseconds
off - the first measurement used in the calculation
len - the number of measurements used in the calculation
Returns:
the speed.

round

public static double round(double v)
Rounds up a double. Rounds to one hundreth of an integer.

Parameters:
v - the value to be rounded.
Returns:
the rounded value.

stdDevError

public static double stdDevError(double[] data,
                                 int off,
                                 int len)
Returns the standard deviation as a percentage of the mean. The result is rounded up to a hundredth of an integer.

Parameters:
data - array with input data (numbers)
off - offset in the data at which to start calculating
len - number of array elements to use for the calculation
Returns:
the standard deviation as a percentage.


The Ibis project