| Operators |
add_matrix — Add two matrices.
add_matrix( : : MatrixAID, MatrixBID : MatrixSumID)
The operator add_matrix computes the sum of the input matrices MatrixA and MatrixB given by the matrix handles MatrixAID and MatrixBID. Both matrices must have identical dimensions. A new matrix MatrixSum is generated with the result. The operator returns the matrix handle MatrixSumID of the matrix MatrixSum. Access to the elements of the matrix is possible e.g. with the operator get_full_matrix. The formula for the calculation of the result is:
MatrixSum = MatrixA + MatrixB.
Example:
/ 3.0 1.0 -2.0 \ / 2.0 8.0 -3.0 \
MatrixA = | -5.0 7.0 2.0 | MatrixB = | -4.0 -1.0 5.0 |
\ -9.0 -4.0 1.0 / \ 2.0 -4.0 7.0 /
/ 5.0 9.0 -5.0 \
-> MatrixSum = | -9.0 6.0 7.0 |
\ -7.0 -8.0 8.0 /
Matrix handle of the input matrix A.
Matrix handle of the input matrix B.
Matrix handle with the sum of the input matrices.
If the parameters are valid, the operator add_matrix returns the value 2 (H_MSG_TRUE). If necessary, an exception is raised.
get_full_matrix, get_value_matrix
Foundation
| Operators |