User`s guide

11 Functions — Alphabetical List
11-44
To use a default dimension, specify codistributor1d.unsetDimension for
that argument; the distribution dimension is derived from gsize and is set to
the last non-singleton dimension. Similarly, to use a default partition, specify
codistributor1d.unsetPartition for that argument; the partition is then derived
from the default for that global size and distribution dimension.
The local part on worker labidx of a codistributed array using such a codistributor is of
size gsize in all dimensions except dim, where the size is part(labidx). The local part
has the same class and attributes as the overall codistributed array. Conceptually, the
overall global array could be reconstructed by concatenating the various local parts along
dimension dim.
Examples
Use a codistributor1d object to create an N-by-N matrix of ones, distributed by rows.
N = 1000;
spmd
codistr = codistributor1d(1); % 1st dimension (rows)
C = ones(N,codistr);
end
Use a fully specified codistributor1d object to create a trivial N-by-N codistributed matrix
from its local parts. Then visualize which elements are stored on worker 2.
N = 1000;
spmd
codistr = codistributor1d( ...
codistributor1d.unsetDimension, ...
codistributor1d.unsetPartition, ...
[N,N]);
myLocalSize = [N,N]; % start with full size on each lab
% then set myLocalSize to default part of whole array:
myLocalSize(codistr.Dimension) = codistr.Partition(labindex);
myLocalPart = labindex*ones(myLocalSize); % arbitrary values
D = codistributed.build(myLocalPart,codistr);
end
spy(D==2);
See Also
codistributed | codistributor2dbc | redistribute