|
|
1.1 ! root 1: # Discrete Fourier Transform ! 2: # Usage: dft : b ! 3: # Where "b" is the input vector ! 4: ! 5: {pi %3.141592653589793} ! 6: ! 7: {wN 1} ! 8: {p 2} ! 9: {r 2} ! 10: {B 1} ! 11: ! 12: {realCDiv &/ @ distr @ reverse} ! 13: ! 14: {distMult &* @ distl} ! 15: ! 16: {iota0 apndl @ [%0, ! 17: iota @ - @ [id,%1] ! 18: ] ! 19: } ! 20: ! 21: {oddp = @ [%1 , mod @ [id,%2]]} ! 22: ! 23: {cAdd &+ @ trans} ! 24: ! 25: {reCxIp !cAdd @ &&* @ &distl @ trans} ! 26: ! 27: {cExp [cos , sin]} ! 28: ! 29: {N length @ 1} ! 30: ! 31: {w cExp @ / @ [!* @ [%-2, pi, p], ! 32: wN ! 33: ] ! 34: } ! 35: ! 36: {ws cExp @ + @ [pi, ! 37: / @ [!* @ [%-2, pi, p], ! 38: wN ! 39: ] ! 40: ] ! 41: ! 42: } ! 43: ! 44: ! 45: {wFactors &(oddp @ 3 -> ! 46: ws @ [1,* @ tl]; ! 47: w @ [1,* @ tl]) @ ! 48: &apndl @ ! 49: distl @ ! 50: [N, ! 51: distl @ [r, iota0 @ N] ! 52: ] ! 53: } ! 54: ! 55: ! 56: ! 57: ! 58: ! 59: {dftPt realCDiv @ [N, ! 60: reCxIp @ [B, wFactors] ! 61: ] ! 62: } ! 63: ! 64: {dft &dftPt @ distl @ [id,iota0 @ length]} ! 65: ! 66: {b %<1.0, 2.0, 3.0, 4.0, 3.0, 2.0, 1.0, 0.5>} ! 67: ! 68: {d %<0.0, 0.5, 1.0, 1.0>} ! 69: ! 70: {e %< ! 71: 1.0, 2.0, 3.0, 4.0, 3.0, 2.0, 1.0, 0.5, 1.0, 2.0, 3.0, 4.0, 3.0, 2.0, 1.0, 0.5, ! 72: 1.0, 2.0, 3.0, 4.0, 3.0, 2.0, 1.0, 0.5, 1.0, 2.0, 3.0, 4.0, 3.0, 2.0, 1.0, 0.5>}
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.