Create codistributed array from replicated local data
C = codistributed(X)
C = codistributed(X,codist)
C = codistributed(X,lab,codist)
C = codistributed(C1,codist)
C = codistributed(X)
distributes a replicated arrayX
using the default codistributor, creating acodistributedarrayC
as a result.X
must be a replicated array, that is, it must have the same value on all workers.size(C)
is the same assize(X)
.
C = codistributed(X,codist)
distributes a replicated arrayX
using the distribution scheme defined by codistributorcodist
.X
must be a replicated array, namely it must have the same value on all workers.size(C)
is the same assize(X)
. For information on constructing codistributor objects, see the reference pages forcodistributor1d
andcodistributor2dbc
.
C = codistributed(X,lab,codist)
distributes a local arrayX
that resides on the worker identified bylab
, using the codistributorcodist
. Local arrayX
must be defined on all workers, but only the value fromlab
is used to constructC
.size(C)
is the same assize(X)
.
C = codistributed(C1,codist)
accepts an arrayC1
that is already codistributed, and redistributes it intoC
according to the distribution scheme defined by the codistributorcodist
. This is the same as callingC = redistribute(C1,codist)
. If the existing distribution scheme forC1
is the same as that specified incodist
, then the resultC
is the same as the inputC1
.
Create a 1000-by-1000 codistributed arrayC1
using the default distribution scheme.
spmdN = 1000; X = magic(N);% Replicated on every workerC1 = codistributed (X);% Partitioned among the workersend
Create a 1000-by-1000 codistributed arrayC2
, distributed by rows (over its first dimension).
spmdN = 1000; X = magic(N); C2 = codistributed(X,codistributor1d(1));end
gather
essentially performs the inverse ofcodistributed
.