Skip to Main Content Skip to Search
Product Documentation

codistributed.speye - Create codistributed sparse identity matrix

Syntax

CS = codistributed.speye(n)
CS = codistributed.speye(m, n)
CS = codistributed.speye([m, n])
CS = speye(n, codist)
CS = speye(m, n, codist)
CS = speye([m, n], codist)

Description

CS = codistributed.speye(n) creates an n-by-n sparse codistributed array of underlying class double.

CS = codistributed.speye(m, n) or CS = codistributed.speye([m, n]) creates an m-by-n sparse codistributed array of underlying class double.

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

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

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

Examples

With four labs,

spmd(4)
    CS = speye(1000, codistributor())
end

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

spmd(4)
    codist = codistributor1d(2, 1:numlabs);
    CS = speye(10, 10, codist);
end

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

See Also

distributed.speye | sparse | speye

  


Free Parallel Computing Interactive Kit

See how to solve large problems with minimal effort and reduce simulation time.

Get free kit

Trials Available

Try the latest versions of parallel computing products.

Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS