Operator Reference

add_matrixT_add_matrixAddMatrixAddMatrixadd_matrix (Operator)

add_matrixT_add_matrixAddMatrixAddMatrixadd_matrix — Add two matrices.

Signature

add_matrix( : : MatrixAID, MatrixBID : MatrixSumID)

Herror T_add_matrix(const Htuple MatrixAID, const Htuple MatrixBID, Htuple* MatrixSumID)

void AddMatrix(const HTuple& MatrixAID, const HTuple& MatrixBID, HTuple* MatrixSumID)

HMatrix HMatrix::AddMatrix(const HMatrix& MatrixBID) const

def add_matrix(matrix_aid: HHandle, matrix_bid: HHandle) -> HHandle

Description

The operator add_matrixadd_matrixAddMatrixAddMatrixadd_matrix computes the sum of the input matrices MatrixA and MatrixB given by the matrix handles MatrixAIDMatrixAIDMatrixAIDmatrixAIDmatrix_aid and MatrixBIDMatrixBIDMatrixBIDmatrixBIDmatrix_bid. Both matrices must have identical dimensions. A new matrix MatrixSum is generated with the result. The operator returns the matrix handle MatrixSumIDMatrixSumIDMatrixSumIDmatrixSumIDmatrix_sum_id of the matrix MatrixSum. Access to the elements of the matrix is possible e.g., with the operator get_full_matrixget_full_matrixGetFullMatrixGetFullMatrixget_full_matrix. The formula for the calculation of the result is:

Example:

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

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

Matrix handle of the input matrix A.

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

Matrix handle of the input matrix B.

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

Matrix handle with the sum of the input matrices.

Result

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

Possible Predecessors

create_matrixcreate_matrixCreateMatrixCreateMatrixcreate_matrix

Possible Successors

get_full_matrixget_full_matrixGetFullMatrixGetFullMatrixget_full_matrix, get_value_matrixget_value_matrixGetValueMatrixGetValueMatrixget_value_matrix

Alternatives

add_matrix_modadd_matrix_modAddMatrixModAddMatrixModadd_matrix_mod

See also

sub_matrixsub_matrixSubMatrixSubMatrixsub_matrix, sub_matrix_modsub_matrix_modSubMatrixModSubMatrixModsub_matrix_mod

Module

Foundation