sub_matrixsub_matrixSubMatrixSubMatrixsub_matrixT_sub_matrix
Short description
sub_matrixsub_matrixSubMatrixSubMatrixsub_matrixT_sub_matrix — Subtract two matrices.
Signature
sub_matrix( matrix MatrixAID, matrix MatrixBID, out matrix MatrixSubID )sub_matrix( : : MatrixAID, MatrixBID : MatrixSubID )void SubMatrix( const HTuple& MatrixAID, const HTuple& MatrixBID, HTuple* MatrixSubID )static void HOperatorSet.SubMatrix( HTuple matrixAID, HTuple matrixBID, out HTuple matrixSubID )def sub_matrix( matrix_aid: HHandle, matrix_bid: HHandle ) -> HHandle
Herror T_sub_matrix( const Htuple MatrixAID, const Htuple MatrixBID, Htuple* MatrixSubID )
HMatrix HMatrix::SubMatrix( const HMatrix& MatrixBID ) const
HMatrix HMatrix.SubMatrix( HMatrix matrixBID )
Description
The operator sub_matrixSubMatrix computes the difference of the input
matrices MatrixA and MatrixB given by the matrix
handles MatrixAIDmatrixAIDmatrix_aid and MatrixBIDmatrixBIDmatrix_bid. Both matrices
must have identical dimensions. A new matrix MatrixSub is
generated with the result. The operator returns the matrix handle
MatrixSubIDmatrixSubIDmatrix_sub_id of the matrix MatrixSub. Access
to the elements of the matrix is possible e.g., with the operator
get_full_matrixGetFullMatrix. The formula for the calculation of the
result is:
\[\begin{eqnarray*}
\texttt{MatrixSub} \quad = \quad \texttt{MatrixA} \quad - \quad
\texttt{MatrixB}.
\end{eqnarray*}\]
Example:
\[\begin{eqnarray*}
\texttt{MatrixA} =
\left[ \begin{array}{rrr}
3.0 & 1.0 & -2.0 \\
-5.0 & 7.0 & 2.0 \\
-9.0 & -4.0 & 1.0
\end{array} \right]
\qquad
\texttt{MatrixB} =
\left[ \begin{array}{rrr}
2.0 & 8.0 & -3.0 \\
-4.0 & -1.0 & 5.0 \\
2.0 & -4.0 & 7.0
\end{array} \right]
\end{eqnarray*}\]
\[\begin{eqnarray*}
\to \qquad
\texttt{MatrixSub} =
\left[ \begin{array}{rrr}
1.0 & -7.0 & 1.0 \\
-1.0 & 8.0 & -3.0 \\
-11.0 & 0.0 & -6.0
\end{array} \right]
\end{eqnarray*}\]
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
MatrixAIDmatrixAIDmatrix_aid (input_control) matrix → (handle)(handle)HTuple (HHandle)HMatrix, HTuple (IntPtr)HHandleHtuple (handle)
Matrix handle of the input matrix A.
MatrixBIDmatrixBIDmatrix_bid (input_control) matrix → (handle)(handle)HTuple (HHandle)HMatrix, HTuple (IntPtr)HHandleHtuple (handle)
Matrix handle of the input matrix B.
MatrixSubIDmatrixSubIDmatrix_sub_id (output_control) matrix → (handle)(handle)HTuple (HHandle)HMatrix, HTuple (IntPtr)HHandleHtuple (handle)
Matrix handle with the difference of the input
matrices.
Result
If the parameters are valid, the operator sub_matrixSubMatrix returns
the value 2 (H_MSG_TRUE). If necessary, an exception is raised.
Combinations with other operators
Combinations
Possible predecessors
create_matrixCreateMatrix
Possible successors
get_full_matrixGetFullMatrix, get_value_matrixGetValueMatrix
Alternatives
sub_matrix_modSubMatrixMod
See also
add_matrixAddMatrix, add_matrix_modAddMatrixMod
Module
Foundation