org.apache.commons.math3.transform
Class FastHadamardTransformer
- java.lang.Object
-
- org.apache.commons.math3.transform.FastHadamardTransformer
-
- All Implemented Interfaces:
- java.io.Serializable, RealTransformer
public class FastHadamardTransformer extends java.lang.Object implements RealTransformer, java.io.Serializable
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
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description FastHadamardTransformer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description double[]transform(double[] f, TransformType type)Returns the (forward, inverse) transform of the specified real data set.int[]transform(int[] f)Returns the forward transform of the specified integer data set.The integer transform cannot be inverted directly, due to a scaling factor which may lead to double results.double[]transform(UnivariateFunction f, double min, double max, int n, TransformType type)Returns the (forward, inverse) transform of the specified real function, sampled on the specified interval.
-
-
-
Method Detail
-
transform
public double[] transform(double[] f, TransformType type)Returns the (forward, inverse) transform of the specified real data set.- Specified by:
transformin interfaceRealTransformer- Parameters:
f- the real data array to be transformed (signal)type- the type of transform (forward, inverse) to be performed- Returns:
- the real transformed array (spectrum)
- Throws:
MathIllegalArgumentException- if the length of the data array is not a power of two
-
transform
public double[] transform(UnivariateFunction f, double min, double max, int n, TransformType type)
Returns the (forward, inverse) transform of the specified real function, sampled on the specified interval.- Specified by:
transformin interfaceRealTransformer- Parameters:
f- the function to be sampled and transformedmin- the (inclusive) lower bound for the intervalmax- the (exclusive) upper bound for the intervaln- the number of sample pointstype- the type of transform (forward, inverse) to be performed- Returns:
- the real transformed array
- Throws:
NonMonotonicSequenceException- if the lower bound is greater than, or equal to the upper boundNotStrictlyPositiveException- if the number of sample points is negativeMathIllegalArgumentException- if the number of sample points is not a power of two
-
transform
public int[] transform(int[] f)
Returns the forward transform of the specified integer data set.The integer transform cannot be inverted directly, due to a scaling factor which may lead to double results.- Parameters:
f- the integer data array to be transformed (signal)- Returns:
- the integer transformed array (spectrum)
- Throws:
MathIllegalArgumentException- if the length of the data array is not a power of two
-
-
DMelt 3.0 © DataMelt by jWork.ORG