package DFT;

import java.util.Vector;

class DftGen
{
  public static float[] from(float[] signal)
  {
    float[] res = new float[signal.length];
    
    Vector<Point> data = new Vector();
    

    for (int i = 0; i < signal.length; i++) {
      Point p = new Point(i, signal[i]);
      data.addElement(p);
    }
    
    Dft DFT = new Dft(data);
    
    Vector<Complex> transData = new Vector();
    int N = data.size();
    


    for (int i = 0; i < N; i++) {
      Complex cx = DFT.dftPoint(i);
      transData.addElement(cx);
    }
    for (int i = 0; i < N; i++) { res[i] = ((Complex)transData.get(i)).mag();
    }
    return res;
  }
}





