Welcome to the L3 Harris Geospatial documentation center. Here you will find reference guides and help documents.
﻿
>  Docs Center  >  IDL Reference  >  Advanced Math and Stats  >  IMSL_MATRIX_NORM

### IMSL_MATRIX_NORM

IMSL_MATRIX_NORM

The IMSL_MATRIX_NORM function computes various norms of a rectangular matrix, a matrix stored in band format, and a matrix stored in coordinate format.

By default, IMSL_MATRIX_NORM computes the Frobenius norm:

If the keyword One_Norm is used, the one norm

is returned. If the keyword Inf_Norm is used, the infinity norm

is returned.

## Examples

### Example 1

Compute the Frobenius norm, infinity norm, and one norm of matrix A.

`a = TRANSPOSE([[1.0, 2.0, -2.0, 3.0], \$`
`  [-2.0, 1.0, 3.0, 0.0], [0.0, 3.0, 1.0, -7.0], \$`
`  [5.0, -2.0, 7.0, 6.0], [4.0, 3.0, 4.0, 0.0]])`
`frobenius_norm = IMSL_MATRIX_NORM(a)`
`inf_norm = IMSL_MATRIX_NORM(a, /INF_NORM)`
`one_norm = IMSL_MATRIX_NORM(a, /ONE_NORM)`
`PRINT, 'Frobenius norm = ', frobenius_norm`
`PRINT, 'Infinity norm = ', inf_norm`
`PRINT, 'One norm = ', one_norm`
` `
`Frobenius norm = 15.6844`
`Infinity norm = 20.0000`
`One norm = 17.0000`

### Example 2

Compute the Frobenius norm, infinity norm, and one norm of matrix a. Matrix a is stored in band storage mode.

`nlca = 1`
`nuca = 1`
`n = 4`
`a = [0.0, 2.0, 3.0, -1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 3.0, 4.0, 0.0]`
`frobenius_norm = IMSL_MATRIX_NORM(n, nlca, nuca, a)`
`inf_norm = IMSL_MATRIX_NORM(n, nlca, nuca, a, /INF_NORM)`
`one_norm = IMSL_MATRIX_NORM(n, nlca, nuca, a, /ONE_NORM)`
`PRINT, 'Frobenius norm = ', frobenius_norm`
`PRINT, 'Infinity norm = ', inf_norm`
`PRINT, 'One norm = ', one_norm`
` `
`Frobenius norm = 6.55744`
`Infinity norm = 5.00000`
`One norm = 8.00000`

### Example 3

Compute the Frobenius norm, infinity norm, and one norm of matrix a. Matrix a is stored in symmetric band storage mode.

`nlca = 2`
`nuca = 2`
`n = 6`
`a = [0.0, 0.0, 7.0, 3.0, 1.0, 4.0, \$`
`  0.0, 5.0, 1.0, 2.0, 1.0, 2.0, 1.0, 2.0, 4.0, 6.0, 3.0, 1.0]`
`frobenius_norm = IMSL_MATRIX_NORM(n, nlca, nuca, a, /SYMMETRIC)`
`inf_norm = IMSL_MATRIX_NORM(n, nlca, nuca, a, /INF_NORM, \$`
`  /SYMMETRIC)`
`one_norm = IMSL_MATRIX_NORM(n, nlca, nuca, a, /ONE_NORM, \$`
`  /SYMMETRIC)`
`PRINT, 'Frobenius norm = ', frobenius_norm`
`PRINT, 'Infinity norm = ', inf_norm`
`PRINT, 'One norm = ', one_norm`
` `
`Frobenius norm = 16.9411`
`Infinity norm = 16.0000`
`One norm = 16.0000`

### Example 4

Compute the Frobenius norm, infinity norm, and one norm of matrix a. Matrix a is stored in coordinate format.

