| Parallel Computing Toolbox™ | ![]() |
D = sparse(m, n, dist)
D = sparse(m, n, dist) creates an m-by-n sparse distributed array of underlying class double. D is distributed by dimension dim, where dim = distributionDimension(dist) and with partition PAR, where PAR = distributionPartition(dist). If dim is unspecified, then D is distributed by its last nonsingleton dimension, or its second dimension if m and n are both 1 (D is scalar). If PAR is unspecified, then D uses defaultPartition over the size in dimension dim as its partition. The easiest way to do this is to use a default distributor where both dim and PAR are unspecified (dist = distributor()) as input to sparse.
Note To create a sparse distributed array of underlying class logical, first create an array of underlying class double and then cast it using the logical function: logical(sparse(m, n, dist)) |
With four labs,
D = sparse(1000, 1000, distributor())
creates a 1000-by-1000 distributed sparse double array D. D is distributed by its second dimension (columns), and each lab contains a 1000-by-250 local piece of D.
D = sprand(10, 10, distributor('1d', 2, 1:numlabs))creates a 10-by-10 distributed sparse double array D, distributed by its columns. Each lab contains a 10-by-labindex local piece of D.
sparse MATLAB® function reference page
cell, eye, false, Inf, NaN, ones, rand, randn, speye, sprand, sprandn, true, zeros
![]() | size | speye | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |