mean_matrix🔗
Short description🔗
mean_matrix — Returns the elementwise mean of a matrix.
Signature🔗
mean_matrix( matrix MatrixID, string MeanType, out matrix MatrixMeanID )
Description🔗
The operator mean_matrix returns the mean values of the
elements of the Matrix defined by the matrix handle
MatrixID. A new matrix MatrixMean is generated
with the result and the matrix handle MatrixMeanID of this
matrix is returned. Access to the elements of the matrix is
possible e.g., with the operator get_full_matrix.
The type of mean determination of the matrix can be selected via the
parameter MeanType:
-
'columns': The mean is returned for each column of the
Matrixseparately. The resulting matrixMatrixMeanhas one row and the identical number of columns as the input matrix.Example:
MeanType= 'columns'\[\begin{eqnarray*} \texttt{Matrix} = \left[ \begin{array}{rrr} 8.0 & 4.0 & -3.0 \\ -6.0 & 2.0 & 7.0 \end{array} \right] \end{eqnarray*}\]\[\begin{eqnarray*} \to \qquad \texttt{MatrixMean} = \left[ \begin{array}{rrr} 1.0 & 3.0 & 2.0 \\ \end{array} \right] \end{eqnarray*}\] -
'rows': The mean is returned for each row of the
Matrixseparately. The resulting matrixMatrixMeanhas the identical number of rows as the input matrix and one column.Example:
MeanType= 'rows'\[\begin{eqnarray*} \texttt{Matrix} = \left[ \begin{array}{rrr} 8.0 & 4.0 & -3.0 \\ -6.0 & 2.0 & 7.0 \end{array} \right] \end{eqnarray*}\]\[\begin{eqnarray*} \to \qquad \texttt{MatrixMean} = \left[ \begin{array}{r} 3.0 \\ 1.0 \end{array} \right] \end{eqnarray*}\] -
'full': The mean is returned using all elements of the
Matrix. The resulting matrixMatrixMeanhas one row and one column.Example:
MeanType= 'full'\[\begin{eqnarray*} \texttt{Matrix} = \left[ \begin{array}{rrr} 8.0 & 4.0 & -3.0 \\ -6.0 & 2.0 & 7.0 \end{array} \right] \end{eqnarray*}\]\[\begin{eqnarray*} \to \qquad \texttt{MatrixMean} = \left[ \begin{array}{r} 2.0 \\ \end{array} \right] \end{eqnarray*}\]
Execution information🔗
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🔗
MatrixID (input_control) matrix → (handle)
Matrix handle of the input matrix.
MeanType (input_control) string → (string)
Type of mean determination.
Default: 'columns'
List of values: 'columns', 'full', 'rows'
MatrixMeanID (output_control) matrix → (handle)
Matrix handle with the mean values of the input matrix.
Result🔗
If the parameters are valid, the operator mean_matrix
returns the value 2 (H_MSG_TRUE). If necessary, an exception is raised.
Combinations with other operators🔗
Module🔗
Foundation