Skip to content

norm_matrixNormMatrixNormMatrixnorm_matrixT_norm_matrix๐Ÿ”—

Short description๐Ÿ”—

norm_matrixNormMatrixNormMatrixnorm_matrixT_norm_matrix โ€” Norm of a matrix.

Signature๐Ÿ”—

norm_matrix( matrix MatrixID, string NormType, out real Value )void NormMatrix( const HTuple& MatrixID, const HTuple& NormType, HTuple* Value )static void HOperatorSet.NormMatrix( HTuple matrixID, HTuple normType, out HTuple value )def norm_matrix( matrix_id: HHandle, norm_type: str ) -> float

Herror T_norm_matrix( const Htuple MatrixID, const Htuple NormType, Htuple* Value )

double HMatrix::NormMatrix( const HString& NormType ) const

double HMatrix::NormMatrix( const char* NormType ) const

double HMatrix::NormMatrix( const wchar_t* NormType ) const (Windows only)

double HMatrix.NormMatrix( string normType )

Description๐Ÿ”—

The operator norm_matrixNormMatrix computes the norm of the elements of the Matrix defined by the matrix handle MatrixIDmatrixIDmatrix_id. The return value is a floating point number.

The type of norming of the matrix can be selected via the parameter NormTypenormTypenorm_type:

  • 'frobenius-norm'"frobenius-norm": The Frobenius norm is computed. The formula for the calculation of the result is:

    \[\begin{eqnarray*} \textrm{Value} \quad = \quad \sqrt{\sum_{i=0}^{m-1} \sum_{j=0}^{n-1}{\texttt{Matrix}_{ij}}^2} \end{eqnarray*}\]

    with \(m\) = number of rows and \(n\) = number of columns of the Matrix.

    Example:

    \[\begin{eqnarray*} \texttt{Matrix} = \left[ \begin{array}{rr} 3.0 & 1.0 \\ 4.0 & -3.0 \\ -7.0 & 4.0 \end{array} \right] \qquad \to \qquad \textrm{Value} = 10.0 \end{eqnarray*}\]
  • 'infinity-norm'"infinity-norm": The infinity norm is computed. The result is the largest value of the sum of the absolute values of the elements of the rows. The formula for the calculation is:

    \[\begin{eqnarray*} \textrm{Value} \quad = \quad \max_{i=0,m-1} \sum_{j=0}^{n-1}|\texttt{Matrix}_{ij}| \end{eqnarray*}\]

    with \(m\) = number of rows and \(n\) = number of columns of the Matrix.

    Example:

    \[\begin{eqnarray*} \texttt{Matrix} = \left[ \begin{array}{rr} 3.0 & 1.0 \\ 4.0 & -3.0 \\ -7.0 & 4.0 \end{array} \right] \qquad \to \qquad \textrm{Value} = 11.0 \end{eqnarray*}\]
  • '1-norm'"1-norm": The 1-norm is computed. The result is the largest value of the sum of the absolute values of the elements of the columns. The formula for the calculation is:

    \[\begin{eqnarray*} \textrm{Value} \quad = \quad \max_{j=0,n-1} \sum_{i=0}^{m-1}|\texttt{Matrix}_{ij}| \end{eqnarray*}\]

    with \(m\) = number of rows and \(n\) = number of columns of the Matrix.

    Example:

    \[\begin{eqnarray*} \texttt{Matrix} = \left[ \begin{array}{rr} 3.0 & 1.0 \\ 4.0 & -3.0 \\ -7.0 & 4.0 \end{array} \right] \qquad \to \qquad \textrm{Value} = 14.0 \end{eqnarray*}\]
  • '2-norm'"2-norm": The 2-norm is computed. The result is the largest singular value of the Matrix. The formula for the calculation of the result is:

    \[\begin{eqnarray*} \textrm{Value} \quad = \quad \max\,(\mathrm{singular\,values}\,(\texttt{Matrix})) \end{eqnarray*}\]

    Example:

    \[\begin{eqnarray*} \texttt{Matrix} = \left[ \begin{array}{rr} 3.0 & 1.0 \\ 4.0 & -3.0 \\ -7.0 & 4.0 \end{array} \right] \qquad \to \qquad \textrm{Value} = 9.7006 \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๐Ÿ”—

MatrixIDmatrixIDmatrix_id (input_control) matrix โ†’ (handle)HTuple (HHandle)HMatrix, HTuple (IntPtr)HHandleHtuple (handle)

Matrix handle of the input matrix.

NormTypenormTypenorm_type (input_control) string โ†’ (string)HTuple (HString)HTuple (string)strHtuple (char*)

Type of norm.

Default: '2-norm'"2-norm"
List of values: '1-norm', '2-norm', 'frobenius-norm', 'infinity-norm'"1-norm", "2-norm", "frobenius-norm", "infinity-norm"

Valuevaluevalue (output_control) real โ†’ (real)HTuple (double)HTuple (double)floatHtuple (double)

Norm of the input matrix.

Result๐Ÿ”—

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

Combinations with other operators๐Ÿ”—

Combinations

Possible predecessors

create_matrixCreateMatrix

See also

sum_matrixSumMatrix, mean_matrixMeanMatrix

References๐Ÿ”—

David Poole: โ€œLinear Algebra: A Modern Introductionโ€; Thomson; Belmont; 2006.

Gene H. Golub, Charles F. van Loan: โ€œMatrix Computationsโ€; The Johns Hopkins University Press; Baltimore and London; 1996.

Module๐Ÿ”—

Foundation