SystemML Class
std/2009/math/esum
Summary
Element-wise sum
Status
Stable

Overview

Computes the element-wise sum of all inputs. The structure (type, dimension, complexity) of the output is inferred from the structure of the input data - all inputs must share their primitive numeric type; all inputs must be of identical dimension or scalar; output complexity is the logical OR of all input complexities and the explicit complexity parameter.

Whilst this inference is usually convenient, it means that the output of the block cannot be created until all inputs have been seen. If this leads to Deadlock in your system, you can allow the block to create its output earlier (even, before seeing any inputs) by giving it enough information in its parameters. In this case, naturally, all inputs must comply with these parameters when they are seen. If you specify all three parameters (complex, dims and type) the block can create its output immediately. This allows, also, the use of the block in configurations with zero inputs (in which case, the outputs are all zero).

Connectivity

  • N inputs, the arguments of the operation.
  • 1 output, the result of the operation.

State

This Process stores its State in DataML.

type (STRING) OPTIONAL
Explicit primitive numeric type, in the form (for instance), "DOUBLE" or "INT64" or "BOOL8".
dims (INT64 1xN) OPTIONAL
Explicit dimensions.
complex (BOOLEAN scalar) OPTIONAL
Explicit complexity.
outputName (STRING) OPTIONAL
If supplied, the name of the single output (if not, "out" is used).

Example

Script

M Source Code (against 995)
fS = 3; sys = sml_system; state = []; state.data = [1 2 3]; sys = sys.addprocess('src1', 'std/2009/source/numeric', fS, state); state = []; state.data = [4 5 6]; sys = sys.addprocess('src2', 'std/2009/source/numeric', fS, state); sys = sys.addprocess('sum', 'std/2009/math/esum', fS, []); sys = sys.link('src1>out', 'sum', 0); sys = sys.link('src2>out', 'sum', 0); exe = brahms_execution; exe.all = true; exe.stop = 1; out = brahms(sys, exe); out.src1.out out.src2.out out.sum.out

Expected Output

Matlab Console
ans = 1 2 3 ans = 4 5 6 ans = 5 7 9