scale_matrixScaleMatrixScaleMatrixscale_matrixT_scale_matrix
Short description
scale_matrixScaleMatrixScaleMatrixscale_matrixT_scale_matrix — Scale a matrix.
Signature
scale_matrix( matrix MatrixID, number Factor, out matrix MatrixScaledID )void ScaleMatrix( const HTuple& MatrixID, const HTuple& Factor, HTuple* MatrixScaledID )static void HOperatorSet.ScaleMatrix( HTuple matrixID, HTuple factor, out HTuple matrixScaledID )def scale_matrix( matrix_id: HHandle, factor: Union[int, float] ) -> HHandle
Herror T_scale_matrix( const Htuple MatrixID, const Htuple Factor, Htuple* MatrixScaledID )
HMatrix HMatrix::ScaleMatrix( const HTuple& Factor ) const
HMatrix HMatrix::ScaleMatrix( double Factor ) const
HMatrix HMatrix.ScaleMatrix( HTuple factor )
HMatrix HMatrix.ScaleMatrix( double factor )
Description
The operator scale_matrixScaleMatrix scales the Matrix by a
constant factor. The matrix is defined by the matrix handle
MatrixIDmatrixIDmatrix_id. A new matrix MatrixScaled is generated
with the result. The operator returns the matrix handle
MatrixScaledIDmatrixScaledIDmatrix_scaled_id. 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{MatrixScaled}_{ij} \quad = \quad \textrm{Factor} \quad
\cdot \quad \texttt{Matrix}_{ij}.
\end{eqnarray*}\]
Example:
Factorfactorfactor = 1.51.5
\[\begin{eqnarray*}
\texttt{Matrix} =
\left[ \begin{array}{rrr}
3.0 & 1.0 & -2.0 \\
-2.0 & 6.0 & 2.0 \\
-5.0 & -4.0 & 1.0
\end{array} \right]
\end{eqnarray*}\]
\[\begin{eqnarray*}
\qquad \to \qquad
\texttt{MatrixScaled} =
\left[ \begin{array}{rrr}
4.5 & 1.5 & -3.0 \\
-3.0 & 9.0 & 3.0 \\
-7.5 & -6.0 & 1.5
\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
MatrixIDmatrixIDmatrix_id (input_control) matrix → (handle)HTuple (HHandle)HMatrix, HTuple (IntPtr)HHandleHtuple (handle)
Matrix handle of the input matrix.
Factorfactorfactor (input_control) number → (real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[int, float]Htuple (double / Hlong)
Scale factor.
Default: 2.02.0
Suggested values: 0.1, 0.2, 0.3, 0.5, 0.7, 1.0, 1.5, 2.0, 3.0, 5.0, 10.00.1, 0.2, 0.3, 0.5, 0.7, 1.0, 1.5, 2.0, 3.0, 5.0, 10.0
MatrixScaledIDmatrixScaledIDmatrix_scaled_id (output_control) matrix → (handle)HTuple (HHandle)HMatrix, HTuple (IntPtr)HHandleHtuple (handle)
Matrix handle with the scaled elements.
Result
If the parameters are valid, the operator scale_matrixScaleMatrix
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
scale_matrix_modScaleMatrixMod
See also
mult_element_matrixMultElementMatrix, mult_element_matrix_modMultElementMatrixMod, div_element_matrixDivElementMatrix, div_element_matrix_modDivElementMatrixMod
Module
Foundation