Products & Services Solutions Academia Support User Community Company

Learn more about Parallel Computing Toolbox   

codistributed.ones - Create codistributed array of ones

Syntax

C = codistributed.ones(n)
C = codistributed.ones(m, n, ...)
C = codistributed.ones([m, n, ...])
C = ones(n, codist)
C = ones(m, n, codist)
C = ones([m, n], codist)

Description

C = codistributed.ones(n) creates an n-by-n codistributed matrix of ones of class double.

C = codistributed.ones(m, n, ...) or C = codistributed.ones([m, n, ...]) creates an m-by-n-by-... codistributed array of ones.

Optional arguments to codistributed.ones must be specified after the required arguments, and in the following order:

C = ones(n, codist) is the same as C = codistributed.ones(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 = ones(8, codistributor1d());
end

C = ones(m, n, codist) and C = ones([m, n], codist) are the same as C = codistributed.ones(m, n, ...) and C = codistributed.ones([m, n, ...]), respectively. You can also use the optional arguments with this syntax.

Examples

With four labs,

spmd(4)
    C = codistributed.ones(1000, codistributor());
end

creates a 1000-by-1000 codistributed double array of ones, C, distributed by its second dimension (columns). Each lab contains a 1000-by-250 local piece of C.

spmd(4)
    codist = codistributor('1d', 2, 1:numlabs);
    C = ones(10, 10, 'uint16', codist);
end

creates a 10-by-10 codistributed uint16 array of ones, C, distributed by its columns. Each lab contains a 10-by-labindex local piece of C.

See Also

ones MATLAB function reference page

codistributed.eye, codistributed.zeros, distributed.ones

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS