Operator Reference
sum_matrix (Operator)
sum_matrix
— Returns the elementwise sum of a matrix.
Signature
sum_matrix( : : MatrixID, SumType : MatrixSumID)
Description
The operator sum_matrix
returns the sum of the elements of
the Matrix
defined by the matrix handle MatrixID
.
A new matrix MatrixSum
is generated with the result and
the matrix handle MatrixSumID
of this matrix is returned.
Access to the elements of the matrix is possible e.g., with the
operator get_full_matrix
.
The type of sum determination of the matrix can be selected via the
parameter SumType
:
- 'columns' :
-
The sum is returned for each column of the
Matrix
separately. The resulting matrixMatrixSum
has one row and the identical number of columns as the input matrix.Example:
SumType
= 'columns' - 'rows' :
-
The sum is returned for each row of the
Matrix
separately. The resulting matrixMatrixSum
has the identical number of rows as the input matrix and one column.Example:
SumType
= 'rows' - 'full' :
-
The sum is returned using all elements of the
Matrix
. The resulting matrixMatrixSum
has one row and one column.Example:
SumType
= 'full'
Execution Information
- Multithreading type: reentrant (runs in parallel with non-exclusive operators).
- Multithreading scope: global (may be called from any thread).
- Processed without parallelization.
Parameters
MatrixID
(input_control) matrix →
(handle)
Matrix handle of the input matrix.
SumType
(input_control) string →
(string)
Type of summation.
Default: 'columns'
List of values: 'columns' , 'full' , 'rows'
MatrixSumID
(output_control) matrix →
(handle)
Matrix handle with the sum of the input matrix.
Result
If the parameters are valid, the operator sum_matrix
returns
the value 2 (
H_MSG_TRUE)
. If necessary, an exception is raised.
Possible Predecessors
Possible Successors
get_full_matrix
,
get_value_matrix
See also
Module
Foundation