Create codistributed array of zeros
C = codistributed.zeros(n)
C = codistributed.zeros(m, n, ...)
C = codistributed.zeros([m, n, ...])
C = zeros(n, codist)
C = zeros(m, n, codist)
C = zeros([m, n], codist)
C = codistributed.zeros(n) creates an n-by-n codistributed matrix of zeros of class double.
C = codistributed.zeros(m, n, ...) or C = codistributed.zeros([m, n, ...]) creates an m-by-n-by-... codistributed array of zeros.
Optional arguments to codistributed.zeros must be specified after the required arguments, and in the following order:
classname — Specifies the class of the codistributed array C. Valid choices are the same as for the regular zeros function: 'double' (the default), 'single', 'int8', 'uint8', 'int16', 'uint16', 'int32', 'uint32', 'int64', and 'uint64'.
codist — A codistributor object specifying the distribution scheme of the resulting array. If omitted, the array is distributed using the default distribution scheme. For information on constructing codistributor objects, see the reference pages for codistributor1d and codistributor2dbc.
'noCommunication' — Specifies that no interworker communication is to be performed when constructing the array, skipping some error checking steps.
C = zeros(n, codist) is the same as C = codistributed.zeros(n, codist). You can also use the optional arguments with this syntax. To use the default distribution scheme, specify a codistributor constructor without arguments. For example:
spmd C = zeros(8, codistributor1d()); end
C = zeros(m, n, codist) and C = zeros([m, n], codist) are the same as C = codistributed.zeros(m, n, ...) and C = codistributed.zeros([m, n, ...]), respectively. You can also use the optional arguments with this syntax.
With four workers,
spmd(4) C = codistributed.zeros(1000, codistributor()); end
creates a 1000-by-1000 codistributed double array of zeros, C, distributed by its second dimension (columns). Each worker contains a 1000-by-250 local piece of C.
spmd(4) codist = codistributor('1d', 2, 1:numlabs) C = zeros(10, 10, 'uint16', codist); end
creates a 10-by-10 codistributed uint16 array of zeros, C, distributed by its columns. Each worker contains a 10-by-labindex local piece of C.