pal.math
Class MathUtils

java.lang.Object
  |
  +--pal.math.MathUtils

public class MathUtils
extends java.lang.Object

Handy utility functions which have some Mathematical relavance.


Field Summary
static MersenneTwisterFast random
          A random number generator that is initialized with the clock when this class is loaded into the JVM.
 
Constructor Summary
MathUtils()
           
 
Method Summary
static double[] getNormalized(double[] array)
           
static double[] getRandomArguments(MultivariateFunction mf)
           
static double getTotal(double[] array)
           
static double getTotal(double[] array, int start, int end)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

random

public static MersenneTwisterFast random
A random number generator that is initialized with the clock when this class is loaded into the JVM. Use this for all random numbers.
Constructor Detail

MathUtils

public MathUtils()
Method Detail

getNormalized

public static final double[] getNormalized(double[] array)
Returns:
a new double array where all the values sum to 1. Relative ratios are preserved.

getTotal

public static final double getTotal(double[] array,
                                    int start,
                                    int end)
Parameters:
end - the index of the element after the last one to be included
Returns:
the total of a the values in a range of an array

getTotal

public static final double getTotal(double[] array)
Returns:
the total of the values in an array

getRandomArguments

public static final double[] getRandomArguments(MultivariateFunction mf)
Returns:
a set of valid, but randomly generated, arguments for a particular MultivariateFunction