jphase
Class Utils

java.lang.Object
  extended by jphase.Utils

public class Utils
extends java.lang.Object


Constructor Summary
Utils()
           
 
Method Summary
static double binomial(int n, int k)
          Binomial coefficient
static double distance(double[] v1, double[] v2)
          Euclidean norm btween given arrays
static double fact(int n)
          Factorial function ( n! ).
static double gammaP(double a, double x)
          Incomplete gamma function.
static double[][] initUpperTriangular(int n)
          Creates storage for un upper triangular matrix.
static double lnBinomial(int n, int k)
          ln Binomial coefficient.
static double lnFactorial(int n)
          Computes the log of Factorial function
static double lnGamma(double xx)
          Computes the log of gamma function.
static double lnPermut(int n, int k)
          Computes ln( n!/(n-k)! )
static double permut(int n, int k)
          Computes n!/(n-k)!
static double pow(double x, int n)
          Power function obtained by multiplying.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Utils

public Utils()
Method Detail

lnPermut

public static double lnPermut(int n,
                              int k)
Computes ln( n!/(n-k)! )

Parameters:
n -
k -
Returns:
ln( n!/(n-k) )!

permut

public static double permut(int n,
                            int k)
Computes n!/(n-k)!

Parameters:
n -
k -
Returns:
Computes n!/(n-k)!

lnGamma

public static double lnGamma(double xx)
Computes the log of gamma function.

Parameters:
xx - value
Returns:
lnGamma(xx)

lnFactorial

public static double lnFactorial(int n)
Computes the log of Factorial function

Parameters:
n -
Returns:
ln (n!)

fact

public static double fact(int n)
Factorial function ( n! ).

Parameters:
n -
Returns:
n!

gammaP

public static double gammaP(double a,
                            double x)
Incomplete gamma function. ;

Parameters:
a - argument
x - upper limit
Returns:
integ{0,infty,x} e^(-t) t^a / gamma(a) dt

binomial

public static double binomial(int n,
                              int k)
Binomial coefficient

Parameters:
n -
k -
Returns:
n!/ k! (n-k)!

lnBinomial

public static double lnBinomial(int n,
                                int k)
ln Binomial coefficient.

Parameters:
n -
k -
Returns:
ln [n!/ k! (n-k)!]

pow

public static double pow(double x,
                         int n)
Power function obtained by multiplying.

Parameters:
x -
n -
Returns:
x^n

distance

public static double distance(double[] v1,
                              double[] v2)
Euclidean norm btween given arrays

Parameters:
v1 -
v2 -
Returns:
Euclidean norm

initUpperTriangular

public static double[][] initUpperTriangular(int n)
Creates storage for un upper triangular matrix.

Parameters:
n -
Returns:
An nxn upper triangular matrix.