aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2022-02-07 17:07:43 -0500
committerMarshall Lochbaum <mwlochbaum@gmail.com>2022-02-07 17:07:43 -0500
commit982a545bb3a5166de9fe052161bcac4a4964fcea (patch)
tree530b0da6f1c308e1560e6d8e50c3f32a6ddd1531
parent0363af515deaac6fa4e716e5e57b58a57e8c9633 (diff)
More FFT performance improvements
-rw-r--r--fft.bqn8
1 files changed, 4 insertions, 4 deletions
diff --git a/fft.bqn b/fft.bqn
index 735e92a..c735dc5 100644
--- a/fft.bqn
+++ b/fft.bqn
@@ -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¨⟩ 𝕩
}