调用 Fortran 子例程的最佳高级语言是什么?

发布于 2024-12-04 08:40:03 字数 353 浏览 2 评论 0原文

我想知道哪种高级语言允许以最简单的方式调用 Fortran 子例程?我目前使用MATLAB,与其他语言相比,调用MEX文件似乎相对复杂。

我特别感兴趣的是以下内容在快速“启动和运行”方面的比较:

*Python via f2py *R 通过 ? *MATLAB 通过 MEX 文件

提出这个问题的另一种方式是“如果您要重新开始学习一门新语言,如果您的目标是调用 Fortran 子例程,您会选择哪一种语言?”

我试图获得“两全其美”,即拥有良好的数据处理和图形以及调用快速 Fortran 子例程的能力。

预先感谢大家提供的任何帮助。唉,如果有人知道 Fortran 的良好 MEX 教程,那我们也将不胜感激。

I was wondering which high-level langunage allows the easiest manner in which to call Fortran subroutines? I currently use MATLAB and calling MEX files seems to be relatively complicated compared to other languages.

I'm particularly interested in how the following compares in terms of getting "up and running" quickly:

*Python via f2py
*R via ?
*MATLAB via MEX files

Another way of asking this would be "If you were to start over and learn a new language, which one would you choose if your objective was calling Fortran subroutines?"

I'm trying to getbthe "best of both worlds" i.e. having good data handling and graphics combined with the ability to call fast Fortran subroutines.

Thank you all in advance for any help you can provide. Alas, if someone knows of a good MEX tutorial for Fortran, that would be appreciated as well.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

拥抱我好吗 2024-12-11 08:40:03

我想知道哪种高级语言允许以最简单的方式调用 Fortran 子例程?

显而易见的答案是 Fortran 本身。所谓的现代 Fortran(2003 和 2008)具有许多高级功能。显然,从现代代码中调用旧版 FORTRAN 代码(我的猜测是您有旧的 FORTRAN 代码库)是很容易的。

I was wondering which high-level langunage allows the easiest manner in which to call Fortran subroutines?

The obvious answer is Fortran itself. So-called Modern Fortran (2003 & 2008) has a lot of high-level features. And obviously it's easy to call legacy FORTRAN code (my guess is that you have old FORTRAN code base) from the modern one.

高跟鞋的旋律 2024-12-11 08:40:03

通过 f2py 的 Python 非常好。我在 Windows 上进行 IVF 时遇到了一些麻烦,但没过多久就弄清楚了,并且邮件列表给出了及时的回复。在 Linux 上,它运行没有任何问题。

我没有使用过R,但据我了解,它只有在对大量数据进行大量统计时才有用。至于 MATLAB,它是一种可怕的语言,如果你只是调用 FORTRAN,那么你最好使用 Python。

Python via f2py is very nice. I had a little bit of trouble getting it going on Windows with IVF, but it didn't take long to figure out, and the mailing list gives prompt responses. On Linux, it worked without any issues.

I haven't used R, but as I understand it, it's only useful if you do a lot of statistics with large amounts of data. As for MATLAB, it's a horrible language, if you're just calling FORTRAN, you're better off with Python.

节枝 2024-12-11 08:40:03

在你的情况下,我通常做的是创建 Fortran 程序,我可以将命令行参数作为输入传递给它。 Fortran 2003 标准使用内部 get_command_argument 子例程可以轻松获得此功能。然后,您可以从用作包装器的任何语言解析 Fortran 程序输出(假设该语言可以访问系统 shell)。过去,我使用 shell 脚本、MATLAB(避免)、Python 来完成此操作。

What I usually do in your case is create Fortran programs that I can pass command line arguments to as input. This is readily available by Fortran 2003 standard using intrinsic get_command_argument subroutine. You can then parse Fortran program output from whatever language you are using as a wrapper (assuming language has access to system shell). In the past, I did this with shell scripts, MATLAB (avoid), Python.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文