papaya
Class Descriptive.Sum

java.lang.Object
  extended by papaya.Descriptive.Sum
Enclosing class:
Descriptive

public static class Descriptive.Sum
extends Object

Methods for computing various different sums of datasets such as sum of inversions, logs, products, power deviations, squares, etc.


Method Summary
static double inversions(float[] data, int from, int to)
          Returns the sum of inversions of a data sequence, which is Sum( 1.0 / data[i]).
static double logs(float[] data, int from, int to)
          Returns the sum of logarithms of a data sequence, which is Sum( Log(data[i]).
static double powerDeviations(float[] data, int k, float c)
          Returns Sum( (data[i]-c)k ); optimized for common parameters like c == 0.0 and/or k == -2 ..
static double powerDeviations(float[] data, int k, float c, int from, int to)
          Returns Sum( (data[i]-c)k ) for all i = from ..
static double powers(float[] data, int k)
          Returns the sum of powers of a data sequence, which is Sum ( data[i]k ).
static double products(float[] data1, float[] data2)
          Returns the sum of the product of two data arrays, Sum( x[i] * y[i]).
static float squaredDeviations(int size, float variance)
          Returns the sum of squared mean deviation of of a data sequence.
static double squares(float[] data)
          Returns the sum of squares of a data sequence.
static float sum(float[] data)
          Returns the simple sum of a data sequence.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

inversions

public static double inversions(float[] data,
                                int from,
                                int to)
Returns the sum of inversions of a data sequence, which is Sum( 1.0 / data[i]).

Parameters:
data - the data sequence.
from - the index of the first data element (inclusive).
to - the index of the last data element (inclusive).

logs

public static double logs(float[] data,
                          int from,
                          int to)
Returns the sum of logarithms of a data sequence, which is Sum( Log(data[i]).

Parameters:
data - the data sequence.
from - the index of the first data element (inclusive).
to - the index of the last data element (inclusive).

products

public static double products(float[] data1,
                              float[] data2)
Returns the sum of the product of two data arrays, Sum( x[i] * y[i]).

Parameters:
data1 - the first data sequence.
data2 - the second data sequence
Returns:
the sum of the product of the two data sequences.

powerDeviations

public static double powerDeviations(float[] data,
                                     int k,
                                     float c)
Returns Sum( (data[i]-c)k ); optimized for common parameters like c == 0.0 and/or k == -2 .. 4.


powerDeviations

public static double powerDeviations(float[] data,
                                     int k,
                                     float c,
                                     int from,
                                     int to)
Returns Sum( (data[i]-c)k ) for all i = from .. to; optimized for common parameters like c == 0.0 and/or k == -2 .. 5. Note that no checks are made for divisions by zero (important for k = -2 and k = -1), so think twice before using this if the data has elements = 0.


powers

public static double powers(float[] data,
                            int k)
Returns the sum of powers of a data sequence, which is Sum ( data[i]k ).


squaredDeviations

public static float squaredDeviations(int size,
                                      float variance)
Returns the sum of squared mean deviation of of a data sequence. That is variance * (size-1) == Sum( (data[i] - mean)^2 ).

Parameters:
size - the number of elements of the data sequence.
variance - the variance of the data sequence.

squares

public static double squares(float[] data)
Returns the sum of squares of a data sequence. That is Sum ( data[i]*data[i] ).


sum

public static float sum(float[] data)
Returns the simple sum of a data sequence. That is Sum( data[i] ).

See Also:
Mat.sum(float[]), Mat.sum(float[], float[]), Mat.sum(float[],float)


Processing library papaya by Adila Faruk. (C) 2014