org.apache.commons.math.transform
Class FastHadamardTransformer

java.lang.Object
  extended by org.apache.commons.math.transform.FastHadamardTransformer
All Implemented Interfaces:
RealTransformer

public class FastHadamardTransformer
extends Object
implements RealTransformer

Implements the Fast Hadamard Transform (FHT). Transformation of an input vector x to the output vector y.

In addition to transformation of real vectors, the Hadamard transform can transform integer vectors into integer vectors. However, this integer transform cannot be inverted directly. Due to a scaling factor it may lead to rational results. As an example, the inverse transform of integer vector (0, 1, 0, 1) is rational vector (1/2, -1/2, 0, 0).

Since:
2.0

Constructor Summary
FastHadamardTransformer()
           
 
Method Summary
 double[] inversetransform(double[] f)
          Inversely transform the given real data set.
 double[] inversetransform(UnivariateRealFunction f, double min, double max, int n)
          Inversely transform the given real function, sampled on the given interval.
 double[] transform(double[] f)
          Transform the given real data set.
 int[] transform(int[] f)
          Transform the given real data set.
 double[] transform(UnivariateRealFunction f, double min, double max, int n)
          Transform the given real function, sampled on the given interval.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FastHadamardTransformer

public FastHadamardTransformer()
Method Detail

transform

public double[] transform(double[] f)
                   throws IllegalArgumentException
Transform the given real data set.

Specified by:
transform in interface RealTransformer
Parameters:
f - the real data array to be transformed (signal)
Returns:
the real transformed array (spectrum)
Throws:
IllegalArgumentException - if any parameters are invalid

transform

public double[] transform(UnivariateRealFunction f,
                          double min,
                          double max,
                          int n)
                   throws FunctionEvaluationException,
                          IllegalArgumentException
Transform the given real function, sampled on the given interval.

Specified by:
transform in interface RealTransformer
Parameters:
f - the function to be sampled and transformed
min - the lower bound for the interval
max - the upper bound for the interval
n - the number of sample points
Returns:
the real transformed array
Throws:
FunctionEvaluationException - if function cannot be evaluated at some point
IllegalArgumentException - if any parameters are invalid

inversetransform

public double[] inversetransform(double[] f)
                          throws IllegalArgumentException
Inversely transform the given real data set.

Specified by:
inversetransform in interface RealTransformer
Parameters:
f - the real data array to be inversely transformed (spectrum)
Returns:
the real inversely transformed array (signal)
Throws:
IllegalArgumentException - if any parameters are invalid

inversetransform

public double[] inversetransform(UnivariateRealFunction f,
                                 double min,
                                 double max,
                                 int n)
                          throws FunctionEvaluationException,
                                 IllegalArgumentException
Inversely transform the given real function, sampled on the given interval.

Specified by:
inversetransform in interface RealTransformer
Parameters:
f - the function to be sampled and inversely transformed
min - the lower bound for the interval
max - the upper bound for the interval
n - the number of sample points
Returns:
the real inversely transformed array
Throws:
FunctionEvaluationException - if function cannot be evaluated at some point
IllegalArgumentException - if any parameters are invalid

transform

public int[] transform(int[] f)
                throws IllegalArgumentException
Transform the given real data set.

The integer transform cannot be inverted directly, due to a scaling factor it may lead to double results.

Parameters:
f - the integer data array to be transformed (signal)
Returns:
the integer transformed array (spectrum)
Throws:
IllegalArgumentException - if any parameters are invalid


jHepWork 3.1 ©