LAPACK库

一、LAPACK库的地址

       LAPACK(Linear Algebra PACKage)库,是用Fortran语言编写的线性代数计算库,包含线性方程组求解(AX=b)、矩阵分解、矩阵求逆、求矩阵特征值、奇异值等。该库用BLAS库做底层运算,许多高层的数学库都用BLAS和LAPACK做底层。

       LAPACK is written in Fortran90 and provides routines for solving systems of simultaneous linear equations, least-squares solutions of linear systems of equations, eigenvalue problems, and singular value problems. The associated matrix factorizations (LU, Cholesky, QR, SVD, Schur, generalized Schur) are also provided, as are related computations such as reordering of the Schur factorizations and estimating condition numbers. Dense and banded matrices are handled, but not general sparse matrices. In all areas, similar functionality is provided for real and complex matrices, in both single and double precision.

       BLAS(Basic Linear Algebra Subprograms)库,是用Fortran语言实现的向量和矩阵运算库,是许多数值计算软件库的核心, 但也有一些其它的包装, 如cblas是C语言, 也有C++的包装, boost/ublas 是C++ template class的实现; 另外还有一些特别的实现, 如intel MKL, AMD core math library blas就是做向量、矩阵的基本运算,如加、减、乘等操作。

       The BLAS are high quality "building block" routines for performing basic vector and matrix operations. Level 1 BLAS do vector-vector operations, Level 2 BLAS do matrix-vector operations, and Level 3 BLAS do matrix-matrix operations. Because the BLAS are efficient, portable, and widely available, they're commonly used in the development of high quality linear algebra software, LINPACK and LAPACK for example.

 

二、LAPACK库的地址

       LAPACK库的下载地址:http://www.netlib.org/lapack/

       LAPACK库的说明文档:http://www.netlib.org/lapack/lug/lapack_lug.html

       LAPACK库的头文件(C语言的)、Lib文件(MDd和MTd两种类型的,以及调试和发布版的)和源代码(Fortran语言,主要用于查看各个函数的参数的说明):http://www.fi.muni.cz/~xsvobod2/misc/lapack/
       LAPACK的其他相关资料可以从CSDN中查找:http://download.csdn.net/

 

三、LAPACK库的安装和编译

     (1)下载并编译LAPACK库。可以下载LAPACK源码(Fortran语言),用cmake编译成相应的Lib文件。也可以直接下载编译好的Lib文件,及相应的头文件。

     (2)配置Visual Studio 2005的环境。

  • 属性 ---> 配置属性 ---> C/C++ ---> 常规 ---> 附加包含目录 :添加下载的头文件的地址
  • 属性 ---> 配置属性 ---> C/C++ ---> 代码生成 ---> 运行时库 :多线程调试(/MTd)
  • 属性 ---> 配置属性 ---> 链接器 ---> 常规 ---> 附加库目录 :添加下载的lib库的地址
  • 属性 ---> 配置属性 ---> 链接器 ---> 输入 ---> 附加依赖项 :添加相应的lib库,如blas_win32_MTd.lib和lapack_win32_MTd.lib

     (3)使用LAPACK库中的函数。LAPACK库中每个函数对应一个头文件,使用那个函数,就引入相应的头文件(放在所有头文件的后面)。根据源代码中函数参数的说明,正确的使用该函数。函数的参数可能比较多。
     (4)Fortran语言与C++语言的对应。(a)二维数组在内存中的布局不同:C/C++是按行存放的,而Fortran是按列存放的。对于实对称矩阵或者Hermitian矩阵,问题倒也不大。一般来说只要在C/C++数组传入Lapack函数前做一个转换即可。(b)Frotran语言和C++语言数据类型的对应关系,如下表所示。
 

表1. 数据类型对应关系
Fortran语言C++语言
Integerlong int
realfloat
doublerealdouble
shortintshort int
uintegerunsigned long int

 

  • 6
    点赞
  • 28
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值