diff --git a/src/main/java/org/apache/commons/math/transform/FastHadamardTransformer.java b/src/main/java/org/apache/commons/math/transform/FastHadamardTransformer.java
index b510de72e..9bf198695 100644
--- a/src/main/java/org/apache/commons/math/transform/FastHadamardTransformer.java
+++ b/src/main/java/org/apache/commons/math/transform/FastHadamardTransformer.java
@@ -75,18 +75,17 @@ public class FastHadamardTransformer implements RealTransformer {
}
/**
- * The FHT (Fast Hadamard Transformation) which uses only subtraction and addition.
- *
- * Requires Nlog2N = n2n additions.
- *
- *
- * Short Table of manual calculation for N=8:
+ * The FHT (Fast Hadamard Transformation) which uses only subtraction and
+ * addition. Requires {@code N * log2(N) = n * 2^n} additions.
+ *
+ *
x | *a | @@ -94,109 +93,127 @@ public class FastHadamardTransformer implements RealTransformer { *y | *||
---|---|---|---|---|
x0 | + *x0 | *a0 = x0 + x1 | *b0 = a0 + a1 | *y0 = b0+ b1 | *
x1 | + *x1 | *a1 = x2 + x3 | *b0 = a2 + a3 | *y0 = b2 + b3 | *
x2 | + *x2 | *a2 = x4 + x5 | *b0 = a4 + a5 | *y0 = b4 + b5 | *
x3 | + *x3 | *a3 = x6 + x7 | *b0 = a6 + a7 | *y0 = b6 + b7 | *
x4 | + *x4 | *a0 = x0 - x1 | *b0 = a0 - a1 | *y0 = b0 - b1 | *
x5 | + *x5 | *a1 = x2 - x3 | *b0 = a2 - a3 | *y0 = b2 - b3 | *
x6 | + *x6 | *a2 = x4 - x5 | *b0 = a4 - a5 | *y0 = b4 - b5 | *
x7 | + *x7 | *a3 = x6 - x7 | *b0 = a6 - a7 | *y0 = b6 - b7 | *
0 | - *1 | - *2 | - *3 | - *... | - *n + 1 | + *0 | 1 | 2 | 3 | + *… | + *n + 1 | *|
---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | + *0 | *x0 | - *↑ | + *
+ * ↑ + * ← Dtop → + * ↓ + * |
* ||||||||
1 | x1 | |||||||||||
2 | x2 | |||||||||||
… | … | |||||||||||
N / 2 - 1 | xN/2-1 | |||||||||||
N / 2 | + *xN/2 | + *
+ * ↑ + * ← Dbottom → + * ↓ + * |
+ * ||||||||||
N / 2 + 1 | xN/2+1 | |||||||||||
N / 2 + 2 | xN/2+2 | |||||||||||
… | … | |||||||||||
N | xN |
- * +--------+---+---+---+-----+---+ - * | 0 | 1 | 2 | 3 | ... |n+1| - * +------+--------+---+---+---+-----+---+ - * |0 | x0 | /\ | - * |1 | x1 | || | - * |2 | x2 | <= Dtop => | - * |... | ... | || | - * |N/2-1 | xN/2-1 | \/ | - * +------+--------+---+---+---+-----+---+ - * |N/2 | xN/2 | /\ | - * |N/2+1 | xN/2+1 | || | - * |N/2+2 | xN/2+2 | <= Dbottom => | which is in the last column of the matrix - * |... | ... | || | - * |N | xN/2 | \/ | - * +------+--------+---+---+---+-----+---+ - ** - * @param x input vector - * @return y output vector + * @param x the input vector + * @return the output vector, {@code y} * @exception IllegalArgumentException if input array is not a power of 2 */ protected double[] fht(double[] x) throws IllegalArgumentException {