| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Parallel Computing Toolbox |
| Contents | Index |
| Learn more about Parallel Computing Toolbox |
SD = sparse(FD)
SC = sparse(m, n, codist)
SC = sparse(m, n, codist, 'noCommunication')
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.
Note To create a sparse codistributed array of underlying class logical, first create an array of underlying class double and then cast it using the logical function: spmd
SC = logical(sparse(m, n, codistributor1d()));
end |
With four labs,
spmd(4)
D = sparse(1000, 1000, codistributor1d())
endcreates 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);
endcreates 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
sparse MATLAB function reference page
distributed.spalloc, codistributed.spalloc
![]() | size | spmd | ![]() |

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 |