Inf
Array of infinity
Syntax
A = Inf(sz,
arraytype
)
A = Inf(sz,datatype
,arraytype
)
A = Inf(sz,'like',P)
A = Inf(sz,datatype
,'like',P)
C = Inf(sz,codist)
C = Inf(sz,datatype
,codist)
C = Inf(sz,___,codist,'noCommunication')
C = Inf(sz,___,codist,'like',P)
Description
A = Inf(sz,
creates a matrix with underlying class of double, witharraytype
)Inf
values in all elements.
A = Inf(sz,
creates a matrix with underlying class ofdatatype
,arraytype
)datatype
, withInf
values in all elements.
The size and type of array are specified by the argument options according to the following table.
Argument | Values | Descriptions |
---|---|---|
sz |
n |
Specifies size as ann -by-n matrix. |
m,n or[m n] |
Specifies size as anm -by-n matrix. |
|
m,n,...,k or[m n ... k] |
Specifies size as anm -by-n -by-...-by-k array. |
|
arraytype |
'distributed' |
Specifies distributed array. |
'codistributed' |
Specifies codistributed array, using the default distribution scheme. | |
'gpuArray' |
Specifies gpuArray. | |
datatype |
'double' (default),'single' |
Specifies underlying class of the array, i.e., the data type of its elements. |
A = Inf(sz,'like',P)
creates an array ofInf
values with the same type and underlying class (data type) as arrayP
.
A = Inf(sz,
creates an array ofdatatype
,'like',P)Inf
values with the specified underlying class (datatype
), and the same type as arrayP
.
C = Inf(sz,codist)
orC = Inf(sz,
creates a codistributed array ofdatatype
,codist)Inf
values with the specified size and underlying class (the defaultdatatype
is'double'
). The codistributor objectcodist
specifies the distribution scheme for creating the codistributed array. For information on constructing codistributor objects, see the reference pages forcodistributor1d
andcodistributor2dbc
. To use the default distribution scheme, you can specify a codistributor constructor without arguments. For example:
spmd C = Inf(8,codistributor1d()); end
C = Inf(sz,___,codist,'noCommunication')
specifies that no interworker communication is to be performed when constructing a codistributed array, skipping some error checking steps.
C = Inf(sz,___,codist,'like',P)
creates a codistributed array ofInf
values with the specified size, underlying class, and distribution scheme. If either the class or codistributor argument is omitted, the characteristic is acquired from the codistributed arrayP
.
Examples
Create Distributed Inf Matrix
Create a 1000-by-1000 distributed array ofInf
s with underlying class double:
D = Inf(1000,'distributed');
Create Codistributed Inf Matrix
Create a 1000-by-1000 codistributed double matrix ofInf
s, 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 codistributedsingle
matrix ofInf
s, distributed by its columns.
spmd(4) codist = codistributor('1d',2,100*[1:numlabs]); C = Inf(1000,1000,'single',codist);end
Each worker contains a 100-by-labindex
local piece ofC
.
Create gpuArray Inf Matrix
Create a 1000-by-1000 gpuArray ofInf
s with underlying classdouble
:
G = Inf(1000,'double','gpuArray');