RosettaCodeData/Task/Deconvolution-1D/Mathematica/deconvolution-1d.math

6 lines
195 B
Plaintext

deconv[f_List, g_List] :=
Module[{A =
SparseArray[
Table[Band[{n, 1}] -> f[[n]], {n, 1, Length[f]}], {Length[g], Length[f] - 1}]},
Take[LinearSolve[A, g], Length[g] - Length[f] + 1]]