8#include "FourierTransform.h" 
   27  std::vector< std::complex<double> >
 
   32    vector< std::complex<double> > output(n);
 
   37    for(
int i = 0; i < n; i++) {
 
   38      if(output[i] == 0.0) {
 
   47    for(
int m = 1; m < n; m *= 2) {
 
   48      complex<double> Wm(polar(1.0, -1.0 * 
PI / m)); 
 
   49      for(
int k = 0; k < n; k += 2 * m) {
 
   51        complex<double> W(1.0);
 
   52        for(
int j = 0; j < m; j++) {
 
   53          complex<double> t = W * output[k+j+m]; 
 
   54          complex<double> u = output[k+j];
 
   56          output[k+j+m] = u - t; 
 
 
   74  std::vector< std::complex<double> >
 
   78    std::vector< std::complex<double> > temp(n);
 
   79    for(
int i = 0; i < n; i++) {
 
   80      temp[i] = conj(input[i]);
 
   83    std::vector< std::complex<double> > output = 
Transform(temp);
 
   85    for(
int i = 0; i < n; i++) {
 
   86      output[i] = conj(output[i]) / ((double)n);
 
 
  102      if(n % 2 == 1) 
return false;
 
 
  149    return(
int)(ans * n / 2);
 
 
  162    return(
int)pow(2.0, 
lg(n) + 1);
 
 
This is free and unencumbered software released into the public domain.
 
const double PI
The mathematical constant PI.
 
Namespace for the standard library.