Generic Convolution¶
Asymptotically fast convolution of lists over any commutative ring
in which the multiply-by-two map is injective. (More precisely, if
The main function to be exported is convolution()
.
EXAMPLES:
sage: convolution([1, 2, 3, 4, 5], [6, 7])
[6, 19, 32, 45, 58, 35]
The convolution function is reasonably fast, even though it is written in pure Python. For example, the following takes less than a second:
sage: v = convolution(list(range(1000)), list(range(1000)))
ALGORITHM:
Converts the problem to multiplication in the ring
Complexity is O(n log(n) log(log(n))) additions/subtractions in R and O(n log(n)) multiplications in R.
AUTHORS:
David Harvey (2007-07): first implementation
William Stein: editing the docstrings for inclusion in Sage.