Rate This Document
Findability
Accuracy
Completeness
Readability

?lange

Compute the norms of a matrix, including 1-norm, F-norm, and infinite norm.

Interface Definition

C interface:

float slange_(const char *norm, const int *m, const int *n, const float *a, const int *lda, float *work);

double dlange_(const char *norm, const int *m, const int *n, const double *a, const int *lda, double *work);

float clange_(const char *norm, const int *m, const int *n, const float _Complex *a, const int *lda, float _Complex *work);

double zlange_(const char *norm, const int *m, const int *n, const double _Complex *a, const int *lda, double _Complex *work);

Fortran interface:

SLANGE(NORM, M, N, A, LDA, WORK);

DLANGE(NORM, M, N, A, LDA, WORK);

CLANGE(NORM, M, N, A, LDA, WORK);

ZLANGE(NORM, M, N, A, LDA, WORK);

Parameters

Parameter

Type

Description

Input/Output

NORM

Character

  • 'M' or 'm': indicates max(abs(A(i,j))).
  • '1', 'O', or 'o': computes the 1-norm of the matrix.
  • 'I' or 'i': computes the infinite norm of the matrix.
  • 'F', 'f', 'E', or 'e': computes the F-norm of the matrix.

Input

M

Integer

Number of rows in matrix A, M ≥ 0. If M = 0, 0 is returned.

Input

N

Integer

Number of columns in matrix A, N ≥ 0. If N = 0, 0 is returned.

Input

A

  • A single-precision floating-point array for slange
  • A double-precision floating-point array for dlange
  • A complex single-precision array for clange
  • A complex double-precision array for zlange

Matrix A with a size of LDA*N.

Input

LDA

Integer

Leading dimension of matrix A. LDA ≥ max(M,1).

Input

WORK

  • A single-precision floating-point array for slange
  • A double-precision floating-point array for dlange
  • A complex single-precision array for clange
  • A complex double-precision array for zlange

Work array, with a size of max(1, LWORK).

  • If NORM='I', LWORK≥M.
  • In other cases, WORK is not used.

Output

Dependency

#include "klapack.h"

Examples

C interface:

const char norm = 'M';
const int n = 4;
const int m = 4;
const int lda = m;
int info = 0;

double a[] = {1.0, 1.0, 1.0, 1.0,
              2.0, 2.0, 2.0, 2.0,
              3.0, 3.0, 3.0, 3.0,
              4.0, 4.0, 4.0, 4.0};
double work;
double res = dlange_(&norm, &m, &n, a, &lda, &work);
/* 
 * Output: 
 * res: 4.000000

Fortran interface:

CHARACTER :: norm = "M"
PARAMETER (m = 4) 
PARAMETER (n = 4)
PARAMETER (lda = 4) 
REAL(8) :: work 
REAL(8) :: a(lda, n)  

DATA a / 1.0, 1.0, 1.0, 1.0,
         2.0, 2.0, 2.0, 2.0,
         3.0, 3.0, 3.0, 3.0,
         4.0, 4.0, 4.0, 4.0 /
 EXTERNAL DLANGE
 CALL DLANGE(norm, m, n, a, lda, work);
* 
* Output: 
* res: 4.000000