ListCorrelate[ker,list]
forms the correlation of the kernel ker with list.
ListCorrelate[ker,list,k]
forms the cyclic correlation in which the k
element of ker is aligned with each element in list.
ListCorrelate[ker,list,{kL,kR}]
forms the cyclic correlation whose first element contains list[[1]]ker[[kL]] and whose last element contains list[[-1]]ker[[kR]].
ListCorrelate[ker,list,klist,p]
forms the correlation in which list is padded at each end with repetitions of the element p.
ListCorrelate[ker,list,klist,{p1,p2,…}]
forms the correlation in which list is padded at each end with cyclic repetitions of the pi.
ListCorrelate[ker,list,klist,padding,g,h]
forms a generalized correlation in which g is used in place of Times and h in place of Plus.
ListCorrelate[ker,list,klist,padding,g,h,lev]
forms a correlation using elements at level lev in ker and list.
ListCorrelate
ListCorrelate[ker,list]
forms the correlation of the kernel ker with list.
ListCorrelate[ker,list,k]
forms the cyclic correlation in which the k
element of ker is aligned with each element in list.
ListCorrelate[ker,list,{kL,kR}]
forms the cyclic correlation whose first element contains list[[1]]ker[[kL]] and whose last element contains list[[-1]]ker[[kR]].
ListCorrelate[ker,list,klist,p]
forms the correlation in which list is padded at each end with repetitions of the element p.
ListCorrelate[ker,list,klist,{p1,p2,…}]
forms the correlation in which list is padded at each end with cyclic repetitions of the pi.
ListCorrelate[ker,list,klist,padding,g,h]
forms a generalized correlation in which g is used in place of Times and h in place of Plus.
ListCorrelate[ker,list,klist,padding,g,h,lev]
forms a correlation using elements at level lev in ker and list.
Details
- With kernel Kr and list as, ListCorrelate[ker,list] computes
, where the limits of the sum are such that the kernel never overhangs either end of the list. - For a one‐dimensional list ListCorrelate[ker,list] is equivalent to ListConvolve[Reverse[ker],list].
- For higher-dimensional lists, ker must be reversed at every level.
- Settings for kL and kR are negated in ListConvolve relative to ListCorrelate.
- Common settings for {kL,kR} in ListCorrelate 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
Examples
open all close allBasic Examples (4)
Correlate a kernel {x,y} with a list of data:
ListCorrelate[{x, y}, {a, b, c, d, e, f}]Make a cyclic correlation the same length as the original data:
ListCorrelate[{x, y}, {a, b, c, d, e, f}, 1]Align element 2 in the kernel with successive elements in the data:
ListCorrelate[{x, y}, {a, b, c, d, e, f}, 2]Pad with zzz instead of using the data cyclically:
ListCorrelate[{x, y}, {a, b, c, d, e, f}, 1, zzz]ListCorrelate[{{1, 1}, {1, 1}}, {{a, b, c}, {d, e, f}, {g, h, i}}]Scope (5)
Use exact arithmetic to compute the correlation:
ker = Differences[Range[10] ^ 2];
list = 1 / Range[20];ListCorrelate[ker, list]ListCorrelate[N[ker], N[list]]Use 24-digit precision arithmetic:
ListCorrelate[N[ker, 24], N[list, 24]]ListCorrelate[{1, I}, RandomComplex[1 + I, 5]]ListCorrelate[{{1, 0, 1}, {0, -4, 0}, {1, 0, 1}}, Array[Subscript[a, #]&, {4, 4}]]Cyclic two-dimensional correlation:
c = ListCorrelate[{{1, 0, 1}, {0, -4, 0}, {1, 0, 1}}, Array[Subscript[a, #]&, {4, 4}], {1, 1}];MatrixForm[c]Two-dimensional correlation with maximal overhangs and zero padding:
c = ListCorrelate[{{1, 0, 1}, {0, -4, 0}, {1, 0, 1}}, Array[Subscript[a, #]&, {4, 4}], {-1, 1}, 0];MatrixForm[c]Generalizations & Extensions (4)
Use functions f and g in place of Plus and Times:
ListCorrelate[{x, y, z}, {1, 2, 3, 4, 5}, {1, -1}, {x, y, z}, f, g]Use functions f and g in place of Plus and Times with maximal overhangs and zero padding:
ListCorrelate[{x, y, z}, {1, 2, 3, 4, 5}, {-1, 1}, 0, f, g]Use functions f and g in place of Plus and Times with maximal overhangs and empty padding:
ListCorrelate[{x, y, z}, {1, 2, 3, 4, 5}, {-1, 1}, {}, f, g]ListCorrelate works with TimeSeries:
ts = TimeSeries[Table[Subscript[x, t], {t, 12}]]ts["Path"]ListCorrelate[{1 / 2, 1 / 2}, ts, {1}]%["Path"]Applications (6)
Smooth data with a weighted running average:
x = N[Range[1000] / 1000];
data = RandomReal[{-1, 1}, 1000] + 2 Sin[7 x];Normalized Gaussian profile for averaging weights:
w = Exp[-.01 N[Range[-24, 24] ^ 2]];
w /= Total[w];smoother = ListCorrelate[w, data];Show[ListLinePlot[Transpose[{x, data}]], ListLinePlot[Transpose[{Take[x, {25, -25}], smoother}], PlotStyle -> Red]]Gaussian smoothing of an image:
img = 256 - Import["ExampleData/turtle.jpg", "Data"];
ArrayPlot[img]Gaussian kernel with a 5×5 pixel stencil:
g[σ_][x_, y_] := (1/2 π σ^2)Exp[-(1/2σ^2)(x ^ 2 + y ^ 2)];
gk = N[Outer[g[1], Range[-2, 2], Range[-2, 2]]];smooth = ListCorrelate[gk, img];ArrayPlot[smooth]img = 256 - Import["ExampleData/ocelot.jpg", "Data"];
ArrayPlot[img]Correlate with a Laplacian filter kernel:
dimg = ListCorrelate[{{1, 0, 1}, {0, -4, 0}, {1, 0, 1}}, img];ArrayPlot[dimg]Use a Laplacian of a Gaussian filter kernel:
g[σ_][x_, y_] := (1/2 π σ^2)Exp[-(1/2σ^2)(x ^ 2 + y ^ 2)];
f[σ_][x_, y_] = D[g[σ][x, y], {x, 2}] + D[g[σ][x, y], {y, 2}];ker = Outer[f[1.5], N[Range[-5, 5]], N[Range[-5, 5]]];
ListPlot3D[ker, PlotRange -> All]dimg = ListCorrelate[ker, img];ArrayPlot[dimg]NestList[ListCorrelate[{1, 1}, #, {-1, 1}, 0]&, {1}, 10]Column[%, Center]{ArrayPlot[PadRight[Mod[NestList[ListCorrelate[{1, 1}, #, {-1, 1}, 0]&, {1}, 100], 2]]], ArrayPlot[PadRight[Mod[NestList[ListCorrelate[{1, 2}, #, {-1, 1}, 0]&, {1}, 100], 5]]]}Apply a finite difference formula to a uniformly sampled function:
n = 100;h = 1. / n;
x = N[h Range[n]];
f = Sin[2 π x];ListPlot[{f, ListCorrelate[({-1, 0, 1}/2 h), f, 2]}, DataRange -> {0, 1}]Show the error for different numbers of grid points:
Table[n = 10 ^ k; h = 1. / n;x = N[h Range[n]];
ListPlot[2π Cos[2 π x] - ListCorrelate[({-1, 0, 1}/2 h), Sin[2 π x], 2], DataRange -> {h, 1}] ,
{k, 1, 3}]Show the error for different numbers of grid points for a second derivative approximation:
Table[n = 10 ^ k; h = 1. / n;x = N[h Range[n]];
ListPlot[-4 π^2Sin[2 π x] - ListCorrelate[({-1, 16, -30, 16, -1}/12 h^2), Sin[2 π x], 3], DataRange -> {h, 1}] ,
{k, 1, 3}]Properties & Relations (3)
ListCorrelate is equivalent to ListConvolve with the kernel reversed:
ker = RandomReal[1, {123}];
list = RandomReal[1, {10000}];ListConvolve[ker, list] == ListCorrelate[Reverse[ker], list]{a, b} = RandomReal[1, {2, 31}];A function for constructing a circulant matrix from a vector:
circulant[v_] := ToeplitzMatrix[v, RotateRight[Reverse[v]]]Cyclic correlation is equivalent to multiplication with a circulant matrix:
ListCorrelate[a, b, {-1, -1}] == circulant[Reverse[a]].bCyclic correlation is also equivalent to multiplication in the discrete Fourier transform domain:
ListCorrelate[a, b, {-1, -1}] == InverseFourier[Fourier[Reverse[a]] Fourier[b]] Sqrt[31]{a, b} = RandomReal[1, {2, 31}];A function for constructing an upper triangular Toeplitz matrix from a vector:
uttoep[v_] := With[{n = Length[v]}, ToeplitzMatrix[First[v]UnitVector[n, 1], v]]Cyclic correlation with zero-padding is equivalent to multiplication with an upper triangular Toeplitz matrix:
ListCorrelate[a, b, 1, 0] == uttoep[a].bSee Also
ListConvolve LinearRecurrence MovingAverage Partition Accumulate Differences Inner CellularAutomaton ArrayFilter PadLeft ToeplitzMatrix
Function Repository: Correlogram
Related Links
History
Introduced in 1999 (4.0)
Text
Wolfram Research (1999), ListCorrelate, Wolfram Language function, https://reference.wolfram.com/language/ref/ListCorrelate.html.
CMS
Wolfram Language. 1999. "ListCorrelate." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ListCorrelate.html.
APA
Wolfram Language. (1999). ListCorrelate. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ListCorrelate.html
BibTeX
@misc{reference.wolfram_2026_listcorrelate, author="Wolfram Research", title="{ListCorrelate}", year="1999", howpublished="\url{https://reference.wolfram.com/language/ref/ListCorrelate.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_listcorrelate, organization={Wolfram Research}, title={ListCorrelate}, year={1999}, url={https://reference.wolfram.com/language/ref/ListCorrelate.html}, note=[Accessed: 12-June-2026]}