ZGESV是lapack最简单的一个函数, 即求解线性方程组A*X=B , 子程序调用的格式是zgesv(n, nrh,A, LDA,IPIV,B,LDB,info).
各个参数的意义如下 :
n , 线性方程组的方程数, 也就是矩阵A的阶数;
nrh, 方程组右边的数目, 也即矩阵B的列数;
A,其维度定义为A(LDA,N), 输入时,为方程组的系数矩阵;输出则是LU分解的分式;在计算中基本上不关心A的结果.
LDA,是所谓数组A的起始维数(这里应当认为是矩阵A的第一列的维数),也即矩阵A的行数.
IPIV, 输出参量, 用来定义排列矩阵P的指标.
B, 输入是方程组右边的矩阵B, 维度为B(LDB,NRH);输出是矩阵X(N,NRH)的解, 如果info=0.
LDB, 同LDA, 矩阵B的行数.
info, info=0,表示调用成功返回;非零,则是调用失败.
以下是 zgesv的手册页:
NAME
ZGESV - compute the solution to a complex system of linear equations A * X = B,
SYNOPSIS
SUBROUTINE ZGESV( N, NRHS, A, LDA, IPIV, B, LDB, INFO )
INTEGER INFO, LDA, LDB, N, NRHS
INTEGER IPIV( * )
COMPLEX*16 A( LDA, * ), B( LDB, * )
PURPOSE
ZGESV computes the solution to a complex system of linear equations A * X = B, where A is an N-by-N matrix and X and B are N-by-NRHS matrices.
The LU decomposition with partial pivoting and row interchanges is used to factor A as
A=P * L * U, where P is a permutation matrix, L is unit lower triangular, and U is upper triangular. The factored form of A is then used to solve the system of equations A * X = B.
Technorati : lapack, subroutines
Powered by Zoundry