ClassesClasses | | Operators

sum_matrixsum_matrixSumMatrixSumMatrix (Operator)


sum_matrixsum_matrixSumMatrixSumMatrix — Returns the elementwise sum of a matrix.


sum_matrix( : : MatrixID, SumType : MatrixSumID)

Herror sum_matrix(const Hlong MatrixID, const char* SumType, Hlong* MatrixSumID)

Herror T_sum_matrix(const Htuple MatrixID, const Htuple SumType, Htuple* MatrixSumID)

void SumMatrix(const HTuple& MatrixID, const HTuple& SumType, HTuple* MatrixSumID)

HMatrix HMatrix::SumMatrix(const HString& SumType) const

HMatrix HMatrix::SumMatrix(const char* SumType) const

static void HOperatorSet.SumMatrix(HTuple matrixID, HTuple sumType, out HTuple matrixSumID)

HMatrix HMatrix.SumMatrix(string sumType)


The operator sum_matrixsum_matrixSumMatrixSumMatrixSumMatrix returns the sum of the elements of the MatrixMatrixMatrixMatrixmatrix defined by the matrix handle MatrixIDMatrixIDMatrixIDMatrixIDmatrixID. A new matrix MatrixSumMatrixSumMatrixSumMatrixSummatrixSum is generated with the result and the matrix handle MatrixSumIDMatrixSumIDMatrixSumIDMatrixSumIDmatrixSumID of this matrix is returned. Access to the elements of the matrix is possible e.g. with the operator get_full_matrixget_full_matrixGetFullMatrixGetFullMatrixGetFullMatrix.

The type of sum determination of the matrix can be selected via the parameter SumTypeSumTypeSumTypeSumTypesumType:


The sum is returned for each column of the MatrixMatrixMatrixMatrixmatrix separately. The resulting matrix MatrixSumMatrixSumMatrixSumMatrixSummatrixSum has one row and the identical number of columns as the input matrix.



The sum is returned for each row of the MatrixMatrixMatrixMatrixmatrix separately. The resulting matrix MatrixSumMatrixSumMatrixSumMatrixSummatrixSum has the identical number of rows as the input matrix and one column.



The sum is returned using all elements of the MatrixMatrixMatrixMatrixmatrix. The resulting matrix MatrixSumMatrixSumMatrixSumMatrixSummatrixSum has one row and one column.


Execution Information


MatrixIDMatrixIDMatrixIDMatrixIDmatrixID (input_control)  matrix HMatrix, HTupleHTupleHtuple (integer) (IntPtr) (Hlong) (Hlong)

Matrix handle of the input matrix.

SumTypeSumTypeSumTypeSumTypesumType (input_control)  string HTupleHTupleHtuple (string) (string) (HString) (char*)

Type of summation.

Default value: 'columns' "columns" "columns" "columns" "columns"

List of values: 'columns'"columns""columns""columns""columns", 'full'"full""full""full""full", 'rows'"rows""rows""rows""rows"

MatrixSumIDMatrixSumIDMatrixSumIDMatrixSumIDmatrixSumID (output_control)  matrix HMatrix, HTupleHTupleHtuple (integer) (IntPtr) (Hlong) (Hlong)

Matrix handle with the sum of the input matrix.


If the parameters are valid, the operator sum_matrixsum_matrixSumMatrixSumMatrixSumMatrix returns the value 2 (H_MSG_TRUE). If necessary, an exception is raised.

Possible Predecessors


Possible Successors

get_full_matrixget_full_matrixGetFullMatrixGetFullMatrixGetFullMatrix, get_value_matrixget_value_matrixGetValueMatrixGetValueMatrixGetValueMatrix

See also




ClassesClasses | | Operators