16 lines
443 B
Text
16 lines
443 B
Text
F deconv(g, f)
|
|
V result = [0]*(g.len - f.len + 1)
|
|
L(&e) result
|
|
V n = L.index
|
|
e = g[n]
|
|
V lower_bound = I n >= f.len {n - f.len + 1} E 0
|
|
L(i) lower_bound .< n
|
|
e -= result[i] * f[n - i]
|
|
e /= f[0]
|
|
R result
|
|
|
|
V h = [-8,-9,-3,-1,-6,7]
|
|
V f = [-3,-6,-1,8,-6,3,-1,-9,-9,3,-2,5,2,-2,-7,-1]
|
|
V g = [24,75,71,-34,3,22,-45,23,245,25,52,25,-67,-96,96,31,55,36,29,-43,-7]
|
|
print(deconv(g, f))
|
|
print(deconv(g, h))
|