1
我正在使用C++ boost庫構建水文建模的R包。BH R-package鏈接可以提升「數學」和「數字」嗎?
的包裝要求:
的boost ::數學:: gamma_distribution
的boost ::數學:: CDF
的boost ::數學:: isnan
BH R包在我的情況下工作?
我正在使用C++ boost庫構建水文建模的R包。BH R-package鏈接可以提升「數學」和「數字」嗎?
的包裝要求:
的boost ::數學:: gamma_distribution
的boost ::數學:: CDF
的boost ::數學:: isnan
BH R包在我的情況下工作?
它當然應該。提升數學只是一個頭文件庫;因此,我們可以測試使用開瑞Rcpp Gallery post升壓tgamma功能作爲模型
線沿線的東西:
// Use brandnew CRAN package BH for Boost headers
// [[Rcpp::depends(BH)]]
#include <Rcpp.h>
#include <boost/foreach.hpp>
#include <boost/math/special_functions/gamma.hpp>
#define foreach BOOST_FOREACH
using namespace boost::math;
//[[Rcpp::export]]
Rcpp::NumericVector boost_gamma(Rcpp::NumericVector x) {
foreach(double& elem, x) {
elem = boost::math::tgamma(elem);
};
return x;
}
,然後快速檢查:
> identical(boost_gamma(0:10 + 1), factorial(0:10))
[1] TRUE
不是說這個測試也意味着很多,除了說頭很容易包括和可用。
查看BigMemory Description文件的Depends
和LinkingTo
,並注意其中的BH
。
最後,通過查看News頁面,您可以隨時瞭解BH包的設置更新。
玩得開心!