This repository was archived by the owner on Nov 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 71
partition
Lindsey Kuper edited this page Feb 12, 2015
·
3 revisions
partition
does the opposite of flatten
: it creates a ParallelArray
of n+1 dimensions from a ParallelArray
of n dimensions. However, it is more general than flatten
: while flatten
collapses two dimensions into one, partition
splits the outermost dimension of a ParallelArray
into two or more dimensions, depending on the size
argument passed to it.
myParallelArray.partition(size)
-
size
: the size of each element of the new dimension to be created. The number of elements in the outermost dimension of theParallelArray
on whichpartition
is invoked should be divisible bysize
.
A freshly minted ParallelArray
where the outermost dimension has been partitioned into multiple ParallelArray
s with size
elements each.
var pa = new ParallelArray([1, 2, 3, 4]);
// create a ParallelArray [[1, 2], [3, 4]], where [1, 2] and [3, 4]
// are themselves each ParallelArrays of length two
var partitionedArray = pa.partition(2);