http://www.mingw.org/wiki/InstallationHOWTOforMinGW
也可选择安装 Rtools (建议)
http://www.murdoch-sutherland.com/Rtools/index.html
2. C:/Users/lenovo/Documents
建立文件夹convolve,放入文件convolve.c
然后在R运行:
############
setwd('C:/Users/lenovo/Documents/convolve')
system("R CMD SHLIB convolve.c") #产生两个文件convolve.dll,convolve.o
#windows 用到convolve.dll
dyn.load("convolve.dll")
conv <- function(a, b){
.C("convolve",
as.double(a), as.integer(length(a)),
as.double(b), as.integer(length(b)),
ab=double(length(a)+length(b)-1))$ab
}
a=3
b=4
conv(a,b)
##########
convolve.c, convolve.dll
convolve.rar
(3.2 KB)



雷达卡


京公网安备 11010802022788号







