diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-02-11 13:19:52 -0500 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-02-11 13:19:52 -0500 |
| commit | 13b10e45090a5569de994847febcdf71b8f44f88 (patch) | |
| tree | 576ea25c03b3003e0396cf209970d692ce7f390f | |
| parent | 4f3b2a488cbd63936266117008cfa560fa42a1c2 (diff) | |
Avoid name lookups in filter code for faster execution in current dzaima/BQN
| -rw-r--r-- | filter.bqn | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -38,19 +38,19 @@ o ← ≠◶⟨•Import∘"options.bqn", ⊑⟩ •args # 𝕨 is ⟨result coefficients , 𝕩 coefficients⟩. Filter ← { ⟨i0⟩‿⟨o0⟩ 𝕊𝕩: - b0←a0←0 - { b0↩(o0×b0)+i0×a0↩𝕩 }¨ 𝕩 + 1↓ (×⟜o0+i0⊸×)` 0∾𝕩 ;⟨i0,i1⟩‿⟨o0⟩ 𝕊𝕩: - b0←a1←a0←0 - { b0↩(o0×b0)+(i1×a1↩𝕩)+i0×a0↩a1 }¨ 𝕩 + b0←a1←a0←0 ⋄ coeff←∾𝕨 + { b0↩+´coeff×⟨a0↩a1,a1↩𝕩,b0⟩ }¨ 𝕩 ;⟨i0,i1,i2⟩‿⟨o0,o1⟩ 𝕊𝕩: - b1←b0←a2←a1←a0←0 - { b1↩(o1×b0↩b1)+(o0×b0)+(i2×a2↩𝕩)+(i1×a1↩a2)+i0×a0↩a1 }¨ 𝕩 + b1←b0←a2←a1←a0←0 ⋄ coeff←∾𝕨 + { b1↩+´coeff×⟨a0↩a1,a1↩a2,a2↩𝕩,b0,b0↩b1⟩ }¨ 𝕩 ;coeff 𝕊𝕩: a‿b ← 0×coeff # accumulators for input and result + c ← ∾coeff { a«˜↩𝕩 - r←+´coeff+´∘רa‿b + r←+´c×a∾b b«˜↩r r }¨ 𝕩 |