`nrows = 6`
`ncols = 6`
`a = REPLICATE(imsl_f_sp_elem, 15)`
`a(*).row = [0, 1, 1, 1, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5]`
`a(*).col = [0, 1, 2, 3, 2, 0, 3, 4, 0, 3, 4, 5, 0, 1, 5]`
`a(*).val = [10.0, 10.0, -3.0, -1.0, 15.0, \$`
`  -2.0, 10.0, -1.0, -1.0, -5.0, 1.0, -3.0, -1.0, -2.0, 6.0]`
`frobenius_norm = IMSL_MATRIX_NORM(nrows, ncols, a)`
`inf_norm = IMSL_MATRIX_NORM(nrows, ncols, a, /INF_NORM)`
`one_norm = IMSL_MATRIX_NORM(nrows, ncols, a, /ONE_NORM)`
`PRINT, 'Frobenius norm = ', frobenius_norm`
`PRINT, 'Infinity norm = ', inf_norm`
`PRINT, 'One norm = ', one_norm`
` `
`Frobenius norm = 24.8395`
`Infinity norm = 15.0000`
`One norm = 18.0000`

### Example 5

Compute the Frobenius norm, infinity norm and one norm of matrix a. Matrix a is stored in symmetric coordinate format.

`nrows = 6`
`ncols = 6`
`a = REPLICATE(imsl_f_sp_elem, 9)`
`a(*).row = [0, 0, 0, 1, 1, 2, 2, 4, 4]`
`a(*).col = [0, 2, 5, 3, 4, 2, 5, 4, 5]`
`a(*).val = [10.0, -1.0, 5.0, 2.0, 3.0, 3.0, 4.0, -1.0, 4.0]`
`frobenius_norm = IMSL_MATRIX_NORM(nrows, ncols, a, /SYMMETRIC)`
`inf_norm = IMSL_MATRIX_NORM(nrows, ncols, a, /INF_NORM, \$`
`  /SYMMETRIC)`
`one_norm = IMSL_MATRIX_NORM(nrows, ncols, a, /ONE_NORM, \$`
`  /SYMMETRIC)`
`PRINT, 'Frobenius norm = ', frobenius_norm`
`PRINT, 'Infinity norm = ', inf_norm`
`PRINT, 'One norm = ', one_norm`
` `
`Frobenius norm = 15.8745`
`Infinity norm = 16.0000`
`One norm = 16.0000`

## Syntax

To compute various norms of a rectangular matrix:

Result = IMSL_MATRIX_NORM(A [, /DOUBLE] [, INF_NORM=value] [, ONE_NORM=value] [, SYMMETRIC=value])

To compute various norms of a matrix stored in band format:

Result = IMSL_MATRIX_NORM(Nn, Nlca, Nuca, A [, /DOUBLE] [, INF_NORM=value] [, ONE_NORM=value] [, SYMMETRIC=value])

To compute various norms of a matrix stored in coordinate format:

Result = IMSL_MATRIX_NORM(Nrows, Ncols, A [, /DOUBLE] [, INF_NORM=value] [, ONE_NORM=value] [, SYMMETRIC=value])

## Return Value

The requested norm of the input matrix, by default, the Frobenius norm. If the norm cannot be computed, NaN is returned.

## Arguments

### A

Matrix for which the norm will be computed.

### N

The order of matrix a.

### Ncols

The number of columns in matrix a.

### Nlca

Number of lower codiagonals of a.

### Nrows

The number of rows in matrix a.

### Nuca

Number of upper co-diagonals of a.

## Keywords

### DOUBLE (optional)

If present and nonzero, double precision is used.

### INF_NORM (optional)

If present and nonzero, IMSL_MATRIX_NORM computes the infinity norm of matrix a.

### ONE_NORM (optional)

If present and nonzero, IMSL_MATRIX_NORM computes the one norm of matrix a.

### SYMMETRIC (optional)

If present and nonzero, matrix a is stored in symmetric storage mode. Keyword SYMMETRIC can not be used with a rectangular matrix.

## Version History

 6.4 Introduced

© 2020 Harris Geospatial Solutions, Inc. |  Legal