Inf - Create codistributed array of all Inf values - MATLAB (original) (raw)
Create codistributed array of all Inf
values
Syntax
Description
`cI` = Inf([n](#mw%5F4addd0f0-fa3a-4178-a84c-cf5d98b3b449),[codist](#mw%5F44fbf8dd-0ef7-4a74-8ec5-2a4b2a82d373))
creates an n
-by-n
codistributed matrix of allInf
values and uses codist
to specify the distribution of the array values across the workers.
Specify codist
as "codistributed"
to use the default codistributor1d
distribution scheme or the distribution scheme defined by a codistributor1d or codistributor2dbc object.
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
.
`cI` = Inf([sz](#mw%5Fe3b26414-5240-48bb-a93e-6cac98df9357),[codist](#mw%5F44fbf8dd-0ef7-4a74-8ec5-2a4b2a82d373))
creates a codistributed array of all Inf
values where the size vectorsz
defines the size of cI
. For example,Inf([2 3],"codistributed")
creates a 2-by-3 codistributed array.
`cI` = Inf([sz1,...,szN](#mw%5Fd1e6d344-3506-44f5-acf2-e8315c3103c3),[codist](#mw%5F44fbf8dd-0ef7-4a74-8ec5-2a4b2a82d373))
creates an sz1
-by-...-by-szN
codistributed array of all Inf
values where sz1,...,szN
indicates the size of each dimension.
`cI` = Inf(___,[datatype](#mw%5F2270ed98-dac3-4d4a-accb-d52068097154),[codist](#mw%5F44fbf8dd-0ef7-4a74-8ec5-2a4b2a82d373))
creates a codistributed array of all Inf
values with the underlying type datatype
. For example,Inf(1,"single","codistributed")
creates a codistributed single integer Inf
. You can use this syntax with any of the size arguments in the previous syntaxes. You must specify codist
after the array size and data type arguments.
`cI` = Inf(___,"noCommunication")
creates a codistributed array of all Inf
values without using communication between workers.
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"
.
You must specify "noCommunication"
after the size, data type andcodist arguments.
`cI` = Inf(___,like=[p](#mw%5F599bd63b-a54e-44a6-a604-fe825250a5dc))
uses the array p
to create a codistributed array of allInf
values. You can also specify "noCommunication"
as part of the function call.
The returned array cI
has the same underlying type, sparsity, and complexity (real or complex) as p
.
Examples
Create Codistributed Inf Matrix
Create a 1000-by-1000 codistributed matrix of Inf
values, distributed by its second dimension (columns).
spmd(4) C = Inf(1000,"codistributed"); end
With four workers, each worker contains a 1000-by-250 local piece ofC
.
Create a 1000-by-1000 codistributed single
matrix ofInf
values, distributed by its columns.
spmd(4) codist = codistributor1d(2,100*[1:spmdSize]); C = Inf(1000,1000,"single",codist); end
Each worker contains a 100-by-spmdIndex
local piece ofC
.
Input Arguments
n
— Size of square matrix
integer
Size of the square matrix, specified as an integer.
- If
n
is0
, thencI
is an empty matrix. - If
n
is negative, then the function treats it as0
.
codist
— Distribution scheme for codistributed array
"codistributed"
| codistributor1d
object | codistributor2dbc
object
Distribution scheme for codistributed array, specified as one of these options:
"codistributed"
— Uses the default distribution scheme defined by the defaultcodistributor1d
object.- codistributor1d object — Uses the one-dimensional distribution scheme defined in a
codistributor1d
object. To use the default 1-D distribution scheme, you can specify thecodistributor1d
function without arguments. - codistributor2dbc object — Uses the two-dimensional block-cyclic distribution scheme defined in a
codistributor2dbc
object. To use the default 2-D block-cyclic distribution scheme, you can specify thecodistributor2dbc
function without arguments.
sz
— Size of each dimension (as a row vector)
integer row vector
Size of each dimension, specified as an integer row vector. Each element of this vector indicates the size of the corresponding dimension:
- If the size of any dimension is
0
, thencI
is an empty array. - If the size of any dimension is negative, then the function treats it as
0
. - Beyond the second dimension,
Inf
ignores trailing dimensions with a size of1
. For example,Inf([3 1 1 1],"codistributed")
produces a 3-by-1 codistributed vector of allInf
values.
Example: sz = [2 3 4]
creates a 2-by-3-by-4 codistributed array.
sz1,...,szN
— Size of each dimension (as separate arguments)
integer values
Size of each dimension, specified as separate arguments of integer values.
- If the size of any dimension is
0
, thencI
is an empty array. - If the size of any dimension is negative, then the function treats it as
0
. - Beyond the second dimension, the function ignores trailing dimensions with a size of
1
.
datatype
— Array underlying data type
"double"
(default) | "single"
Underlying data type of the returned array, that is the data type of its elements, specified as one of these options:
"double"
"single"
Data Types: single
| double
p
— Prototype of array to create
codistributed
array
Prototype of array to create, specified as a codistributed
array.
If you do not specify the datatype, the resulting codistributed array has the same underlying type, sparsity, and complexity (real or complex) asp
. The underlying data type of the codistributed arrayp
must be single
ordouble
.
Data Types: single
| double
Version History
Introduced in R2006b