Computer Engineering and Applications ›› 2011, Vol. 47 ›› Issue (31): 1-3.

• 博士论坛 • Previous Articles     Next Articles

Mixed language programming in Matlab and Fortran via dynamic link library

PAN Kejia1,2,3,TANG Jingtian1,ZHENG Zhoushun2   

  1. 1.School of Geosciences and Info-Physics,Central South University,Changsha 410083,China
    2.School of Mathematical Sciences and Computing Technology,Central South University,Changsha 410083,China
    3.HPCSIP Key Laboratory,Ministry of Education,Changsha 410081,China
  • Received:1900-01-01 Revised:1900-01-01 Online:2011-11-01 Published:2011-11-01

Matlab与Fortran混合编程之DLL实现方法

潘克家1,2,3,汤井田1,郑洲顺2   

  1. 1.中南大学 地球科学与信息物理学院,长沙 410083
    2.中南大学 数学科学与计算技术学院,长沙 410083
    3.高性能计算与随机信息处理教育部重点实验室,长沙 410081

Abstract: The advantages and disadvantages of Matlab and Fortran is briefly introduced in this article.And two methods of mixed language programming through calling Fortran dynamic link library from Matlab are discussed in detail.Take Gauss-Jordan elimination with partial pivoting for example,the computational results of the same algorithm under a variety of different implementation ways are carefully compared in terms of accuracy and computational time.The result indicates that,mixed language programming via dynamic link library can make full of existing packages,combine high efficiency of Fortran with powerful matrix computation and figure drawing and compiling functions of Matlab,thus conforming to the current development direction of programming in scientific and engineering computing.

Key words: dynamic link library, mixed-programming, Matlab, Fortran, Gauss-Jordan?elimination

摘要: 简要介绍Matlab和Fortran各自的优缺点,详细阐述Matlab调用Fortran生成的动态链接库实现混合编程的两种方法。以高斯约当列主元素法求逆为例,从计算时间、精度等方面详细比较了同一算法在多种实现方式下的执行情况。计算结果表明:基于动态链接库的混合编程方法能充分利用现有软件包,结合Fortran计算效率高、Matlab矩阵计算及图形处理功能强的优点,符合当前科学工程计算程序设计的发展方向。

关键词: 动态链接库, 混合编程, Matlab语言, Fortran语言, 高斯-约当消去法