MapThread
MapThread [f,{{a1,a2,…},{b1,b2,…},…}]
gives {f[a1,b1,…],f[a2,b2,…],…}.
MapThread [f,{expr1,expr2,…},n]
applies f to the parts of the expri at level n.
Details
- MapThread works on Association objects.
- MapThread [f][expr] is equivalent to MapThread [f,expr].
- Parallelize [MapThread[f,{{a1,a2,…},{b1,b2,…},…}]] computes MapThread [f,{{a1,a2,…},{b1,b2,…},…}] in parallel on all subkernels. »
Examples
open allclose allBasic Examples (4)
Apply f to corresponding pairs of elements:
Apply f to elements of a matrix:
Apply f to corresponding values of associations:
Use the operator form of MapThread :
Scope (2)
Applications (3)
Set up an outer totalistic cellular automaton:
Divide eigenvectors by their corresponding eigenvalues:
Apply the functions in a list to corresponding arguments:
Properties & Relations (6)
Add columns of elements in a matrix:
Get lists of elements in columns of a matrix:
MapThread works like Thread , but takes the function and arguments separately:
Thread evaluates the whole expression before threading:
MapThread takes the function and its arguments separately:
MapThread is a generalization of Map to functions of several variables:
Compute MapThread in parallel:
See Also
Apply Map Thread Threaded Inner Transpose Comap Through
Function Repository: GeneralizedMapThread ArrayContractThread
Tech Notes
Related Guides
History
Introduced in 1991 (2.0) | Updated in 2014 (10.0) ▪ 2016 (11.0) ▪ 2017 (11.1)
Text
Wolfram Research (1991), MapThread, Wolfram Language function, https://reference.wolfram.com/language/ref/MapThread.html (updated 2017).
CMS
Wolfram Language. 1991. "MapThread." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2017. https://reference.wolfram.com/language/ref/MapThread.html.
APA
Wolfram Language. (1991). MapThread. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MapThread.html
BibTeX
@misc{reference.wolfram_2025_mapthread, author="Wolfram Research", title="{MapThread}", year="2017", howpublished="\url{https://reference.wolfram.com/language/ref/MapThread.html}", note=[Accessed: 09-April-2025 ]}
BibLaTeX
@online{reference.wolfram_2025_mapthread, organization={Wolfram Research}, title={MapThread}, year={2017}, url={https://reference.wolfram.com/language/ref/MapThread.html}, note=[Accessed: 09-April-2025 ]}