Parallel Colt 0.7.2

hep.aida.tfloat.bin
Class MightyStaticFloatBin1D

java.lang.Object
  extended by cern.colt.PersistentObject
      extended by hep.aida.tfloat.bin.AbstractFloatBin
          extended by hep.aida.tfloat.bin.AbstractFloatBin1D
              extended by hep.aida.tfloat.bin.StaticFloatBin1D
                  extended by hep.aida.tfloat.bin.MightyStaticFloatBin1D
All Implemented Interfaces:
FloatBufferConsumer, Serializable, Cloneable
Direct Known Subclasses:
QuantileFloatBin1D

public class MightyStaticFloatBin1D
extends StaticFloatBin1D

Static and the same as its superclass, except that it can do more: Additionally computes moments of arbitrary integer order, harmonic mean, geometric mean, etc. Constructors need to be told what functionality is required for the given use case. Only maintains aggregate measures (incrementally) - the added elements themselves are not kept.

Version:
0.9, 03-Jul-99
Author:
wolfgang.hoschek@cern.ch
See Also:
Serialized Form

Field Summary
 
Fields inherited from class cern.colt.PersistentObject
serialVersionUID
 
Constructor Summary
MightyStaticFloatBin1D()
          Constructs and returns an empty bin with limited functionality but good performance; equivalent to MightyStaticBin1D(false,false,4).
MightyStaticFloatBin1D(boolean hasSumOfLogarithms, boolean hasSumOfInversions, int maxOrderForSumOfPowers)
          Constructs and returns an empty bin with the given capabilities.
 
Method Summary
 void addAllOfFromTo(FloatArrayList list, int from, int to)
          Adds the part of the specified list between indexes from (inclusive) and to (inclusive) to the receiver.
 Object clone()
          Returns a deep copy of the receiver.
 String compareWith(AbstractFloatBin1D other)
          Computes the deviations from the receiver's measures to another bin's measures.
 float geometricMean()
          Returns the geometric mean, which is Product( x[i] )1.0/size().
 int getMaxOrderForSumOfPowers()
          Returns the maximum order k for which sums of powers are retrievable, as specified upon instance construction.
 int getMinOrderForSumOfPowers()
          Returns the minimum order k for which sums of powers are retrievable, as specified upon instance construction.
 float harmonicMean()
          Returns the harmonic mean, which is size() / Sum( 1/x[i] ).
 boolean hasSumOfInversions()
          Returns whether sumOfInversions() can return meaningful results.
 boolean hasSumOfLogarithms()
          Tells whether sumOfLogarithms() can return meaningful results.
 boolean hasSumOfPowers(int k)
          Tells whether sumOfPowers(k) can return meaningful results.
 float kurtosis()
          Returns the kurtosis (aka excess), which is -3 + moment(4,mean()) / standardDeviation()4.
 float moment(int k, float c)
          Returns the moment of k-th order with value c, which is Sum( (x[i]-c)k ) / size().
 float product()
          Returns the product, which is Prod( x[i] ).
 float skew()
          Returns the skew, which is moment(3,mean()) / standardDeviation()3.
 float sumOfInversions()
          Returns the sum of inversions, which is Sum( 1 / x[i] ).
 float sumOfLogarithms()
          Returns the sum of logarithms, which is Sum( Log(x[i]) ).
 float sumOfPowers(int k)
          Returns the k-th order sum of powers, which is Sum( x[i]k ).
 String toString()
          Returns a String representation of the receiver.
 
Methods inherited from class hep.aida.tfloat.bin.StaticFloatBin1D
add, clear, isRebinnable, max, min, size, sum, sumOfSquares
 
Methods inherited from class hep.aida.tfloat.bin.AbstractFloatBin1D
addAllOf, buffered, equals, mean, rms, standardDeviation, standardError, trimToSize, variance
 
Methods inherited from class hep.aida.tfloat.bin.AbstractFloatBin
center, center, error, error, offset, offset, value, value
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MightyStaticFloatBin1D

public MightyStaticFloatBin1D()
Constructs and returns an empty bin with limited functionality but good performance; equivalent to MightyStaticBin1D(false,false,4).


MightyStaticFloatBin1D

public MightyStaticFloatBin1D(boolean hasSumOfLogarithms,
                              boolean hasSumOfInversions,
                              int maxOrderForSumOfPowers)
Constructs and returns an empty bin with the given capabilities.

Parameters:
hasSumOfLogarithms - Tells whether sumOfLogarithms() can return meaningful results. Set this parameter to false if measures of sum of logarithms, geometric mean and product are not required.

hasSumOfInversions - Tells whether sumOfInversions() can return meaningful results. Set this parameter to false if measures of sum of inversions, harmonic mean and sumOfPowers(-1) are not required.

maxOrderForSumOfPowers - The maximum order k for which sumOfPowers(int) can return meaningful results. Set this parameter to at least 3 if the skew is required, to at least 4 if the kurtosis is required. In general, if moments are required set this parameter at least as large as the largest required moment. This method always substitutes Math.max(2,maxOrderForSumOfPowers) for the parameter passed in. Thus, sumOfPowers(0..2) always returns meaningful results.
See Also:
hasSumOfPowers(int), moment(int,float)
Method Detail

addAllOfFromTo

public void addAllOfFromTo(FloatArrayList list,
                           int from,
                           int to)
