Guest User

Untitled

a guest
Oct 16th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. //// naive O(n^2) algorithm for verifying fft algorithm
  2. my.Complex2.prototype.dft = function(mode) {
  3. var ee, ii2, ll2, tmp;
  4. ll2 = this[0].ll2; ee = my.Complex2(1, ll2); tmp = ee.copy();
  5. ee[1].set(my.Array2.range(ll2)).mul(-2 * Math.PI / ll2); if(mode === 'reverse') {ee.neg();}
  6. if(mode === 'reverse') {this.mul(1 / ll2);}
  7. this.each1(
  8. function(slice) {
  9. tmp.set([0, 0]);
  10. for(ii2 = 0; ii2 < ll2; ii2 += 1) {
  11. tmp.slice(null, null, ii2, ii2 + 1).dot2(
  12. ee.copy().mul(ii2).exp2(),
  13. slice
  14. );
  15. }
  16. slice.set(tmp);
  17. }
  18. );
  19. };
Add Comment
Please, Sign In to add comment