sum_matrixT_sum_matrixSumMatrixSumMatrixsum_matrix (Operator)

Name

sum_matrixT_sum_matrixSumMatrixSumMatrixsum_matrix — Returns the elementwise sum of a matrix.

Signature

sum_matrix( : : MatrixID, SumType : 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

HMatrix HMatrix::SumMatrix(const wchar_t* SumType) const   (Windows only)

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

HMatrix HMatrix.SumMatrix(string sumType)

def sum_matrix(matrix_id: HHandle, sum_type: str) -> HHandle

Description

The operator sum_matrixsum_matrixSumMatrixSumMatrixSumMatrixsum_matrix returns the sum of the elements of the Matrix defined by the matrix handle MatrixIDMatrixIDMatrixIDMatrixIDmatrixIDmatrix_id. A new matrix MatrixSum is generated with the result and the matrix handle MatrixSumIDMatrixSumIDMatrixSumIDMatrixSumIDmatrixSumIDmatrix_sum_id of this matrix is returned. Access to the elements of the matrix is possible e.g., with the operator get_full_matrixget_full_matrixGetFullMatrixGetFullMatrixGetFullMatrixget_full_matrix.

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

'columns'"columns""columns""columns""columns""columns":

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

Example:

SumTypeSumTypeSumTypeSumTypesumTypesum_type = 'columns'"columns""columns""columns""columns""columns"

'rows'"rows""rows""rows""rows""rows":

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

Example:

SumTypeSumTypeSumTypeSumTypesumTypesum_type = 'rows'"rows""rows""rows""rows""rows"

'full'"full""full""full""full""full":

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

Example:

SumTypeSumTypeSumTypeSumTypesumTypesum_type = 'full'"full""full""full""full""full"

Execution Information

Parameters

MatrixIDMatrixIDMatrixIDMatrixIDmatrixIDmatrix_id (input_control)  matrix HMatrix, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Matrix handle of the input matrix.

SumTypeSumTypeSumTypeSumTypesumTypesum_type (input_control)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Type of summation.

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

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

MatrixSumIDMatrixSumIDMatrixSumIDMatrixSumIDmatrixSumIDmatrix_sum_id (output_control)  matrix HMatrix, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Matrix handle with the sum of the input matrix.

Result

If the parameters are valid, the operator sum_matrixsum_matrixSumMatrixSumMatrixSumMatrixsum_matrix returns the value TRUE. If necessary, an exception is raised.

Possible Predecessors

create_matrixcreate_matrixCreateMatrixCreateMatrixCreateMatrixcreate_matrix

Possible Successors

get_full_matrixget_full_matrixGetFullMatrixGetFullMatrixGetFullMatrixget_full_matrix, get_value_matrixget_value_matrixGetValueMatrixGetValueMatrixGetValueMatrixget_value_matrix

See also

norm_matrixnorm_matrixNormMatrixNormMatrixNormMatrixnorm_matrix

Module

Foundation