From f8a74e5e5640ccb7c592dbdf2ac095f963e4e70f Mon Sep 17 00:00:00 2001
From: Sebastien Brisard
Date: Wed, 14 Dec 2011 05:06:01 +0000
Subject: [PATCH] Alterations to the javadoc (MATH-677).
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1214057 13f79535-47bb-0310-9956-ffa450edef68
---
.../math/transform/FastCosineTransformer.java | 95 +++++++++++--------
1 file changed, 57 insertions(+), 38 deletions(-)
diff --git a/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java b/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java
index 697418bd2..14ea0927c 100644
--- a/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java
+++ b/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java
@@ -31,9 +31,48 @@ import org.apache.commons.math.util.FastMath;
*
* 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.
*
+ *
+ *
+ * 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()}.
+ *
+ *
+ *
+ * The orthogonal normalization convention is defined as follows
+ *
+ * - forward transform:
+ * yn = [2(N - 1)]-1/2 [x0
+ * + (-1)nxN-1]
+ * + [2 / (N - 1)]1/2 ∑k=1N-2
+ * xk cos[π nk / (N - 1)],
+ * - inverse transform:
+ * xk = [2(N - 1)]-1/2 [y0
+ * + (-1)kyN-1]
+ * + [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.
+ *
+ * {@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.FastMath;
* 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.FastMath;
*
* 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 implements RealTransformer {
/**
*
* 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 implements RealTransformer {
/**
*
* 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/2 ∑k=1N-2
- * xk cos[π nk / (N - 1)],
- * - Inverse transform:
- * xk = [2(N - 1)]-1/2 [y0
- * + (-1)kyN-1]
- * + [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.
+ * 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);