ir.utilities
Class MoreMath

java.lang.Object
  extended by ir.utilities.MoreMath

public class MoreMath
extends java.lang.Object

A place to put some additional math functions


Constructor Summary
MoreMath()
           
 
Method Summary
static double[] addVectors(double[] x, double[] y)
          Add two vectors and return the vector sum
static double[] averageVectors(java.util.ArrayList<double[]> list)
          Average all of the vectors in a list of vectors and return the average vector.
static double log(double x, double base)
          Return logarithm of a given base
static double log(double x, int base)
           
static double log(int x, double base)
           
static double log(int x, int base)
           
static void printVector(double[] x)
          Print a vector in the form [x,y,...z] to standard out
static void printVector(double[] x, java.io.PrintStream out)
          Print a vector in the form [x,y,...z] to the print stream
static double roundTo(double num, int decimalPlaces)
          Round a double to the given number of decimalPlaces
static double[] vectorDivide(double[] x, double c)
          Divide a vector by a scalar and return the resulting vector
static double vectorLength(double[] values)
           
static double vectorOneNorm(double[] values)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MoreMath

public MoreMath()
Method Detail

roundTo

public static double roundTo(double num,
                             int decimalPlaces)
Round a double to the given number of decimalPlaces


log

public static double log(double x,
                         double base)
Return logarithm of a given base


log

public static double log(int x,
                         int base)

log

public static double log(double x,
                         int base)

log

public static double log(int x,
                         double base)

addVectors

public static double[] addVectors(double[] x,
                                  double[] y)
Add two vectors and return the vector sum


vectorDivide

public static double[] vectorDivide(double[] x,
                                    double c)
Divide a vector by a scalar and return the resulting vector


averageVectors

public static double[] averageVectors(java.util.ArrayList<double[]> list)
Average all of the vectors in a list of vectors and return the average vector.


printVector

public static void printVector(double[] x)
Print a vector in the form [x,y,...z] to standard out


printVector

public static void printVector(double[] x,
                               java.io.PrintStream out)
Print a vector in the form [x,y,...z] to the print stream


vectorLength

public static double vectorLength(double[] values)

vectorOneNorm

public static double vectorOneNorm(double[] values)