0

数组的零

语法

Z = 0(深圳,arraytype)
Z = 0(深圳,数据类型,arraytype)

Z = 0(深圳,“喜欢”,P)
Z = 0(深圳,数据类型“喜欢”,P)

codist C = 0(深圳)
C = 0(深圳,数据类型codist)
C = 0(深圳,___、codist noCommunication)
C = 0(深圳,___codist“喜欢”,P)

描述

Z = 0(深圳,arraytype)创建一个矩阵,其底层类为double,所有元素中都为零。

Z = 0(深圳,数据类型,arraytype)创建一个矩阵,其底层类为数据类型,所有元素均为零。

数组的大小和类型由参数选项根据下表指定。

论点 描述
深圳 n 将大小指定为n——- - - - - -n矩阵。
m, n(mn) 将大小指定为——- - - - - -n矩阵。
m, n, k[m n…k) 将大小指定为——- - - - - -n——-…——-k数组中。
arraytype “分布式” 指定分布式阵列。
“codistributed” 指定使用默认分布方案的共分布数组。
“gpuArray” 指定gpuArray。
数据类型 “双”(默认),“单一”,“int8”,“uint8”,“int16”,“uint16”,“int32”,“uint32”,“int64”,或“uint64” 指定数组的底层类,即元素的数据类型。

Z = 0(深圳,“喜欢”,P)创建与array具有相同类型和底层类(数据类型)的零数组P

Z = 0(深圳,数据类型“喜欢”,P)使用指定的底层类(数据类型),与array类型相同P

codist C = 0(深圳)C = 0(深圳,数据类型codist)创建具有指定大小和底层类(默认值)的零的共分布数组数据类型“双”)。codistributor对象codist指定用于创建共分布数组的分配方案。有关构造codistributor对象的信息,请参阅参考页面codistributor1dcodistributor2dbc。要使用默认的分发方案,可以指定一个没有参数的codistributor构造函数。例如:

spmd C = 0 (8,codistributor1d());结束

C = 0(深圳,___、codist noCommunication)指定在构造共分布数组时不执行任何工作者之间的通信,跳过一些错误检查步骤。

C = 0(深圳,___codist“喜欢”,P)创建具有指定大小、底层类和分布模式的零的共分布数组。如果省略类或codistributor参数,则从codistributed数组中获取特征P

例子

创建分布式零矩阵

创建一个1000乘1000的分布式零数组与底层类double:

D = 0 (1000“分布式”);

创建共分布零矩阵

创建一个1000乘1000共分布的双零矩阵,按其第二维(列)分布。

spmd(4) C = 0 (1000,“codistributed”);结束

有四个工人,每个工人包含一个1000乘250的本地块C

创建一个1000乘1000的共分布uint16矩阵的零,分布的列。

spmd(4) codist = codistributor(“一维”,2100 * 1:numlabs);C = 0 (1000、1000、“uint16”,codist);结束

每个worker包含一个100乘-labindex本地块C

创建gpuArray零矩阵

创建一个包含底层类的1000 * 1000 gpuArrayuint32:

G = 0 (1000“uint32”,“gpuArray”);

另请参阅

||||||

介绍了R2006b