?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 |
|
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 |
|
Matrix A with a size of LDA*N. |
Input |
LDA |
Integer |
Leading dimension of matrix A. LDA ≥ max(M,1). |
Input |
WORK |
|
Work array, with a size of max(1, LWORK).
|
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