Products & Services Solutions Academia Support User Community Company

Learn more about Parallel Computing Toolbox   

codistributed.spalloc - Allocate space for sparse codistributed matrix

Syntax

SD = codistributed.spalloc(M, N, nzmax)
SD = spalloc(M, N, nzmax, codist)

Description

SD = codistributed.spalloc(M, N, nzmax) creates an M-by-N all-zero sparse codistributed matrix with room to hold nzmax nonzeros.

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

SD = spalloc(M, N, nzmax, codist) is the same as SD = codistributed.spalloc(M, N, nzmax, codist). You can also use the optional arguments with this syntax.

Examples

Allocate space for a 1000-by-1000 sparse codistributed matrix with room for up to 2000 nonzero elements. Use the default codistributor. Define several elements of the matrix.

spmd  % codistributed array created inside spmd statement
    N = 1000;
    SD = codistributed.spalloc(N, N, 2*N);
    for ii=1:N-1
      SD(ii,ii:ii+1) = [ii ii];
    end
end

See Also

spalloc MATLAB function reference page

sparse, distributed.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