Products & Services Solutions Academia Support User Community Company

Learn more about Parallel Computing Toolbox   

sparse - Create sparse distributed or codistributed matrix

Syntax

SD = sparse(FD)
SC = sparse(m, n, codist)
SC = sparse(m, n, codist, 'noCommunication')

Description

SD = sparse(FD) converts a full distributed or codistributed array FD to a sparse distributed or codistributed (respectively) array SD.

SC = sparse(m, n, codist) creates an m-by-n sparse codistributed array of underlying class double, distributed according to the scheme defined by the codistributor codist. For information on constructing codistributor objects, see the reference pages for codistributor1d and codistributor2dbc. This form of the syntax is most useful inside spmd, pmode, or a parallel job.

SC = sparse(m, n, codist, 'noCommunication') creates an m-by-n sparse codistributed array in the manner specified above, but does not perform any global communication for error checking when constructing the array. This form of the syntax is most useful inside spmd, pmode, or a parallel job.

Examples

With four labs,

spmd(4)
    D = sparse(1000, 1000, codistributor1d())
end

creates a 1000-by-1000 codistributed sparse double array D. D is distributed by its second dimension (columns), and each lab contains a 1000-by-250 local piece of D.

spmd(4)
    codist = codistributor1d(2, 1:numlabs)
    D = sparse(10, 10, codist);
end

creates a 10-by-10 codistributed sparse double array D, distributed by its columns. Each lab contains a 10-by-labindex local piece of D.

Convert a distributed array into a sparse distributed array:

R = distributed.rand(1000);
D = floor(2*R); % D also is distributed
SD = sparse(D); % SD is sparse distributed

See Also

sparse MATLAB function reference page

distributed.spalloc, codistributed.spalloc

  


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