ListConvolve[ker,list]
forms the convolution of the kernel ker with list.
ListConvolve[ker,list,k]
forms the cyclic convolution in which the k
element of ker is aligned with each element in list.
ListConvolve[ker,list,{kL,kR}]
forms the cyclic convolution whose first element contains list[[1]]ker[[kL]] and whose last element contains list[[-1]]ker[[kR]].
ListConvolve[ker,list,klist,p]
forms the convolution in which list is padded at each end with repetitions of the element p.
ListConvolve[ker,list,klist,{p1,p2,…}]
forms the convolution in which list is padded at each end with cyclic repetitions of the pi.
ListConvolve[ker,list,klist,padding,g,h]
forms a generalized convolution in which g is used in place of Times and h in place of Plus.
ListConvolve[ker,list,klist,padding,g,h,lev]
forms a convolution using elements at level lev in ker and list.
ListConvolve
ListConvolve[ker,list]
forms the convolution of the kernel ker with list.
ListConvolve[ker,list,k]
forms the cyclic convolution in which the k
element of ker is aligned with each element in list.
ListConvolve[ker,list,{kL,kR}]
forms the cyclic convolution whose first element contains list[[1]]ker[[kL]] and whose last element contains list[[-1]]ker[[kR]].
ListConvolve[ker,list,klist,p]
forms the convolution in which list is padded at each end with repetitions of the element p.
ListConvolve[ker,list,klist,{p1,p2,…}]
forms the convolution in which list is padded at each end with cyclic repetitions of the pi.
ListConvolve[ker,list,klist,padding,g,h]
forms a generalized convolution in which g is used in place of Times and h in place of Plus.
ListConvolve[ker,list,klist,padding,g,h,lev]
forms a convolution using elements at level lev in ker and list.
Details
- With kernel Kr and list as, ListConvolve[ker,list] computes
, where the limits of the sum are such that the kernel never overhangs either end of the list. - ListConvolve[ker,list] gives a result of length Length[list]-Length[ker]+1.
- ListConvolve[ker,list] allows no overhangs and is equivalent to ListConvolve[ker,list,{-1,1}].
- ListConvolve[ker,list,k] is equivalent to ListConvolve[ker,list,{k,k}].
- The values of kL and kR in ListConvolve[ker,list,{kL,kR}] determine the amount of overhang to allow at each end of list.
- Common settings for {kL,kR} are:
-
{-1,1} no overhangs (default) {-1,-1} maximal overhang at the right‐hand end {1,1} maximal overhang at the left‐hand end {1,-1} maximal overhangs at both beginning and end - With maximal overhang at one end only, the result from ListConvolve is the same length as list.
- ListConvolve[ker,list,{kL,kR},padlist] effectively lays down repeated copies of padlist, then superimposes one copy of list on them and forms a convolution of the result.
- Common settings for padlist are:
-
p pad with repetitions of a single element {p1,p2,…} pad with cyclic repetitions of a sequence of elements list pad by treating list as cyclic (default) {} do no padding - ListConvolve works with multidimensional kernels and lists of data.
- ListConvolve[ker,list,{{kL 1,kL 2,…},{kR 1,kR 2,…}}] forms the cyclic convolution whose {1,1,…} element contains ker[[kL 1,kL 2,…]]list[[1,1,…]], and whose {-1,-1,…} element contains ker[[kR 1,kR 2,…]]list[[-1,-1,…]].
- {kL,kR} is taken to be equivalent to {{kL,kL,…},{kR,kR,…}}.
- When a function h is specified to use in place of Plus, explicit nested h expressions are generated with a depth equal to the depth of ker.
- ListConvolve works with exact numbers and symbolic data as well as approximate numbers.
Examples
open all close allBasic Examples (4)
Convolve a kernel {x,y} with a list of data:
ListConvolve[{x, y}, {a, b, c, d, e, f}]Make a cyclic convolution the same length as the original data:
ListConvolve[{x, y}, {a, b, c, d, e, f}, 1]Align element 2 in the kernel with successive elements in the data:
ListConvolve[{x, y}, {a, b, c, d, e, f}, 2]Pad with zzz instead of using the data cyclically:
ListConvolve[{x, y}, {a, b, c, d, e, f}, 1, zzz]ListConvolve[{{1, 1}, {1, 1}}, {{a, b, c}, {d, e, f}, {g, h, i}}]Scope (9)
Overhangs and Alignments (4)
"Slide" the kernel along the data, allowing no overhangs:
ListConvolve[{x, y, z}, {1, 2, 3, 4, 5, 6}]Maximal overhang at the beginning; none at the end:
ListConvolve[{x, y, z}, {1, 2, 3, 4, 5, 6}, 1]Maximal overhang at the end; none at the beginning:
ListConvolve[{x, y, z}, {1, 2, 3, 4, 5, 6}, -1]Maximal overhangs at both beginning and end:
ListConvolve[{x, y, z}, {1, 2, 3, 4, 5, 6}, {1, -1}]Align element 1 of the kernel with the first element of the data:
ListConvolve[{x, y, z}, {1, 2, 3, 4, 5, 6}, 1]Align element 2 of the kernel with the first element of the data:
ListConvolve[{x, y, z}, {1, 2, 3, 4, 5, 6}, 2]Align element 3 of the kernel with the first element of the data:
ListConvolve[{x, y, z}, {1, 2, 3, 4, 5, 6}, 3]Align the last element of the kernel with the first element of the data:
ListConvolve[{x, y, z}, {1, 2, 3, 4, 5, 6}, -1]Align the first element of the kernel with both the first and last elements of the data:
ListConvolve[{x, y, z}, {1, 2, 3, 4, 5, 6}, {1, 1}]Align element 2 of the kernel with the first element of the data:
ListConvolve[{x, y, z}, {1, 2, 3, 4, 5, 6}, {2, 1}]Align element 2 of the kernel with the last element of the data:
ListConvolve[{x, y, z}, {1, 2, 3, 4, 5, 6}, {1, 2}]Data Padding (2)
ListConvolve[{x, y, z}, {1, 2, 3, 4, 5}, 1, aa]Cyclically use a list of padding elements:
ListConvolve[{x, y, z}, {1, 2, 3, 4, 5}, 1, {aa, bb}]ListConvolve[{x, y, z}, {1, 2, 3, 4, 5}, 1, {aa, bb, cc}]ListConvolve[{x, y, z}, {1, 2, 3}, {1, -1}, {aa, bb, cc}]Higher Dimensions (3)
ListConvolve[{{a, b}, {c, d}}, {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}]Align with the {1,1} elements of the kernel and data:
ListConvolve[{{a, b}, {c, d}}, {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}, 1]The result has the same dimensions as the input data:
Dimensions[%]Give a different overhang in each dimension:
ListConvolve[{{a, b}, {c, d}}, {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}, {{1, 1}, {2, 2}}]Generalizations & Extensions (4)
ListConvolve works with sparse arrays:
ListConvolve[{a, b, c}, SparseArray[6 -> x, 20]]Use f in place of Times:
ListConvolve[{x, y}, {1, 2, 3, 4}, 1, 0, f]Use g in place of Plus:
ListConvolve[{x, y}, {1, 2, 3, 4}, 1, 0, f, g]ListConvolve[{x, y}, {1, 2, 3, 4}, 1, 0, f, List]Use f and g in place of Times and Plus, with empty data padding:
ListConvolve[{x, y, z}, {1, 2, 3}, 1, {}, f, g]ListConvolve[{x, y, z}, {1, 2, 3}, -1, {}, f, g]ListConvolve[{x, y, z}, {1, 2, 3}, {1, -1}, {}, f, g]ListConvolve works with TimeSeries:
ts = TimeSeries[Table[Subscript[x, t], {t, 12}]]ts["Path"]ListConvolve[{1 / 2, 1 / 2}, ts, {1}]%["Path"]Applications (9)
ListConvolve[{1, 1} / 2, {a, b, c, d, e}]Or use the MovingAverage function:
MovingAverage[{a, b, c, d, e}, 2]data = Table[Sqrt[x] + RandomReal[], {x, 30}];ListLinePlot[data]ListLinePlot[ListConvolve[{1, 1, 2, 1, 1} / 6, data]]Find the autocorrelation of a list:
data = Table[Mod[i ^ 2, 17], {i, 100}];ListLinePlot[ListConvolve[data, data, {1, 1}]]Apply a simple image processing filter:
ArrayPlot[CellularAutomaton[150, {{1}, 0}, 30]]ArrayPlot[ListConvolve[{{-1, 1}, {1, -1}}, CellularAutomaton[150, {{1}, 0}, 30]]]Multiply polynomials by convolving coefficient lists:
CoefficientList[(a + b x + c x ^ 2)(1 + 2x + 3x ^ 2 + 4x ^ 3), x]ListConvolve[{a, b, c}, {1, 2, 3, 4}, {1, -1}, 0]Multiply numbers by convolving digit lists:
ListConvolve[IntegerDigits[24561], IntegerDigits[1247], {1, -1}, 0]FromDigits[%, 10]24561 1247Column[NestList[ListConvolve[{1, 1}, #, {1, -1}, 0]&, {1}, 5], Center]Additive cellular automaton in base 5:
ArrayPlot[NestList[Mod[ListConvolve[{2, 3, 1}, #, 2], 5]&, SparseArray[50 -> 1, 101], 50]]Fast multiplication of high‐degree polynomials:
p1[x_] = RandomInteger[9, 101].x ^ Range[0, 100];
p2[x_] = RandomInteger[9, 101].x ^ Range[0, 100];Use ListConvolve with maximal overhangs and zero padding:
c3 = ListConvolve[CoefficientList[p1[x], x], CoefficientList[p2[x], x], {1, -1}, 0] ;p3[x_] = c3.x ^ Range[0, Length[c3] - 1];p3[x] == Expand[p1[x] p2[x]]Properties & Relations (8)
{a, b} = RandomReal[1, {2, 31}];A function for constructing a circulant matrix from a vector:
circulant[v_] := ToeplitzMatrix[v, RotateRight[Reverse[v]]]Cyclic convolution is equivalent to multiplication with a circulant matrix:
ListConvolve[a, b, {1, 1}] == circulant[a].bCyclic convolution is also equivalent to multiplication in the discrete Fourier transform domain:
ListConvolve[a, b, {1, 1}] == InverseFourier[Fourier[a] Fourier[b]] Sqrt[31]{a, b} = RandomReal[1, {2, 31}];A function for constructing a lower triangular Toeplitz matrix from a vector:
lttoep[v_] := With[{n = Length[v]}, ToeplitzMatrix[v, First[v]UnitVector[n, 1]]]Cyclic convolution with zero-padding is equivalent to multiplication with a lower triangular Toeplitz matrix:
ListConvolve[a, b, 1, 0] == lttoep[a].bConvolve with a single element:
ListConvolve[{1}, {1, 2, 3, 4, 5, 6}]ListConvolve[{1}, {1, 2, 3, 4, 5, 6}, 2]A kernel of the same length as the data, with no overhangs, is like a reversed dot product:
ListConvolve[{x, y, z}, {a, b, c}]ListConvolve[{1, -1}, {a, b, c, d, e}]Differences[{a, b, c, d, e}]Align with successive elements:
Table[ListConvolve[{x, y, z}, {1, 2, 3, 4, 5, 6}, i], {i, 3}]//ColumnTable[ListConvolve[{x, y, z}, {1, 2, 3, 4, 5, 6}, i], {i, -3, -1}]//ColumnTable[ListConvolve[{1, 1}, {1, 1, 1, 1}, {i, j}], {i, 4}, {j, 4}]//GridGrid[Table[ListConvolve[{1, 1}, {1, 1, 1, 1}, {i, -j}], {i, 4}, {j, 4}]]Grid[Table[ListConvolve[{1, 1}, {1, 1, 1, 1}, {-i, j}], {i, 4}, {j, 4}]]Varying alignments, with padding:
Table[ListConvolve[{1, 1}, {1, 1, 1, 1}, {i, j}, 0], {i, 4}, {j, 4}]//GridTable[ListConvolve[{1, 1}, {1, 1, 1, 1}, {i, -j}, 0], {i, 4}, {j, 4}]//GridTable[ListConvolve[{1, 1}, {1, 1, 1, 1}, {-i, j}, 0], {i, 4}, {j, 4}]//GridPossible Issues (1)
By default, the output is not the same length as the input:
ListConvolve[{1, 1}, {1, 2, 3, 4, 5}]Use overhangs to make the output the same length as the input:
ListConvolve[{1, 1}, {1, 2, 3, 4, 5}, 1]Use overhangs to do the same in 2D:
ListConvolve[{{1, 1}, {1, 1}}, {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}, 1]Related Links
History
Introduced in 1999 (4.0)
Text
Wolfram Research (1999), ListConvolve, Wolfram Language function, https://reference.wolfram.com/language/ref/ListConvolve.html.
CMS
Wolfram Language. 1999. "ListConvolve." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ListConvolve.html.
APA
Wolfram Language. (1999). ListConvolve. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ListConvolve.html
BibTeX
@misc{reference.wolfram_2026_listconvolve, author="Wolfram Research", title="{ListConvolve}", year="1999", howpublished="\url{https://reference.wolfram.com/language/ref/ListConvolve.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_listconvolve, organization={Wolfram Research}, title={ListConvolve}, year={1999}, url={https://reference.wolfram.com/language/ref/ListConvolve.html}, note=[Accessed: 12-June-2026]}