Guest User

Untitled

a guest
May 21st, 2018
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.80 KB | None | 0 0
  1.     public static Complex[] multiPoly(Complex[] t, Complex[] p, int N)
  2.     {  
  3.         Complex[] tempt = new Complex[2*N];
  4.         Complex[] tempp = new Complex[2*N];
  5.         for(int i=0; i<2*N; i++)
  6.         {
  7.             if(i<N)
  8.             {
  9.                 tempt[i]=t[i];
  10.                 tempp[i]=p[i];
  11.             }
  12.             else
  13.             {
  14.                 tempt[i]=new Complex(0, 0);
  15.                 tempp[i]=new Complex(0, 0);
  16.             }
  17.         }
  18.         Complex[] transformedt = FFT(tempt, 2*N);
  19.         Complex[] transformedp = FFT(tempp, 2*N);  
  20.         Complex[] timeser = new Complex[2*N];
  21.         for(int i= 0; i<timeser.length; i++) timeser[i] = transformedt[i].times(transformedp[i]);
  22.         Complex[] inversed = iFFT(timeser, 2*N);
  23.         return inversed;
  24.     }
Add Comment
Please, Sign In to add comment