diff options
Diffstat (limited to 'fft.bqn')
| -rw-r--r-- | fft.bqn | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -13,8 +13,8 @@ Sin‿Cos ← •math "FFT length must be a power of two" ! ⌊⊸=n s ← 2 ⥊˜ n - r ← (Cos≍Sin) π × (1↓s) ⥊ -⍟inv ↕⊸÷ l÷2 # Roots of unity - M ← -˝∘× ≍ +˝∘×⟜⌽ # Complex multiplication - F ← { 𝕨 ⊏⎉1⊸𝕊⍟(1<=𝕨) (=𝕨)⍉(+˝˘≍𝕨M-˝˘)𝕩 } # FFT loop - ÷⟜l⍟inv ⥊˘ r F s⊸⥊˘ ≍⟜(0¨)⍟(1==) 𝕩 + r ← (Cos⋈Sin) π × (1↓s) ⥊ -⍟inv ↕⊸÷ l÷2 # Roots of unity + M ← -´∘× ⋈ +´∘×⟜⌽ # Complex multiplication + F ← { (r (2‿0<⊸«𝕨⥊1)⊸/¨↩) ⊢ (+˝¨(𝕨⍉≍)¨r M-˝¨)𝕩 } # FFT loop + ÷⟜l⍟inv >⥊¨ (↕n) F´˜ s⊸⥊¨ (1==)◶⟨<˘,⊢⋈0¨⟩ 𝕩 } |
