JSci.maths
Class EngineerMath

java.lang.Object
  extended by JSci.maths.AbstractMath
      extended by JSci.maths.EngineerMath

public final class EngineerMath
extends AbstractMath

This class is dedicated to engineering methods applied to arrays including signal processing. All methods here are safe, that is, they create copies of arrays whenever necessary. This makes for slower methods, but the programmer can always define his own methods optimized for performance.


Method Summary
static double entropy(double[] v)
          Compute the entropy of an array.
static double entropy(int[] v)
          Compute the entropy of an array.
static double icf(double[] v)
          Shannon entropy of an array.
static double[] resample(double[] data, int newLength)
          Set an array to the specified length resampling using linear interpolation.
static double[] runningAverage(double[] v, int width)
          Return a running average over the data.
static double[] runningMedian(double[] v, int width)
          Return a running median over the data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

runningAverage

public static double[] runningAverage(double[] v,
                                      int width)
Return a running average over the data. The returned array has the same size as the input array. It is often used in signal processing to estimate the baseline.

Parameters:
v - the data.
width - width of the average.
Throws:
java.lang.IllegalArgumentException - if v.length < width
java.lang.IllegalArgumentException - if width is even
java.lang.IllegalArgumentException - if v.length = 0

runningMedian

public static double[] runningMedian(double[] v,
                                     int width)
Return a running median over the data. The returned array has the same size as the input array. It is often used in signal processing to estimate the baseline. Safer than the running average, but somewhat more costly computationally.

Parameters:
v - the data
width - width of the average
Throws:
java.lang.IllegalArgumentException - if v.length < width
java.lang.IllegalArgumentException - if width is even

icf

public static double icf(double[] v)
Shannon entropy of an array. Please check that the mass of the array is 1 before using this method. Use the method "entropy" otherwise.

PlanetMath references:
ShannonsTheoremEntropy

entropy

public static double entropy(double[] v)
Compute the entropy of an array. The entropy as defined using the absolute value.


entropy

public static double entropy(int[] v)
Compute the entropy of an array. The entropy as defined using the absolute value.


resample

public static double[] resample(double[] data,
                                int newLength)
Set an array to the specified length resampling using linear interpolation.