diff options
Diffstat (limited to 'filter.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 }¨ 𝕩 |
