

BlockMap
Details

- In BlockMap[f,list,n], all sublists passed to f are of length n. Some elements at the end of list may not be visited.
- In BlockMap[f,list,n,1], all elements of list appear in at least one sublist.
- In BlockMap[f,list,n,d], if d is greater than n, some elements in the middle of list are skipped. »
- BlockMap can be used on SparseArray objects.
Examples
open all close allBasic Examples (4)
Scope (8)
Apply a function to a ragged array:
Apply a function to blocks of size {2,1,2} of a rank-3 array:
Specify an offset {1,2} with a block size {2,2} to allow overlapping for rows but not for columns:
Multidimensional offsets are effectively coerced to match the block size specification:
Skip elements by using an offset larger than the block size:
Incomplete sublists at the end are dropped:
The head need not be List:
BlockMap works with SparseArray objects:
Applications (5)
Compute successive differences of elements:
Compute a moving average with runs of 3 elements:
Compute a moving median of a matrix:
Compute a moving quantile for some data:
Smooth a simulated particle trajectory:
The underlying signal and simulated path with noise:
Smooth the trajectory using a moving TrimmedMean:
Properties & Relations (2)
BlockMap is effectively the same as using Map and Partition:
BlockMap need not construct all the sublists and requires less memory:
ListCorrelate[ker,list] effectively combines ker with a sliding block in list:
Use an offset of 1 in BlockMap to apply the function to overlapping segments the length of ker:
ListConvolve is similar except the kernel is reversed:
Related Guides
History
Text
Wolfram Research (2015), BlockMap, Wolfram Language function, https://reference.wolfram.com/language/ref/BlockMap.html.
CMS
Wolfram Language. 2015. "BlockMap." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/BlockMap.html.
APA
Wolfram Language. (2015). BlockMap. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/BlockMap.html
BibTeX
@misc{reference.wolfram_2025_blockmap, author="Wolfram Research", title="{BlockMap}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/BlockMap.html}", note=[Accessed: 18-August-2025]}
BibLaTeX
@online{reference.wolfram_2025_blockmap, organization={Wolfram Research}, title={BlockMap}, year={2015}, url={https://reference.wolfram.com/language/ref/BlockMap.html}, note=[Accessed: 18-August-2025]}