gpt4 book ai didi

r - 为什么 R 中不能很好地支持 Fortran 90 代码?

转载 作者:行者123 更新时间:2023-12-02 21:15:02 25 4
gpt4 key购买 nike

尽管《编写 R 扩展》手册提到了 f90/f95。好像支持不太好,尤其是和C++混合的。

https://stat.ethz.ch/pipermail/r-devel/2015-March/070851.html

但是如果我必须将 f90/f95 代码与 Rcpp 一起使用。目前有可用的解决方案吗?谢谢。

最佳答案

(我想我只是回答我 rather similar question on rcpp-devel 。)

引用自Writing R Extensions, Section 1.1.5下面是我使用的粗体:

The sources and headers for the compiled code are in src, plus optionally a file Makevars or Makefile. When a package is installed using R CMD INSTALL, make is used to control compilation and linking into a shared object for loading into R. There are default make variables and rules for this (determined when R is configured and recorded in R_HOME/etcR_ARCH/Makeconf), providing support for C, C++, FORTRAN 77, Fortran 9x15, Objective C and Objective C++16 with associated extensions .c, .cc or .cpp, .f, .f90 or .f95, .m, and .mm, respectively. We recommend using .h for headers, also for C++17 or Fortran 9x include files. (Use of extension .C for C++ is no longer supported.) Files in the src directory should not be hidden (start with a dot), and hidden files will under some versions of R be ignored.

It is not portable (and may not be possible at all) to mix all these languages in a single package, and we do not support using both C++ and Fortran 9x. Because R itself uses it, we know that C and FORTRAN 77 can be used together and mixing C and C++ seems to be widely successful.

你必须询问 R Core 为什么他们选择禁止这种行为。通常,这意味着一些技术原因。我不使用 Fortran,所以我无法帮助解释它背后的推理。

关于r - 为什么 R 中不能很好地支持 Fortran 90 代码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31257168/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com