com.compomics.util.math
Class BasicMathFunctions

java.lang.Object
  extended by com.compomics.util.math.BasicMathFunctions

public class BasicMathFunctions
extends java.lang.Object

Class used to perform basic mathematical functions

Author:
Marc

Constructor Summary
BasicMathFunctions()
           
 
Method Summary
static int factorial(int n)
          returns n!
static double getCombination(int k, int n)
          Returns the number of k-combinations in a set of n elements
static double mad(double[] ratios)
          Method estimating the median absolute deviation
static double mean(java.util.ArrayList<java.lang.Double> input)
          Convenience method returning the mean of a list of doubles
static double median(java.util.ArrayList<java.lang.Double> input)
          Method to estimate the median
static double median(double[] ratios)
          Method to estimate the median
static double std(java.util.ArrayList<java.lang.Double> input)
          Convenience method returning the standard deviation of a list of doubles.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicMathFunctions

public BasicMathFunctions()
Method Detail

factorial

public static int factorial(int n)
returns n!

Parameters:
n - a given integer
Returns:
the corresponding factorial

getCombination

public static double getCombination(int k,
                                    int n)
Returns the number of k-combinations in a set of n elements

Parameters:
k - the number of k-combinations
n - the number of elements
Returns:
the number of k-combinations in a set of n elements

median

public static double median(double[] ratios)
Method to estimate the median

Parameters:
ratios - array of double
Returns:
median of the input

median

public static double median(java.util.ArrayList<java.lang.Double> input)
Method to estimate the median

Parameters:
input - ArrayList of double
Returns:
median of the input

mad

public static double mad(double[] ratios)
Method estimating the median absolute deviation

Parameters:
ratios - array of doubles
Returns:
the mad of the input

std

public static double std(java.util.ArrayList<java.lang.Double> input)
Convenience method returning the standard deviation of a list of doubles. Returns 0 if the list is null or of size < 2.

Parameters:
input - input list
Returns:
the corresponding standard deviation

mean

public static double mean(java.util.ArrayList<java.lang.Double> input)
Convenience method returning the mean of a list of doubles

Parameters:
input - input list
Returns:
the corresponding mean


Copyright © 2013. All Rights Reserved.