Class FastHadamardTransform
- java.lang.Object
-
- org.apache.commons.math4.transform.FastHadamardTransform
-
- All Implemented Interfaces:
Function<double[],double[]>
,UnaryOperator<double[]>
,RealTransform
public class FastHadamardTransform extends Object implements RealTransform
Fast Hadamard Transform (FHT).The FHT can also transform integer vectors into integer vectors. However, this transform cannot be inverted directly, due to a scaling factor that may lead to rational results (for example, the inverse transform of integer vector (0, 1, 0, 1) is vector (1/2, -1/2, 0, 0).
-
-
Constructor Summary
Constructors Constructor Description FastHadamardTransform()
Default constructor.FastHadamardTransform(boolean inverse)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double[]
apply(double[] f)
Returns the transform of the specified data set.int[]
apply(int[] f)
Returns the forward transform of the given data set.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.commons.math4.transform.RealTransform
apply
-
-
-
-
Constructor Detail
-
FastHadamardTransform
public FastHadamardTransform()
Default constructor.
-
FastHadamardTransform
public FastHadamardTransform(boolean inverse)
- Parameters:
inverse
- Whether to perform the inverse transform.
-
-
Method Detail
-
apply
public double[] apply(double[] f)
Returns the transform of the specified data set.- Specified by:
apply
in interfaceFunction<double[],double[]>
- Specified by:
apply
in interfaceRealTransform
- Parameters:
f
- the data array to be transformed (signal).- Returns:
- the transformed array (spectrum).
- Throws:
IllegalArgumentException
- if the length of the data array is not a power of two.
-
apply
public int[] apply(int[] f)
Returns the forward transform of the given data set. The integer transform cannot be inverted directly, due to a scaling factor which may lead to double results.- Parameters:
f
- Data array to be transformed (signal).- Returns:
- the transformed array (spectrum).
- Throws:
IllegalArgumentException
- if the length of the data array is not a power of two.
-
-