Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //// naive O(n^2) algorithm for verifying fft algorithm
- my.Complex2.prototype.dft = function(mode) {
- var ee, ii2, ll2, tmp;
- ll2 = this[0].ll2; ee = my.Complex2(1, ll2); tmp = ee.copy();
- ee[1].set(my.Array2.range(ll2)).mul(-2 * Math.PI / ll2); if(mode === 'reverse') {ee.neg();}
- if(mode === 'reverse') {this.mul(1 / ll2);}
- this.each1(
- function(slice) {
- tmp.set([0, 0]);
- for(ii2 = 0; ii2 < ll2; ii2 += 1) {
- tmp.slice(null, null, ii2, ii2 + 1).dot2(
- ee.copy().mul(ii2).exp2(),
- slice
- );
- }
- slice.set(tmp);
- }
- );
- };
Add Comment
Please, Sign In to add comment