From ead76ad6aceb93de5bcef423ace01650f0558804 Mon Sep 17 00:00:00 2001
From: Sebastien Brisard
+ *
* There are several variants of the discrete cosine transform. The present
* implementation corresponds to DCT-I, with various normalization conventions,
@@ -67,7 +67,7 @@ import org.apache.commons.math.util.FastMath;
* + [2 / (N - 1)]1/2 ∑n=1N-2
* yn cos[π nk / (N - 1)],
*
- * which make the transform orthogonal. N is the size of the data sample.
+ * which makes the transform orthogonal. N is the size of the data sample.
* {@link RealTransformer}s following this convention are returned by the
* factory method {@link #createOrthogonal()}.
@@ -91,17 +91,17 @@ import org.apache.commons.math.util.FastMath;
* of the N first elements of the DFT of the extended data set
* x0#, …, x2N-3#
*
- * The present implementation of the fast cosine transform requires the length
- * of the data set to be a power of two plus one
+ * 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.
* As of version 2.0 this no longer implements Serializable As of version 2.0 this no longer implements Serializable.
- * There are several conventions for the definition of FFT and inverse FFT,
- * mainly on different coefficient and exponent. The conventions adopted in the
- * present implementation are specified in the comments of the two provided
- * factory methods, {@link #create()} and {@link #createUnitary()}.
+ * 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.
*
- * We require the length of data set to be power of 2, this greatly simplifies
- * and speeds up the code. Users can pad the data with zeros to meet this
- * requirement. There are other flavors of FFT, for reference, see S. Winograd,
+ * There are several variants of the discrete Fourier transform, with various
+ * normalization conventions, which are described below.
+ *
+ * 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.
+ * This greatly simplifies and speeds up the code. Users can pad the data with
+ * zeros to meet this requirement. There are other flavors of FFT, for
+ * reference, see S. Winograd,
* On computing the discrete Fourier transform, Mathematics of
* Computation, 32 (1978), 175 - 199.
*
+ * The standard normalization convention is defined as follows
+ *
- * 2yn = ∑k=02N-3
+ * yn = (1 / 2) ∑k=02N-3
* xk# exp[-2πi nk / (2N - 2)]
* k = 0, …, N-1.
* Standard DFT
+ *
+ *
+ * where N is the size of the data sample.
+ *
+ * {@link FastFourierTransformer}s following this convention are returned by the + * factory method {@link #create()}. + *
+ *+ * The unitary normalization convention is defined as follows + *
+ * {@link FastFourierTransformer}s following this convention are returned by the + * factory method {@link #createUnitary()}. + *
* - * @version $Id$ + * @version $Id: FastFourierTransformer.java 1212260 2011-12-09 06:45:09Z + * celestin $ * @since 1.2 */ public class FastFourierTransformer implements Serializable { @@ -76,22 +108,14 @@ public class FastFourierTransformer implements Serializable { this.unitary = unitary; } + /** ** Returns a new instance of this class. The returned transformer uses the - * normalizing conventions described below. - *
* Returns a new instance of this class. The returned transformer uses the - * normalizing conventions described below. - *
- * FST is its own inverse, up to a multiplier depending on conventions. - * The equations are listed in the comments of the corresponding methods.
+ * 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). + * *- * Similar to FFT, we also require the length of data set to be power of 2. - * In addition, the first element must be 0 and it's enforced in function - * transformation after sampling.
- *As of version 2.0 this no longer implements Serializable
+ * There are several variants of the discrete sine transform. The present + * implementation corresponds to DST-I, with various normalization conventions, + * which are described below. It should be noted that regardless to the + * convention, the first element of the dataset to be transformed must be + * zero. + * + *+ * The standard normalization convention is defined as follows + *
+ * {@link RealTransformer}s following this convention are returned by the + * factory method {@link #create()}. + *
+ *+ * The orthogonal normalization convention is defined as follows + *
+ * {@link RealTransformer}s following this convention are returned by the + * factory method {@link #createOrthogonal()}. + *
+ *+ * DST-I is equivalent to DFT of an odd extension of the data series. + * More precisely, if x0, …, xN-1 is the data set + * to be sine transformed, the extended data set x0#, + * …, x2N-1# is defined as follows + *
+ * Then, the standard DST-I y0, …, yN-1 of the real
+ * data set x0, …, xN-1 is equal to half
+ * of i (the pure imaginary number) times the N first elements of the DFT of the
+ * extended data set x0#, …,
+ * x2N-1#
+ * 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, + * it implicitly assumes that the sampled function is odd. In particular, the + * first element of the data set must be 0, which is enforced in + * {@link #transform(UnivariateFunction, double, double, int)} and + * {@link #inverseTransform(UnivariateFunction, double, double, int)}, after + * sampling. + *
+ *+ * As of version 2.0 this no longer implements Serializable. + *
* - * @version $Id$ + * @version $Id: FastSineTransformer.java 1213157 2011-12-12 07:19:23Z celestin$ * @since 1.2 */ public class FastSineTransformer implements RealTransformer { @@ -65,19 +132,10 @@ public class FastSineTransformer implements RealTransformer { /** ** Returns a new instance of this class. The returned transformer uses the - * normalizing conventions described below. - *
* Returns a new instance of this class. The returned transformer uses the - * normalizing conventions described below. - *