R call fortran
来源:互联网 发布:中小学生出作业软件 编辑:程序博客网 时间:2024/06/06 01:18
Object: Call fortran subroutine using R
Platform: window 10, Fortranfortran (Intel Visual Fortran), R (3.1.3)
Testing code source: https://en.wikiversity.org/wiki/R_(programming_language)/Tutorials/Connecting_Fortran_and_R
Fortran code (multiply.f):
c sample subroutine to include for R subroutine multiply(ax,bx,cx) implicit none integer ax,bx,cx cx=ax*bx end
R code (testfortran.R):
setwd('C:/Personal/code/C/RcallF')system('R CMD SHLIB multiply.f')dyn.load('C:/Personal/code/C/RF/multiply.dll')star = function(a,b){ x<-.Fortran('multiply',as.integer(a),as.integer(b),c=integer(1)) return(x$c)}a=5b=2y<-star(a,b)
Note: multiply.f path for this test is:
'C:/Personal/code/C/RcallF'
In R, use setwd to set this path. Just run R file, the link is generated automatically for fortran files.This is easier than building C++ and Fortran connection.
Result:
0 0
- R call fortran
- C++ call fortran using cmd
- 用R语言调用Fortran子程序
- Telephone Call(R)
- Fortran
- fortran
- fortran
- Using R — .Call(“hello”)
- Call by reference in R
- 关于R语言里的调用类型(call)
- 在R/3Dialog里面call web dynpro之后,单击web dynpro按钮控制R/3
- call
- call
- call
- call
- call
- call
- call
- Codeforces 120I
- 深度学习框架 Digits 3.0 安装运行
- 第三天!神奇的物理引擎!
- easyui的easyui-textbox、easyui-combobox 类
- C#中wpf使用Devexpress画图:柱状图,饼状图,散点图,曲线图
- R call fortran
- java归并排序算法报错
- Linux 输入子系统编码:event-codes.txt
- Material Design学习之Toolbar
- Docker完全解析 三、Docker容器
- Redis入门介绍
- 如何制作外挂
- 【Android】 ANR异常及traces信息解析
- egret的命令语句和推荐的开发流程