ArrayFilter

ArrayFilter[f,array,r]

applies f to all range-r blocks in the specified array.

ArrayFilter[f,array,{r1,r2,}]

applies f to blocks with ranges r1, r2, in successive dimensions.

ArrayFilter[f,array,template]

applies f over blocks specified by the position of 1s in the array template.

Details and Options

  • ArrayFilter[f,array,] requires that array is full array to a certain depth.
  • ArrayFilter[f,array,r] applies f to all overlapping blocks of elements in array.
  • Both array and template can be SparseArray objects.
  • With ArrayFilter[f,array,template], neighborhood elements corresponding to 0s of template are replaced with Missing[] before being passed to f.
  • ArrayFilter has the option Padding, which specifies how neighborhoods should be formed at the edges of the array. The following settings can be used:
  • Nonereturns a smaller array
    valuse val for padding
    "Fixed"repeat edge elements (default)
    "Periodic"periodic in each dimension

Examples

open allclose all

Basic Examples  (3)

Apply f to each element of a list and its range-1 neighbors:

In[1]:=
Click for copyable input
Out[1]=

Apply f to each element of a list and its range-2 neighbors:

In[1]:=
Click for copyable input
Out[1]=

Apply f to all 3x3 blocks of range-1 neighbors around each element:

In[1]:=
Click for copyable input
Out[1]=

Show as matrices:

In[2]:=
Click for copyable input
Out[2]//TraditionalForm=

Scope  (4)

Options  (6)

Applications  (5)

Properties & Relations  (1)

See Also

BlockMap  ImageFilter  MovingMap  CellularAutomaton  Partition  ArrayFlatten  ArrayReshape  CrossMatrix  BoxMatrix

Introduced in 2015
(10.2)