Threads
Seq
a parallel implementation of seq
Calling Sequence
Parameters
Description
Examples
Seq( f, i = m..n )
Seq( f, i = m..n, step )
Seq( f, i = 1..n, step )
Seq( f, i = x )
Seq( f, i in x )
Seq( i = m..n, step )
Seq[ tasksize = s ]( ... )
f
-
(expression) any expression
i
(name)
m,n
(numeric) values to range over
x
(expression)
step
(numeric) (optional)
s
(optional, posint) maximum task size
The Seq command is a parallel implementation of the seq command. For a complete description of the calling sequences of Seq see the seq help page.
Seq is implemented using the Task programming model.
Seq attempts to determine how to divide the input into separate tasks to spread the work across all available cores. However in some situations Seq 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. Seq will divide the input into tasks that compute at most tasksize elements within a single task.
with⁡Threads:
Seq⁡i2,i=1..5
1,4,9,16,25
Seq⁡sin⁡π⁢i6,i=0..6
0,12,32,1,32,12,0
Seq⁡xi,i=1..7
x1,x2,x3,x4,x5,x6,x7
X≔Seq⁡i,i=0..6
X≔0,1,2,3,4,5,6
Seq⁡i2mod7,i=X
0,1,2,4
Y≔Seq⁡i2,i=X
Y≔0,1,4,9,16,25,36
Seq⁡Xi,Yi,i=1..nops⁡X
0,0,1,1,2,4,3,9,4,16,5,25,6,36
Seq⁡i,i=Hello
H,e,l,l,o
Seq⁡i,i=a..f
a,b,c,d,e,f
[Seq( i, i=0..-infinity )]; C := proc( f, x ) local i; [Seq( coeff( f, x, i ), i=0..degree(f,x) )]; end proc;
C ≔ procf,xlocali;Threads:-Seq⁡coeff⁡f,x,i,i=0..degree⁡f,xend proc
C⁡2⁢x−4+x3,x
−4,2,0,1
See Also
seq
Threads[Add]
Threads[Map]
Threads[Mul]
Download Help Document