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 eb1708053..b510de72e 100644 --- a/src/main/java/org/apache/commons/math/transform/FastHadamardTransformer.java +++ b/src/main/java/org/apache/commons/math/transform/FastHadamardTransformer.java @@ -86,29 +86,62 @@ public class FastHadamardTransformer implements RealTransformer { *
  • y is the output vector which is our desired result
  • *
  • a and b are just helper rows
  • * - *
    -     * 
    -     * +----+----------+---------+----------+
    -     * | x  |    a     |    b    |    y     |
    -     * +----+----------+---------+----------+
    -     * | x0 | a0=x0+x1 | b0=a0+a1 | y0=b0+b1 |
    -     * +----+----------+---------+----------+
    -     * | x1 | a1=x2+x3 | b0=a2+a3 | y0=b2+b3 |
    -     * +----+----------+---------+----------+
    -     * | x2 | a2=x4+x5 | b0=a4+a5 | y0=b4+b5 |
    -     * +----+----------+---------+----------+
    -     * | x3 | a3=x6+x7 | b0=a6+a7 | y0=b6+b7 |
    -     * +----+----------+---------+----------+
    -     * | x4 | a0=x0-x1 | b0=a0-a1 | y0=b0-b1 |
    -     * +----+----------+---------+----------+
    -     * | x5 | a1=x2-x3 | b0=a2-a3 | y0=b2-b3 |
    -     * +----+----------+---------+----------+
    -     * | x6 | a2=x4-x5 | b0=a4-a5 | y0=b4-b5 |
    -     * +----+----------+---------+----------+
    -     * | x7 | a3=x6-x7 | b0=a6-a7 | y0=b6-b7 |
    -     * +----+----------+---------+----------+
    -     * 
    -     * 
    + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    xaby
    x0a0 = x0 + x1b0 = a0 + a1y0 = b0+ b1
    x1a1 = x2 + x3b0 = a2 + a3y0 = b2 + b3
    x2a2 = x4 + x5b0 = a4 + a5y0 = b4 + b5
    x3a3 = x6 + x7b0 = a6 + a7y0 = b6 + b7
    x4a0 = x0 - x1b0 = a0 - a1y0 = b0 - b1
    x5a1 = x2 - x3b0 = a2 - a3y0 = b2 - b3
    x6a2 = x4 - x5b0 = a4 - a5y0 = b4 - b5
    x7a3 = x6 - x7b0 = a6 - a7y0 = b6 - b7
    * * How it works *
      @@ -129,6 +162,21 @@ public class FastHadamardTransformer implements RealTransformer { *
    *
    * Visually + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    0123...n + 1
    0x0
    *
          *        +--------+---+---+---+-----+---+
          *        |   0    | 1 | 2 | 3 | ... |n+1|