gplus

Global addition

Syntax

S = gplus(X)
S = gplus(X, targetlab)

Description

S = gplus(X) returns the addition of the variant array X from each worker. The result S is replicated on all workers.

S = gplus(X, targetlab) performs the addition, and places the result into S only on the worker indicated by targetlab. S is set to [] on all other workers.

Examples

With four workers,

S = gplus(labindex)

returns S = 1 + 2 + 3 + 4 = 10 on all four workers.

See Also

|

Was this topic helpful?