org.android.activityminer.model.configuration
Class MathUtils

Package class diagram package MathUtils
java.lang.Object
  extended by org.android.activityminer.model.configuration.MathUtils

public class MathUtils
extends Object

Class to hold mathematical constants & functions.


Field Summary
static Double DOUBLE_NAN
          NaN Double constant
static Double DOUBLE_NEGATIVE_INFINITY
          - infinity Double constant
static Double DOUBLE_POSITIVE_INFINITY
          + infinity Double constant
static double DOUBLE_PRECISION
          The double comparision precision
static Double DOUBLE_ZERO
          Zero Double constant
static Integer INTEGER_ZERO
          Zero Integer constant
static double LOG2
          The logarithm of two.
static Long LONG_NEGATIVE_ONE
          -1 Long constant
static Long LONG_ZERO
          Zero Long constant
static double SQRT2
          The square root of two.
 
Constructor Summary
MathUtils()
           
 
Method Summary
static double conditionalRowEntropy(double[][] matrix)
          Computes the conditional not normalized(!)
static double entropieFunction(double p)
          Entropy function wrapper to calculate p * log(p)
static double entropy(double[] values)
          Does calculate the entropy for the given values.
static double entropyFromEntropyValueSumAndTotalSum(double entropyValueSum, double totalValueSum)
          Method to calculate entropy from the sum of single entropy function values and the total value sum
static boolean equalsWithPrecision(double x, double y)
          Does compare two double values with precision
static double log2(double value)
          Calculates the logarithm for base 2
static double mean(double[] values)
          Mean calculation.
static double symmetricalUncertainty(double[][] matrix)
          Calculates the symmetrical uncertainty for a given matrix.
static double variance(double[] values, double mean)
          Variance calculation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG2

public static final double LOG2
The logarithm of two.


SQRT2

public static final double SQRT2
The square root of two.


DOUBLE_PRECISION

public static final double DOUBLE_PRECISION
The double comparision precision

See Also:
Constant Field Values

DOUBLE_ZERO

public static final Double DOUBLE_ZERO
Zero Double constant


DOUBLE_NAN

public static final Double DOUBLE_NAN
NaN Double constant


DOUBLE_POSITIVE_INFINITY

public static final Double DOUBLE_POSITIVE_INFINITY
+ infinity Double constant


DOUBLE_NEGATIVE_INFINITY

public static final Double DOUBLE_NEGATIVE_INFINITY
- infinity Double constant


INTEGER_ZERO

public static final Integer INTEGER_ZERO
Zero Integer constant


LONG_ZERO

public static final Long LONG_ZERO
Zero Long constant


LONG_NEGATIVE_ONE

public static final Long LONG_NEGATIVE_ONE
-1 Long constant

Constructor Detail

MathUtils

public MathUtils()
Method Detail

equalsWithPrecision

public static final boolean equalsWithPrecision(double x,
                                                double y)
Does compare two double values with precision

Parameters:
x - the first value
y - the second value
Returns:
true if difference is below double precision

entropy

public static final double entropy(double[] values)
Does calculate the entropy for the given values.

Parameters:
values - the values of the variable
Returns:
the entropy of the given values

entropyFromEntropyValueSumAndTotalSum

public static final double entropyFromEntropyValueSumAndTotalSum(double entropyValueSum,
                                                                 double totalValueSum)
Method to calculate entropy from the sum of single entropy function values and the total value sum

Parameters:
entropyValueSum - the sum of entropy function values
totalValueSum - the total value sum
Returns:
the entropy

entropieFunction

public static final double entropieFunction(double p)
Entropy function wrapper to calculate p * log(p)

Parameters:
p - the value
Returns:
p * log(p) if p > 0, 0 otherwise

log2

public static double log2(double value)
Calculates the logarithm for base 2

Parameters:
value -
Returns:
the logarithm for base 2

conditionalRowEntropy

public static final double conditionalRowEntropy(double[][] matrix)
Computes the conditional not normalized(!) entropy of the rows in the given matrix.

Parameters:
matrix - the matrix
Returns:
the conditional entropy

symmetricalUncertainty

public static final double symmetricalUncertainty(double[][] matrix)
Calculates the symmetrical uncertainty for a given matrix.

Parameters:
matrix - the matrix
Returns:
the symmetrical uncertainty

mean

public static double mean(double[] values)
Mean calculation.

Parameters:
values - the values
Returns:
the mean of the values

variance

public static double variance(double[] values,
                              double mean)
Variance calculation.

Parameters:
values - the values
mean - the mean of the values
Returns:
the variance of the values