Threads
Map
a parallel implementation of map
Calling Sequence
Parameters
Description
Examples
Map( fcn, expr, arg1, ..., argN )
Map[n]( fcn, arg1, ..., argn1, expr, argn, ..., argN )
Map[evalhf]( fcn, expr, ... )
Map[inplace]( fcn, expr, ... )
Map[ tasksize = s ]( fcn, expr, ... )
fcn

(procedure or name)
expr
any expression
argi
(optional) further arguments to fcn
n
(posint)
s
(optional, posint) maximum task size
The Map command is a parallel implementation of the map command. For a complete description of the calling sequence of Map, see the map help page.
Map is implemented using the Task programming model.
Map attempts to determine how to divide the input into separate tasks to spread the work across all available cores. However in some situations Map may not choose the optimal size. In particular a small number of long running tasks may not be spread evenly over all threads. In this case, you can specify the maximum task size using the tasksize option. Map will divide the input into tasks that compute at most tasksize elements within a single task.
$\mathrm{with}\left(\mathrm{Threads}\right)\:$
$\mathrm{Map}\left(f\,x+yz\right)$
${f}{}\left({y}{}{z}\right){+}{f}{}\left({x}\right)$
$\mathrm{Map}\left(f\,yz\right)$
${f}{}\left({y}\right){}{f}{}\left({z}\right)$
$\mathrm{Map}\left(f\,\left\{a\,b\,c\right\}\right)$
$\left\{{f}{}\left({a}\right){\,}{f}{}\left({b}\right){\,}{f}{}\left({c}\right)\right\}$
$\mathrm{Map}\left(x\mapsto {x}^{2}\,x+y\right)$
${{x}}^{{2}}{+}{{y}}^{{2}}$
Map( proc( x, y ) x^2+y end proc, [ 1, 2, 3, 4], 2 );
$\left[{3}{\,}{6}{\,}{11}{\,}{18}\right]$
See Also
map
Threads[Add]
Threads[Mul]
Threads[Seq]
Download Help Document
What kind of issue would you like to report? (Optional)