Author: celestin Date: Wed Dec 14 05:06:01 2011 New Revision: 1214057 URL: http://svn.apache.org/viewvc?rev=1214057&view=rev Log: Alterations to the javadoc (MATH-677). Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java?rev=1214057&r1=1214056&r2=1214057&view=diff ============================================================================== --- commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java (original) +++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java Wed Dec 14 05:06:01 2011 @@ -31,9 +31,48 @@ import org.apache.commons.math.util.Fast *

* There are several variants of the discrete cosine transform. The present * implementation corresponds to DCT-I, with various normalization conventions, - * which are specified in the comments of the factory methods {@link #create()} - * and {@link #createOrthogonal()}. + * which are described below. *

+ *

### Standard DCT-I

+ *

+ * The standard normalization convention is defined as follows + *

+ *
• forward transform: + * yn = (1/2) [x0 + (-1)nxN-1] + * + ∑k=1N-2 + * xk cos[π nk / (N - 1)],
• + *
• inverse transform: + * xk = [1 / (N - 1)] [y0 + * + (-1)kyN-1] + * + [2 / (N - 1)] ∑n=1N-2 + * yn cos[π nk / (N - 1)],
• + *
+ * where N is the size of the data sample. + *

+ *

{@link RealTransformer}s following this convention are returned by the + * factory method {@link #create()}. + *

+ *

### Orthogonal DCT-I

+ *

+ * The orthogonal normalization convention is defined as follows + *

+ *
• forward transform: + * yn = [2(N - 1)]-1/2 [x0 + * + (-1)nxN-1] + * + [2 / (N - 1)]1/2k=1N-2 + * xk cos[π nk / (N - 1)],
• + *
• inverse transform: + * xk = [2(N - 1)]-1/2 [y0 + * + (-1)kyN-1] + * + [2 / (N - 1)]1/2n=1N-2 + * yn cos[π nk / (N - 1)],
• + *
+ * which make 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()}. + *

+ *

### Link with the DFT, and assumptions on the layout of the data set

*

* DCT-I is equivalent to DFT of an even extension of the data series. * More precisely, if x0, …, xN-1 is the data set @@ -41,16 +80,20 @@ import org.apache.commons.math.util.Fast * x0#, …, x2N-3# * is defined as follows *

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

*

- * Then, the "standard" DCT-I (as returned by {@link #create()}) of the real - * data set x0, …, xN-1 is equal to - * half of the N first elements of the DFT of the extended data set - * x0#, …, x2N-3#. + * Then, the standard DCT-I y0, …, yN-1 of the real + * data set x0, …, xN-1 is equal to half + * of the N first elements of the DFT of the extended data set + * x0#, …, x2N-3# + *
+ * 2yn = ∑k=02N-3 + * xk# exp[-2πi nk / (2N - 2)] + *     k = 0, …, N-1. *

*

* The present implementation of the fast cosine transform requires the length @@ -60,7 +103,8 @@ import org.apache.commons.math.util.Fast *

*

As of version 2.0 this no longer implements Serializable

* - * @version \$Id\$ + * @version \$Id: FastCosineTransformer.java 1213585 2011-12-13 07:44:52Z + * celestin \$ * @since 1.2 */ public class FastCosineTransformer implements RealTransformer { @@ -89,22 +133,10 @@ public class FastCosineTransformer imple /** *

* Returns a new instance of this class. The returned transformer uses the - * "standard" normalizing conventions - *

- *
• Forward transform: - * yn = (1/2) [x0 + (-1)nxN-1] - * + ∑k=1N-2 - * xk cos[π nk / (N - 1)],
• - *
• Inverse transform: - * xk = [1 / (N - 1)] [y0 - * + (-1)kyN-1] - * + [2 / (N - 1)] ∑n=1N-2 - * yn cos[π nk / (N - 1)],
• - *
- * where N is the size of the data sample. + * standard normalizing conventions. *

* - * @return a new DCT transformer, with "standard" normalizing conventions + * @return a new DCT transformer, with standard normalizing conventions */ public static FastCosineTransformer create() { return new FastCosineTransformer(false); @@ -113,23 +145,10 @@ public class FastCosineTransformer imple /** *

* Returns a new instance of this class. The returned transformer uses the - * "orthogonal" normalizing conventions - *

- *
• Forward transform: - * yn = [2(N - 1)]-1/2 [x0 - * + (-1)nxN-1] - * + [2 / (N - 1)]1/2k=1N-2 - * xk cos[π nk / (N - 1)],
• - *
• Inverse transform: - * xk = [2(N - 1)]-1/2 [y0 - * + (-1)kyN-1] - * + [2 / (N - 1)]1/2n=1N-2 - * yn cos[π nk / (N - 1)],
• - *
- * which make the transform orthogonal. N is the size of the data sample. + * orthogonal normalizing conventions. *

* - * @return a new DCT transformer, with "orthogonal" normalizing conventions + * @return a new DCT transformer, with orthogonal normalizing conventions */ public static FastCosineTransformer createOrthogonal() { return new FastCosineTransformer(true);