SystemML Class
std/2009/source/numeric
Summary
Source of explicitly-specified numeric data
Status
Stable

Overview

A source of explicitly-specified numeric data. The data to be output is specified as part of the parametrisation of the process.

Notes on use from Matlab

Trailing Scalar Dimensions

Matlab trims trailing scalar dimensions from any matrix, since this does not change it arithmetically (try "size(ones(4,3,2,1))" in Matlab). Some BRAHMS processes use dimension as valuable metadata, including this source process. If you pass a [4x3x2x1] matrix as the "data" parameter (below) through the Matlab DataML converter (i.e. if you use the 995 invocation bindings), this will be passed to the process as a [4x3x2] matrix, and provide 2 samples of data of size [4x3] instead of 1 sample of data of size [4x3x2]. To work around this, you can set the "ndims" parameter (in this case, to three) to explicitly specify the output dimension of the process (missing trailing scalar dimensions are, thus, implied).

This problem occurs most often when you wish to output a single column vector with the same value at every sample. You will pass in an [Nx1] matrix, and it will be trimmed by the DataML converter to be a matrix of dimension [N]; this is an invalid parameter for this process since it requires a trailing dimension to represent sample number. Since the inferred conditions are invalid, the process can, without ambiguity, assume in this case that there is one missing trailing scalar dimension. If more trailing scalar dimensions are missing, you should set "ndims" explicitly. If the missing dimension is not scalar, you have supplied a data matrix of the wrong size.

Complexity

You may wish to output complex data but, in some instances, the imaginary part of that data may be zero. Matlab will automatically truncate such matrices to be non-complex, following any operation. Therefore, note that you can force a complex representation of non-complex data in Matlab using the syntax "complex(X)", and pass that to the bindings for passing to the process as the "data" parameter.

Connectivity

  • No inputs.
  • One output, the data provided.

State

This Process stores its State in DataML.

data (UINT32)
A numeric array holding the data to be output. The numeric type and complexity of the data output will be implied from the type of data supplied; its leading dimensions will give the dimensions of the output, and its last dimension the number of samples available. Hence, to output 10 samples of [3x2] data, this parameter should be of size [3x2x10].
ndims (UINT32 scalar) OPTIONAL
Intended dimensionality of the output data (rarely required, see Notes).
repeat (BOOLEAN scalar) OPTIONAL
If true, the Process will begin using the provided data again when it runs out. If false (default), the Process will raise an exception when it runs out of data.
complex (BOOLEAN scalar) OPTIONAL
If present, the Process will produce output at the specified complexity rather than using the complexity inferred from data, using zero as imaginary data or discarding imaginary data, as required. If empty (default), the output complexity is inferred from "data".
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]'; state.repeat = true; sys = sys.addprocess('src1', 'std/2009/source/numeric', fS, state); state = []; state.data = uint8([1 2 3 4; 5 6 7 8]); sys = sys.addprocess('src2', 'std/2009/source/numeric', fS, state); state = []; state.data = uint32(complex(8, 3)); state.repeat = true; sys = sys.addprocess('src3', 'std/2009/source/numeric', fS, state); exe = brahms_execution; exe.all = true; exe.stop = 1; out = brahms(sys, exe); out.src1.out out.src2.out out.src3.out

Expected Output

Matlab Console
ans = 1 1 1 2 2 2 3 3 3 ans = 1 2 3 5 6 7 ans = Columns 1 through 2 8 + 3i 8 + 3i Column 3 8 + 3i