中文
注册
我要评分
文档获取效率
文档正确性
内容完整性
文档易理解
在线提单
论坛求助

?lange

计算矩阵的范数,包含:1范数,F范数,无穷范数等。

接口定义

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);

参数

参数名

类型

描述

输入/输出

NORM

字符型

  • 'M'或'm':表示max(abs(A(i,j)))。
  • '1'或'O'或'o':表示计算矩阵的1范数。
  • 'I'或'i':表示计算矩阵的无穷范数。
  • 'F'或'f'或'E'或'e':表示计算矩阵的F范数。

输入

M

整数型

矩阵A的行数,M≥0。当M=0时,返回0。

输入

N

整数型

矩阵A的列数,N≥0。当N=0时,返回0。

输入

A

  • 在slange中为单精度浮点型数组。
  • 在dlange中为双精度浮点型数组。
  • 在clange中为单精度复数型数组。
  • 在zlange中为双精度复数型数组。

矩阵A,大小为LDA*N。

输入

LDA

整数型

矩阵A的主维,LDA≥max(M,1)。

输入

WORK

  • 在slange中为单精度浮点型数组。
  • 在dlange中为双精度浮点型数组。
  • 在clange中为单精度复数型数组。
  • 在zlange中为双精度复数型数组。

工作数组,大小为max(1, LWORK)。

  • NORM='I'时,LWORK≥M。
  • 其他情况,WORK将不被使用。

输出

依赖

#include "klapack.h"

示例

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