IMSL程序库
- 格式:pdf
- 大小:1.70 MB
- 文档页数:81
1.1.2 求解线性方程组——LSLRG/DLSLRG (Single/Double precision) 功能:Solve a real general system of linear equations without iterative refinement.
Usage:CALL LSLRG (N, A, LDA, B, IPATH, X)
1.1 线性系统求解、逆矩阵与行列式计算
1.1.1高精度线性系统求解——LSARG/DLSARG (Single/Double precision) 功能:Solve a real general system of linear equations with iterative refinement. 语法:CALL LSARG (N, A, LDA, B, IPATH, X) 参数: N — Number of equations. (Input)(方程个数) A — N by N matrix containing the coefficients of the linear system. (Input) (系数矩阵) LDA — Leading dimension of A exactly as specified in the dimension statement of the calling program. (Input)(调用程序所需要的矩阵主维数——一般为矩阵行
5
数值分析程序设计
done using scaled partial pivoting. Scaled partial pivoting differs from partial pivoting in that the pivoting strategy is the same as if each row were scaled to have the same ∞-norm. program main use IMSL PARAMETER (IPATH=1, LDA=3, LDFAC=3, N=3) INTEGER IPVT(N), J, NOUT REAL A(LDA,LDA), AINV(LDA,LDA), FAC1(LDFAC,LDFAC), RCOND DATA A/1.0, 1.0, 1.0, 3.0, 3.0, 4.0, 3.0, 4.0, 3.0/ CALL LFCRG (N, A, LDA, FAC1, LDFAC, IPVT, RCOND) CALL UMACH (2, NOUT) write(*,*)"RCOND=,L1 Condition Number=" WRITE (NOUT,"(2f8.4)") RCOND, 1.0E0/RCOND write(*,*)"Matrix a=" do k=1,3 write(*,*) a(k,1:3) end do write(*,*)"Matrix U=" do k=1,3 write(*,*) fac1(k,1:3) end do END 程序执行结果:
2
山东建筑工程学院
1线性系统(L i n e a rS y s t e m s )
I M S L 提供了大量的求解线性方程组的函数, 可以用于求解数值分析中常见的 各种问题。例如,线性方程求解的直接法和迭代法、逆矩阵和行列式计算、最小 二乘拟和问题、三角矩阵问题、矩阵的Q R 分解、奇异值分解和C h o l e s k y 分解等。 可以处理一般矩阵、对称矩阵、复矩阵、三角矩阵等的数值分析计算问题。
1.1.3 LU分解和矩阵条件数——LFCRG/DLFCRG 功能:Compute the LU factorization of a real general matrix and estimate its L1 condition number. 语法:CALL LFCRG (N, A, LDA, FAC, LDFAC, IPVT, RCOND) 参数: N — Order of the matrix. (Input) A — N by N matrix to be factored. (Input) LDA — Leading dimension of A exactly as specified in the dimension statement of the calling program. (Input) FAC— N by N matrix containing the LU factorization of the matrix A. (Output) If A is not needed, A and FAC can share the same storage locations. LDFAC — Leading dimension of FAC exactly as specified in the dimension statement of the calling program. (Input) IPVT — Vector of length N containing the pivoting information for the LU factorization. (Output) RCOND — Scalar containing an estimate of the reciprocal of the L1 condition number of A. (Output) 算法:Routine LFCRG performs an LU factorization of a real general coefficient matrix. It also estimates the condition number of the matrix. The LU factorization is
山东建筑工程学院
数值分析程序设计
Part III IMSL 数值分析函数库
数值方法中常遇到的问题,有专门的函数链接库可以使用。I M S L 是一套在 数值方法上经常被使用的商业函数链接库。 V i s u a l F o r t r a n 的专业版内含 I M S L 。 I M S L 的函数名称中,第一个字母可以用来判断参数的类型。如果第一个字 母是 D会使用双精度浮点数来计算并返回答案。第一个字母不是 D ,则使用单 精度浮点数计算。 为准确理解函数中各参数的意义和功能,下面的函数介绍采用英文原文。 必要时增加中文注释。
0I M S L 函数库
The IMSL Libraries
IMSL函数库包含两个独立部分: • MATH/LIBRARY general applied mathematics and special functions (应用数学和特殊函数函数库) • STAT/LIBRARY statistics(统计函数库) The IMSL MATH/LIBRARY User’s Manual has two parts: MATH/LIBRARY and MATH/LIBRARY Special Functions. Most of the routines are available in both single and double precision versions. The same user interface is found on the many hardware versions that span the range from personal computer to supercomputer. Note that some IMSL routines are not distributed for FORTRAN compiler environments that do not support double precision complex data. The names of the IMSL routines that return or accept the type double complex begin with the letter “Z” and, occasionally, “DC.”
1数值分析程序设计Getting Started
The IMSL MATH/LIBRARY is a collection of FORTRAN routines and functions useful in research and mathematical analysis. To use any of these routines, you must write a program in FORTRAN (or possibly some other language) to call the MATH/LIBRARY routine. (使用IMSL函数 库必须编写Fortran程序调用相应的子程序) 在 Fortran 安装目录的 DF98\IMSL\Help 目录下提供 PDF 版本 IMSL 帮助文件 MATH.pdf和F9040.pdf。前者为IMSL数学分析函数库帮助文件,后者为Fortran90 新增的一些函数库帮助文件。需要IMSL使用的详细情况,请查阅帮助文件。
3
数值分析程序设计
72 x 129 33 16 算例:求解线性方程组 −24 −10 −57 y = −96 18 −11 7 z 8.5
program main use IMSL ! Declare variables PARAMETER (IPATH=1, LDA=3, N=3) REAL A(LDA,LDA), B(N), X(N) ! Set values for A and B ! A = ( 33.0 16.0 72.0) ! ! (-24.0 -10.0 -57.0) ( 18.0 -11.0 7.0)
数)
B — Vector of length N containing the right-hand side of the linear system.(Input)(方程右边矩阵向量) IPATH — Path indicator. (Input)(求解指示器) IPATH = 1 means the system AX = B is solved. IPATH = 2 means the system A7X = B is solved. X — Vector of length N containing the solution to the linear system. (Output) (求解的未知量向量) 算法: Routine LSARG solves a system of linear algebraic equations having a real general coefficient matrix. It first uses the routine LFCRG, to compute an LU factorization of the coefficient matrix and to estimate the condition number of the matrix. The solution of the linear system is then found using the iterative refinement routine LFIRG.(LU分解法加上迭代改进解的精度)