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)
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:
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