Adds the part of the specified list between indexes from (inclusive) and to (inclusive) to the receiver.

Overrides:
addAllOfFromTo in class StaticFloatBin1D
Parameters:
list - the list of which elements shall be added.
from - the index of the first element to be added (inclusive).
to - the index of the last element to be added (inclusive).
Throws:
IndexOutOfBoundsException - if list.size()>0 && (from<0 || from>to || to>=list.size()) .

clone

public Object clone()
Returns a deep copy of the receiver.

Overrides:
clone in class PersistentObject
Returns:
a deep copy of the receiver.

compareWith

public String compareWith(AbstractFloatBin1D other)
Computes the deviations from the receiver's measures to another bin's measures.

Overrides:
compareWith in class AbstractFloatBin1D
Parameters:
other - the other bin to compare with
Returns:
a summary of the deviations.

geometricMean

public float geometricMean()
Returns the geometric mean, which is Product( x[i] )1.0/size(). This method tries to avoid overflows at the expense of an equivalent but somewhat inefficient definition: geoMean = exp( Sum( Log(x[i]) ) / size()). Note that for a geometric mean to be meaningful, the minimum of the data sequence must not be less or equal to zero.

Returns:
the geometric mean; Float.NaN if !hasSumOfLogarithms().

getMaxOrderForSumOfPowers

public int getMaxOrderForSumOfPowers()
Returns the maximum order k for which sums of powers are retrievable, as specified upon instance construction.

See Also:
hasSumOfPowers(int), sumOfPowers(int)

getMinOrderForSumOfPowers

public int getMinOrderForSumOfPowers()
Returns the minimum order k for which sums of powers are retrievable, as specified upon instance construction.

See Also:
hasSumOfPowers(int), sumOfPowers(int)

harmonicMean

public float harmonicMean()
Returns the harmonic mean, which is size() / Sum( 1/x[i] ). Remember: If the receiver contains at least one element of 0.0, the harmonic mean is 0.0.

Returns:
the harmonic mean; Float.NaN if !hasSumOfInversions().
See Also:
hasSumOfInversions()

hasSumOfInversions

public boolean hasSumOfInversions()
Returns whether sumOfInversions() can return meaningful results.

Returns:
false if the bin was constructed with insufficient parametrization, true otherwise. See the constructors for proper parametrization.

hasSumOfLogarithms

public boolean hasSumOfLogarithms()
Tells whether sumOfLogarithms() can return meaningful results.

Returns:
false if the bin was constructed with insufficient parametrization, true otherwise. See the constructors for proper parametrization.

hasSumOfPowers

public boolean hasSumOfPowers(int k)
Tells whether sumOfPowers(k) can return meaningful results. Defined as hasSumOfPowers(k) <==> getMinOrderForSumOfPowers() <= k && k <= getMaxOrderForSumOfPowers() . A return value of true implies that hasSumOfPowers(k-1) .. hasSumOfPowers(0) will also return true. See the constructors for proper parametrization.

Details: hasSumOfPowers(0..2) will always yield true. hasSumOfPowers(-1) <==> hasSumOfInversions().

Returns:
false if the bin was constructed with insufficient parametrization, true otherwise.
See Also:
getMinOrderForSumOfPowers(), getMaxOrderForSumOfPowers()

kurtosis

public float kurtosis()
Returns the kurtosis (aka excess), which is -3 + moment(4,mean()) / standardDeviation()4.

Returns:
the kurtosis; Float.NaN if !hasSumOfPowers(4).
See Also:
hasSumOfPowers(int)

moment

public float moment(int k,
                    float c)
Returns the moment of k-th order with value c, which is Sum( (x[i]-c)k ) / size().

Parameters:
k - the order; must be greater than or equal to zero.
c - any number.
Returns:
Float.NaN if !hasSumOfPower(k).
Throws:
IllegalArgumentException - if k < 0.

product

public float product()
Returns the product, which is Prod( x[i] ). In other words: x[0]*x[1]*...*x[size()-1].

Returns:
the product; Float.NaN if !hasSumOfLogarithms() .
See Also:
hasSumOfLogarithms()

skew

public float skew()
Returns the skew, which is moment(3,mean()) / standardDeviation()3.

Returns:
the skew; Float.NaN if !hasSumOfPowers(3).
See Also:
hasSumOfPowers(int)

sumOfInversions

public float sumOfInversions()
Returns the sum of inversions, which is Sum( 1 / x[i] ).

Returns:
the sum of inversions; Float.NaN if !hasSumOfInversions().
See Also:
hasSumOfInversions()

sumOfLogarithms

public float sumOfLogarithms()
Returns the sum of logarithms, which is Sum( Log(x[i]) ).

Returns:
the sum of logarithms; Float.NaN if !hasSumOfLogarithms().
See Also:
hasSumOfLogarithms()

sumOfPowers

public float sumOfPowers(int k)
Returns the k-th order sum of powers, which is Sum( x[i]k ).

Parameters:
k - the order of the powers.
Returns:
the sum of powers; Float.NaN if !hasSumOfPowers(k).
See Also:
hasSumOfPowers(int)

toString

public String toString()
Returns a String representation of the receiver.

Overrides:
toString in class AbstractFloatBin1D

Parallel Colt 0.7.2

Jump to the Parallel Colt Homepage