diff --git a/src/main/java/org/apache/commons/math3/transform/DctNormalization.java b/src/main/java/org/apache/commons/math3/transform/DctNormalization.java index cc8619e0c..a8197b183 100644 --- a/src/main/java/org/apache/commons/math3/transform/DctNormalization.java +++ b/src/main/java/org/apache/commons/math3/transform/DctNormalization.java @@ -27,7 +27,6 @@ package org.apache.commons.math3.transform; */ public enum DctNormalization { /** - *

* Should be passed to the constructor of {@link FastCosineTransformer} * to use the standard normalization convention. The standard * DCT-I normalization convention is defined as follows @@ -43,12 +42,10 @@ public enum DctNormalization { * yn cos[π nk / (N - 1)], * * where N is the size of the data sample. - *

*/ STANDARD_DCT_I, /** - *

* Should be passed to the constructor of {@link FastCosineTransformer} * to use the orthogonal normalization convention. The orthogonal * DCT-I normalization convention is defined as follows diff --git a/src/main/java/org/apache/commons/math3/transform/DftNormalization.java b/src/main/java/org/apache/commons/math3/transform/DftNormalization.java index ceb03cc8b..69cde0a30 100644 --- a/src/main/java/org/apache/commons/math3/transform/DftNormalization.java +++ b/src/main/java/org/apache/commons/math3/transform/DftNormalization.java @@ -27,7 +27,6 @@ package org.apache.commons.math3.transform; */ public enum DftNormalization { /** - *

* Should be passed to the constructor of {@link FastFourierTransformer} * to use the standard normalization convention. This normalization * convention is defined as follows @@ -38,12 +37,10 @@ public enum DftNormalization { * ∑n=0N-1 yn exp(2πi n k / N), * * where N is the size of the data sample. - *

*/ STANDARD, /** - *

* Should be passed to the constructor of {@link FastFourierTransformer} * to use the unitary normalization convention. This normalization * convention is defined as follows @@ -55,7 +52,6 @@ public enum DftNormalization { * ∑n=0N-1 yn exp(2πi n k / N), * * which makes the transform unitary. N is the size of the data sample. - *

*/ UNITARY; } diff --git a/src/main/java/org/apache/commons/math3/transform/DstNormalization.java b/src/main/java/org/apache/commons/math3/transform/DstNormalization.java index 1f3e7118e..c16560013 100644 --- a/src/main/java/org/apache/commons/math3/transform/DstNormalization.java +++ b/src/main/java/org/apache/commons/math3/transform/DstNormalization.java @@ -27,7 +27,6 @@ package org.apache.commons.math3.transform; */ public enum DstNormalization { /** - *

* Should be passed to the constructor of {@link FastSineTransformer} to * use the standard normalization convention. The standard DST-I * normalization convention is defined as follows @@ -38,12 +37,10 @@ public enum DstNormalization { * ∑n=0N-1 yn sin(π nk / N), * * where N is the size of the data sample, and x0 = 0. - *

*/ STANDARD_DST_I, /** - *

* Should be passed to the constructor of {@link FastSineTransformer} to * use the orthogonal normalization convention. The orthogonal * DCT-I normalization convention is defined as follows @@ -55,7 +52,6 @@ public enum DstNormalization { * * which makes the transform orthogonal. N is the size of the data sample, * and x0 = 0. - *

*/ ORTHOGONAL_DST_I } diff --git a/src/main/java/org/apache/commons/math3/transform/FastCosineTransformer.java b/src/main/java/org/apache/commons/math3/transform/FastCosineTransformer.java index 6d407300b..e1254a591 100644 --- a/src/main/java/org/apache/commons/math3/transform/FastCosineTransformer.java +++ b/src/main/java/org/apache/commons/math3/transform/FastCosineTransformer.java @@ -27,16 +27,13 @@ import org.apache.commons.math3.util.ArithmeticUtils; import org.apache.commons.math3.util.FastMath; /** - *

* Implements the Fast Cosine Transform for transformation of one-dimensional * real data sets. For reference, see James S. Walker, Fast Fourier * Transforms, chapter 3 (ISBN 0849371635). - *

*

* There are several variants of the discrete cosine transform. The present * implementation corresponds to DCT-I, with various normalization conventions, * which are specified by the parameter {@link DctNormalization}. - *

*

* DCT-I is equivalent to DFT of an even extension of the data series. * More precisely, if x0, …, xN-1 is the data set @@ -48,7 +45,6 @@ import org.apache.commons.math3.util.FastMath; *

  • xk# = x2N-2-k * if N ≤ k < 2N - 2.
  • * - *

    *

    * Then, the standard DCT-I y0, …, yN-1 of the real * data set x0, …, xN-1 is equal to half @@ -58,13 +54,11 @@ import org.apache.commons.math3.util.FastMath; * yn = (1 / 2) ∑k=02N-3 * xk# exp[-2πi nk / (2N - 2)] *     k = 0, …, N-1. - *

    *

    * The present implementation of the discrete cosine transform as a fast cosine * transform requires the length of the data set to be a power of two plus one * (N = 2n + 1). Besides, it implicitly assumes * that the sampled function is even. - *

    * * @version $Id$ * @since 1.2 diff --git a/src/main/java/org/apache/commons/math3/transform/FastFourierTransformer.java b/src/main/java/org/apache/commons/math3/transform/FastFourierTransformer.java index 536c6fc79..22d8a3df8 100644 --- a/src/main/java/org/apache/commons/math3/transform/FastFourierTransformer.java +++ b/src/main/java/org/apache/commons/math3/transform/FastFourierTransformer.java @@ -31,16 +31,13 @@ import org.apache.commons.math3.util.FastMath; import org.apache.commons.math3.util.MathArrays; /** - *

    * Implements the Fast Fourier Transform for transformation of one-dimensional * real or complex data sets. For reference, see Applied Numerical Linear * Algebra, ISBN 0898713897, chapter 6. - *

    *

    * There are several variants of the discrete Fourier transform, with various * normalization conventions, which are specified by the parameter * {@link DftNormalization}. - *

    *

    * The current implementation of the discrete Fourier transform as a fast * Fourier transform requires the length of the data set to be a power of 2. @@ -49,7 +46,6 @@ import org.apache.commons.math3.util.MathArrays; * reference, see S. Winograd, * On computing the discrete Fourier transform, Mathematics of * Computation, 32 (1978), 175 - 199. - *

    * * @see DftNormalization * @version $Id$ @@ -162,8 +158,7 @@ public class FastFourierTransformer implements Serializable { * * @param dataRI the unscaled transformed data * @param normalization the normalization to be applied - * @param type the type of transform (forward, inverse) which resulted in the - * specified data + * @param type the type of transform (forward, inverse) which resulted in the specified data */ private static void normalizeTransformedData(final double[][] dataRI, final DftNormalization normalization, final TransformType type) { @@ -205,21 +200,17 @@ public class FastFourierTransformer implements Serializable { * Computes the standard transform of the specified complex data. The * computation is done in place. The input data is laid out as follows * * - * @param dataRI the two dimensional array of real and imaginary parts of - * the data - * @param normalization the normalization to be applied to the transformed - * data + * @param dataRI the two dimensional array of real and imaginary parts of the data + * @param normalization the normalization to be applied to the transformed data * @param type the type of transform (forward, inverse) to be performed * @throws DimensionMismatchException if the number of rows of the specified - * array is not two, or the array is not rectangular + * array is not two, or the array is not rectangular * @throws MathIllegalArgumentException if the number of data points is not - * a power of two + * a power of two */ public static void transformInPlace(final double[][] dataRI, final DftNormalization normalization, final TransformType type) { @@ -374,8 +365,7 @@ public class FastFourierTransformer implements Serializable { * @param f the real data array to be transformed * @param type the type of transform (forward, inverse) to be performed * @return the complex transformed array - * @throws MathIllegalArgumentException if the length of the data array is - * not a power of two + * @throws MathIllegalArgumentException if the length of the data array is not a power of two */ public Complex[] transform(final double[] f, final TransformType type) { final double[][] dataRI = new double[][] { @@ -398,29 +388,27 @@ public class FastFourierTransformer implements Serializable { * @param type the type of transform (forward, inverse) to be performed * @return the complex transformed array * @throws org.apache.commons.math3.exception.NumberIsTooLargeException - * if the lower bound is greater than, or equal to the upper bound + * if the lower bound is greater than, or equal to the upper bound * @throws org.apache.commons.math3.exception.NotStrictlyPositiveException - * if the number of sample points {@code n} is negative + * if the number of sample points {@code n} is negative * @throws MathIllegalArgumentException if the number of sample points - * {@code n} is not a power of two + * {@code n} is not a power of two */ public Complex[] transform(final UnivariateFunction f, - final double min, final double max, final int n, - final TransformType type) { + final double min, final double max, final int n, + final TransformType type) { final double[] data = FunctionUtils.sample(f, min, max, n); return transform(data, type); } /** - * Returns the (forward, inverse) transform of the specified complex data - * set. + * Returns the (forward, inverse) transform of the specified complex data set. * * @param f the complex data array to be transformed * @param type the type of transform (forward, inverse) to be performed * @return the complex transformed array - * @throws MathIllegalArgumentException if the length of the data array is - * not a power of two + * @throws MathIllegalArgumentException if the length of the data array is not a power of two */ public Complex[] transform(final Complex[] f, final TransformType type) { final double[][] dataRI = TransformUtils.createRealImaginaryArray(f); @@ -439,11 +427,9 @@ public class FastFourierTransformer implements Serializable { * × nd, where nk is the number of elements in * dimension k, and d is the total number of dimensions. * - * @param mdca Multi-Dimensional Complex Array id est - * {@code Complex[][][][]} + * @param mdca Multi-Dimensional Complex Array, i.e. {@code Complex[][][][]} * @param type the type of transform (forward, inverse) to be performed - * @return transform of {@code mdca} as a Multi-Dimensional Complex Array - * id est {@code Complex[][][][]} + * @return transform of {@code mdca} as a Multi-Dimensional Complex Array, i.e. {@code Complex[][][][]} * @throws IllegalArgumentException if any dimension is not a power of two * @deprecated see MATH-736 */ diff --git a/src/main/java/org/apache/commons/math3/transform/FastHadamardTransformer.java b/src/main/java/org/apache/commons/math3/transform/FastHadamardTransformer.java index c4b775567..1a31e86b0 100644 --- a/src/main/java/org/apache/commons/math3/transform/FastHadamardTransformer.java +++ b/src/main/java/org/apache/commons/math3/transform/FastHadamardTransformer.java @@ -27,11 +27,13 @@ import org.apache.commons.math3.util.ArithmeticUtils; /** * 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 + *

    + * 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).

    + * vector (1/2, -1/2, 0, 0). + * * @version $Id$ * @since 2.0 */ @@ -57,11 +59,10 @@ public class FastHadamardTransformer implements RealTransformer, Serializable { * {@inheritDoc} * * @throws org.apache.commons.math3.exception.NonMonotonicSequenceException - * if the lower bound is greater than, or equal to the upper bound + * if the lower bound is greater than, or equal to the upper bound * @throws org.apache.commons.math3.exception.NotStrictlyPositiveException - * if the number of sample points is negative - * @throws MathIllegalArgumentException if the number of sample points is - * not a power of two + * if the number of sample points is negative + * @throws MathIllegalArgumentException if the number of sample points is not a power of two */ public double[] transform(final UnivariateFunction f, final double min, final double max, final int n, @@ -77,8 +78,7 @@ public class FastHadamardTransformer implements RealTransformer, Serializable { * * @param f the integer data array to be transformed (signal) * @return the integer transformed array (spectrum) - * @throws MathIllegalArgumentException if the length of the data array is - * not a power of two + * @throws MathIllegalArgumentException if the length of the data array is not a power of two */ public int[] transform(final int[] f) { return fht(f); @@ -224,8 +224,7 @@ public class FastHadamardTransformer implements RealTransformer, Serializable { * * @param x the real data array to be transformed * @return the real transformed array, {@code y} - * @throws MathIllegalArgumentException if the length of the data array is - * not a power of two + * @throws MathIllegalArgumentException if the length of the data array is not a power of two */ protected double[] fht(double[] x) throws MathIllegalArgumentException { @@ -276,8 +275,7 @@ public class FastHadamardTransformer implements RealTransformer, Serializable { * * @param x the integer data array to be transformed * @return the integer transformed array, {@code y} - * @throws MathIllegalArgumentException if the length of the data array is - * not a power of two + * @throws MathIllegalArgumentException if the length of the data array is not a power of two */ protected int[] fht(int[] x) throws MathIllegalArgumentException { diff --git a/src/main/java/org/apache/commons/math3/transform/FastSineTransformer.java b/src/main/java/org/apache/commons/math3/transform/FastSineTransformer.java index 50a36bd52..2eb36b997 100644 --- a/src/main/java/org/apache/commons/math3/transform/FastSineTransformer.java +++ b/src/main/java/org/apache/commons/math3/transform/FastSineTransformer.java @@ -27,18 +27,15 @@ import org.apache.commons.math3.util.ArithmeticUtils; import org.apache.commons.math3.util.FastMath; /** - *

    * Implements the Fast Sine Transform for transformation of one-dimensional real * data sets. For reference, see James S. Walker, Fast Fourier * Transforms, chapter 3 (ISBN 0849371635). - *

    *

    * There are several variants of the discrete sine transform. The present * implementation corresponds to DST-I, with various normalization conventions, * which are specified by the parameter {@link DstNormalization}. * It should be noted that regardless to the convention, the first * element of the dataset to be transformed must be zero. - *

    *

    * DST-I is equivalent to DFT of an odd extension of the data series. * More precisely, if x0, …, xN-1 is the data set @@ -51,7 +48,6 @@ import org.apache.commons.math3.util.FastMath; *

  • xk# = -x2N-k if N + 1 ≤ k < * 2N.
  • * - *

    *

    * Then, the standard DST-I y0, …, yN-1 of the real * data set x0, …, xN-1 is equal to half @@ -61,7 +57,6 @@ import org.apache.commons.math3.util.FastMath; * yn = (i / 2) ∑k=02N-1 * xk# exp[-2πi nk / (2N)] *     k = 0, …, N-1. - *

    *

    * The present implementation of the discrete sine transform as a fast sine * transform requires the length of the data to be a power of two. Besides, @@ -69,7 +64,6 @@ import org.apache.commons.math3.util.FastMath; * first element of the data set must be 0, which is enforced in * {@link #transform(UnivariateFunction, double, double, int, TransformType)}, * after sampling. - *

    * * @version $Id$ * @since 1.2 @@ -83,11 +77,9 @@ public class FastSineTransformer implements RealTransformer, Serializable { private final DstNormalization normalization; /** - * Creates a new instance of this class, with various normalization - * conventions. + * Creates a new instance of this class, with various normalization conventions. * - * @param normalization the type of normalization to be applied to the - * transformed data + * @param normalization the type of normalization to be applied to the transformed data */ public FastSineTransformer(final DstNormalization normalization) { this.normalization = normalization; @@ -99,7 +91,7 @@ public class FastSineTransformer implements RealTransformer, Serializable { * The first element of the specified data set is required to be {@code 0}. * * @throws MathIllegalArgumentException if the length of the data array is - * not a power of two, or the first element of the data array is not zero + * not a power of two, or the first element of the data array is not zero */ public double[] transform(final double[] f, final TransformType type) { if (normalization == DstNormalization.ORTHOGONAL_DST_I) { @@ -119,11 +111,10 @@ public class FastSineTransformer implements RealTransformer, Serializable { * This implementation enforces {@code f(x) = 0.0} at {@code x = 0.0}. * * @throws org.apache.commons.math3.exception.NonMonotonicSequenceException - * if the lower bound is greater than, or equal to the upper bound + * if the lower bound is greater than, or equal to the upper bound * @throws org.apache.commons.math3.exception.NotStrictlyPositiveException - * if the number of sample points is negative - * @throws MathIllegalArgumentException if the number of sample points is - * not a power of two + * if the number of sample points is negative + * @throws MathIllegalArgumentException if the number of sample points is not a power of two */ public double[] transform(final UnivariateFunction f, final double min, final double max, final int n, @@ -141,7 +132,7 @@ public class FastSineTransformer implements RealTransformer, Serializable { * @param f the real data array to be transformed * @return the real transformed array * @throws MathIllegalArgumentException if the length of the data array is - * not a power of two, or the first element of the data array is not zero + * not a power of two, or the first element of the data array is not zero */ protected double[] fst(double[] f) throws MathIllegalArgumentException { diff --git a/src/main/java/org/apache/commons/math3/transform/RealTransformer.java b/src/main/java/org/apache/commons/math3/transform/RealTransformer.java index 623be0c78..0bbee025e 100644 --- a/src/main/java/org/apache/commons/math3/transform/RealTransformer.java +++ b/src/main/java/org/apache/commons/math3/transform/RealTransformer.java @@ -22,14 +22,14 @@ import org.apache.commons.math3.exception.NonMonotonicSequenceException; import org.apache.commons.math3.exception.NotStrictlyPositiveException; /** - *

    Interface for one-dimensional data sets transformations producing real - * results.

    - *

    Such transforms include {@link FastSineTransformer sine transform}, + * Interface for one-dimensional data sets transformations producing real results. + *

    + * Such transforms include {@link FastSineTransformer sine transform}, * {@link FastCosineTransformer cosine transform} or {@link * FastHadamardTransformer Hadamard transform}. {@link FastFourierTransformer * Fourier transform} is of a different kind and does not implement this * interface since it produces {@link org.apache.commons.math3.complex.Complex} - * results instead of real ones.

    + * results instead of real ones. * * @version $Id$ * @since 2.0 @@ -43,8 +43,8 @@ public interface RealTransformer { * @param type the type of transform (forward, inverse) to be performed * @return the real transformed array (spectrum) * @throws MathIllegalArgumentException if the array cannot be transformed - * with the given type (this may be for example due to array size, which is - * constrained in some transforms) + * with the given type (this may be for example due to array size, which is + * constrained in some transforms) */ double[] transform(double[] f, TransformType type) throws MathIllegalArgumentException; @@ -58,12 +58,11 @@ public interface RealTransformer { * @param n the number of sample points * @param type the type of transform (forward, inverse) to be performed * @return the real transformed array - * @throws NonMonotonicSequenceException if the lower bound is greater than, - * or equal to the upper bound + * @throws NonMonotonicSequenceException if the lower bound is greater than, or equal to the upper bound * @throws NotStrictlyPositiveException if the number of sample points is negative * @throws MathIllegalArgumentException if the sample cannot be transformed - * with the given type (this may be for example due to sample size, which is - * constrained in some transforms) + * with the given type (this may be for example due to sample size, which is + * constrained in some transforms) */ double[] transform(UnivariateFunction f, double min, double max, int n, TransformType type) diff --git a/src/main/java/org/apache/commons/math3/transform/TransformUtils.java b/src/main/java/org/apache/commons/math3/transform/TransformUtils.java index e23921f83..eee3bc8a2 100644 --- a/src/main/java/org/apache/commons/math3/transform/TransformUtils.java +++ b/src/main/java/org/apache/commons/math3/transform/TransformUtils.java @@ -93,7 +93,7 @@ public class TransformUtils { * * @param dataC the array of {@link Complex} data to be transformed * @return a two dimensional array filled with the real and imaginary parts - * of the specified complex input + * of the specified complex input */ public static double[][] createRealImaginaryArray(final Complex[] dataC) { final double[][] dataRI = new double[2][dataC.length]; @@ -117,10 +117,9 @@ public class TransformUtils { * * * @param dataRI the array of real and imaginary parts to be transformed - * @return an array of {@link Complex} with specified real and imaginary - * parts. + * @return an array of {@link Complex} with specified real and imaginary parts. * @throws DimensionMismatchException if the number of rows of the specified - * array is not two, or the array is not rectangular + * array is not two, or the array is not rectangular */ public static Complex[] createComplexArray(final double[][] dataRI) throws DimensionMismatchException{