jphase

## Class Utils

- java.lang.Object
- - jphase.Utils

-     public class Utils
      extends java.lang.Object

  This class provides a number of methods to support other classes in the jPhase module. These include permutations, Gamma functions, factorial, binomial, among others.
  Author:
    German Riaņo

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Utils()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `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!
    `static double` | `permut(int n, int k)` Computes n!
    `static double` | `pow(double x, int n)` Power function obtained by multiplying.

    - ### Methods inherited from class java.lang.Object

      `equals, 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.