21 lines
563 B
Plaintext
21 lines
563 B
Plaintext
function deconv(sequence g, sequence f)
|
|
integer lf = length(f)
|
|
sequence h = repeat(0,length(g)-lf+1)
|
|
for n = 1 to length(h) do
|
|
atom e = g[n]
|
|
for i=max(n-lf,0) to n-2 do
|
|
e -= h[i+1] * f[n-i]
|
|
end for
|
|
h[n] = e/f[1]
|
|
end for
|
|
return h
|
|
end function
|
|
|
|
constant h = {-8,-9,-3,-1,-6,7}
|
|
constant f = {-3,-6,-1,8,-6,3,-1,-9,-9,3,-2,5,2,-2,-7,-1}
|
|
constant g = {24,75,71,-34,3,22,-45,23,245,25,52,25,-67,
|
|
-96,96,31,55,36,29,-43,-7}
|
|
sequence r
|
|
r = deconv(g, f) ?{r==h,r}
|
|
r = deconv(g, h) ?{r==f,r}
|