Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.math.transform
Class FastFourierTransformer.RootsOfUnity

    java.lang.Object
      org.apache.commons.math.transform.FastFourierTransformer.RootsOfUnity

All Implemented Interfaces:
  java.io.Serializable

Enclosing class:
  FastFourierTransformer

    private static class FastFourierTransformer.RootsOfUnity

extends java.lang.Object
implements java.io.Serializable

Computes the nth roots of unity. A cache of already computed values is maintained.

Field Summary
`private boolean` | `isForward` Forward/reverse indicator.
`private int` | `omegaCount` Number of roots of unity.
`private double[]` | `omegaImaginaryForward` Imaginary part of the roots for forward transform.
`private double[]` | `omegaImaginaryInverse` Imaginary part of the roots for reverse transform.
`private double[]` | `omegaReal` Real part of the roots.
`private static long` | `serialVersionUID` Serializable version id.

Constructor Summary
`FastFourierTransformer.RootsOfUnity()` Build an engine for computing then th roots of unity

Method Summary
`void` | `computeOmega(int n)` Computes the nth roots of unity.
`double` | `getOmegaImaginary(int k)` Get the imaginary part of the kth nth root of unity
`double` | `getOmegaReal(int k)` Get the real part of the kth nth root of unity
`boolean` | `isForward()` Check if computation has been done for forward or reverse transform.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### serialVersionUID

    private static final long serialVersionUID

  Serializable version id.

  See Also:
    Constant Field Values

### omegaCount

    private int omegaCount

  Number of roots of unity.

### omegaReal

    private double[] omegaReal

  Real part of the roots.

### omegaImaginaryForward

    private double[] omegaImaginaryForward

  Imaginary part of the roots for forward transform.

### omegaImaginaryInverse

    private double[] omegaImaginaryInverse

  Imaginary part of the roots for reverse transform.

### isForward

    private boolean isForward

  Forward/reverse indicator.

Constructor Detail

### FastFourierTransformer.RootsOfUnity

    public FastFourierTransformer.RootsOfUnity()

  Build an engine for computing then th roots of unity

Method Detail

### isForward

    public boolean isForward()
                      throws java.lang.IllegalStateException

  Check if computation has been done for forward or reverse transform.

  Returns:
    true if computation has been done for forward transform
  Throws:
    `java.lang.IllegalStateException` - if no roots of unity have been computed yet

### computeOmega

    public void computeOmega(int n)
                      throws java.lang.IllegalArgumentException

  Computes the nth roots of unity.

  The computed omega[] = { 1, w, w2, ... w(n-1) } where w = exp(-2 π i / n), i = &sqrt;(-1).

  Note that n is positive for forward transform and negative for inverse transform.

  Parameters:
    `n` - number of roots of unity to compute, positive for forward transform, negative for inverse transform
  Throws:
    `java.lang.IllegalArgumentException` - if n = 0

### getOmegaReal

    public double getOmegaReal(int k)
                        throws java.lang.IllegalStateException,
                               java.lang.IllegalArgumentException

  Get the real part of the kth nth root of unity

  Parameters:
    `k` - index of the nth root of unity
  Returns:
    real part of the kth nth root of unity
  Throws:
    `java.lang.IllegalStateException` - if no roots of unity have been computed yet
    `java.lang.IllegalArgumentException` - if k is out of range

### getOmegaImaginary

    public double getOmegaImaginary(int k)
                             throws java.lang.IllegalStateException,
                                    java.lang.IllegalArgumentException

  Get the imaginary part of the kth nth root of unity

  Parameters:
    `k` - index of the nth root of unity
  Returns:
    imaginary part of the kth nth root of unity
  Throws:
    `java.lang.IllegalStateException` - if no roots of unity have been computed yet
    `java.lang.IllegalArgumentException` - if k is out of range

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 2003-2011 Apache Software Foundation