ones
Create codistributed array of all ones
Syntax
Description
creates an X
= ones(n
)n
-by-n
codistributed matrix
of ones.
When you create the codistributed array in a communicating job or spmd
block, the function creates an array on each worker. If you create a codistributed array
outside of a communicating job or spmd
block, the array is stored only on
the worker or client that creates the codistributed array.
By default, the codistributed array has the underlying type double
.
creates an X
= ones(sz1,...,szN
)sz1
-by-...-by-szN
codistributed
array of ones where sz1,...,szN
indicates the size of each
dimension.
creates a codistributed array of ones where the size vector
X
= ones(sz
)sz
defines the size of X
. For
example, ones(codistributed([2 3]))
creates a 2-by-3
codistributed array.
creates a codistributed array of ones with the underlying type
X
= ones(___,datatype
)datatype
. For example,
ones(codistributed(1),"int8")
creates a codistributed
8-bit scalar integer 1
. You can use this syntax with any of
the input arguments in the previous syntaxes.
uses the codistributor object X
= ones(___,codist
)codist
to create a
codistributed array of ones.
Specify the distribution of the array values across the memory of workers using the
codistributor object codist
. For more information about creating
codistributors, see codistributor1d
and codistributor2dbc
.
creates a codistributed array of ones without using communication between
workers. You can specify X
= ones(___,codist
,"noCommunication")codist
or
codist,"noCommunication"
, but not both.
When you create very large arrays or your communicating job or spmd
block uses many workers, worker-worker communication can slow down array creation. Use this
syntax to improve the performance of your code by removing the time required for
worker-worker communication.
Tip
When you use this syntax, some error checking steps are skipped. Use this syntax
to improve the performance of your code after you prototype your code without
specifying "noCommunication"
.
Examples
Input Arguments
Version History
Introduced in R2006b