C ++中的矩阵/向量与R数学独立库? [英] Matrices/Vectors in C++ with the R math standalone library?

查看:259
本文介绍了C ++中的矩阵/向量与R数学独立库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

全部,

我一直在C ++中使用R数学独立库。我非常喜欢能够生成随机数并使用我从R舒适的分布函数。我的问题是:是否可以使用R中可用的矩阵运算(乘法,转置,逆,Chol等)一个独立的图书馆?我在Rmath.h看不到他们。

I have been playing with the R math standalone library in C++. I quite like being able to generate random numbers and use distribution functions that I am comfortable with from R. My question is: is it possible to use the matrix operations (multiplication, transpose, inverse, Chol, etc) that are available in R in a standalone library? I don't see them in Rmath.h.

如果矩阵操作可用于独立的C ++代码,那么R API似乎成为完美的开源计算引擎。人们是否以这种方式使用它?

If matrix operations are available to use in standalone C++ code, it seems that the R API becomes the perfect open source computational engine. Are people using it in this fashion?

非常感谢您的指导和建议!

Thanks so much for your guidance and suggestions!

推荐答案

大多数,如果不是全部,你提到的东西由R链接到的LAPACK或BLAS Fortran代码提供,而不是R为自己提供新代码。

Most, if not all, of the things you mention are provided by LAPACK or BLAS Fortran code that R links to, not something R provides new code for itself.

如果您有兴趣在R中使用C ++,请查看 Rcpp软件包由Dirk Eddelbuettel和Romain Francois。 Dirk还撰写了 RcppArmadillo 软件包作为 Armadillo C ++线性代数库,可以执行您提及的矩阵运算。

If you are interested in using C++ with R, look at the Rcpp package by Dirk Eddelbuettel and Romain Francois. Dirk has also written the RcppArmadillo package as an interface to the Armadillo C++ linear algebra library that can do the matrix operations you mention.

这是否使用将取决于你是否想要编写在R之外访问的单独的C ++代码,或者接口在R中访问的C ++代码。Rcpp(大大)方便了后者。直接看看Armadillo,如果是前一种情况。

Whether this is of use will depend on whether you are wanting to write separate C++ code that is accessed outside R, or interfacing C++ code that you access within R. Rcpp facilitates (greatly) the latter. Take a look at Armadillo directly if it is the former situation.

这篇关于C ++中的矩阵/向量与R数学独立库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