将gsl_ran_hypergeometric_pdf(k,n1,n2,t)转换为BOOST :: MATH :: HY
translate gsl_ran_hypergeometric_pdf(k, n1, n2, t) to boost::math::hypergeometric_distribution
我如何翻译使用超几何的C 程序GNU科学库的分布功能
http://www.gnu.org/software/gsl/manual/html_node/the-hypergeometric-distribution.html
进入C 程序,该程序使用Boost库中使用类似功能?
#include <cstdlib>
#include <iostream>
#include <gsl/gsl_randist.h>
#include <gsl/gsl_cdf.h>
int main(int argc,char *argv[]) {
unsigned int n1 = 256;
unsigned int n2 = 1583;
unsigned int t = 300;
unsigned int k = 40;
std::cout << gsl_ran_hypergeometric_pdf(k, n1, n2, t)
<< std::endl
<< gsl_cdf_hypergeometric_P(k, n1, n2, t)
<< std::endl;
return EXIT_SUCCESS;
}
这是一个转换为增强功能的翻译:
#include <cstdlib>
#include <iostream>
#include <boost/math/distributions/hypergeometric.hpp>
#include <boost/math/policies/policy.hpp>
int main(int argc, char *argv[]) {
unsigned int n1 = 256;
unsigned int n2 = 1583;
unsigned int t = 300;
unsigned int k = 40;
boost::math::hypergeometric_distribution<double> hg_dist(n1, t, n1 + n2);
std::cout << boost::math::pdf<double>(hg_dist, k)
<< std::endl
<< boost::math::cdf<double>(hg_dist, k)
<< std::endl;
return EXIT_SUCCESS;
}
有关更多信息,请参见http://www.boost.org/doc/libs/1_52_0/libs/math/math/doc/sf_and_dist/html/math/math_tool_tool_tool_tiast/dist_ref/dists/dists_ref/dists/hyhypergemetric_dist.htric_dist.html
相关文章:
- 当我尝试使用 sstream 和分面将 Boost Time_duration转换为字符串时,我没有得到所需的格式
- Boost buffer_cast 无法从 void* 转换为 PointerToPodType
- Boost.Spirit将表达转换为AST
- 将 boost 序列化对象的 asio::streambuf 表示转换为 Beast 的 DynamicBody req.body()
- 将"boost::tuple "转换为"boost::fusion::tuple&quo
- 用于 boost::p roperty_tree 的通用枚举转换器
- 如何将 boost::hana::map 转换为 lambda
- 如何将 boost::hana::tuple 转换为 std::变体
- 将 boost::文件系统::p ath 转换为 char?
- Boost.Hana:在 constexpr 上下文中将值元组转换为相应类型的元组
- 为什么要 boost::p roperty_tree::write_json() 将整数值转换为字符串?这是不正确的
- 如何正确地将boost::asio::buffers_iterator转换为InputIterator
- 如何将boost::asio::ip::address_v6 ip转换为2个uint64_t数字,并从2个uint 64
- 如何将 boost::beast 的响应<buffer_body>转换为响应<string_body>?
- 提取并转换 boost::p ython::list 的列表元素
- 我已经在我的运算符 [] 中使用了一个代理来隐式转换 boost::变体。如何通过运算符 [] 维护分配?
- 无法转换 boost::lambda::..到长无符号的 int
- 如何从字符串中强制转换Boost::thread::id
- 转换boost::变体类型的std::vector
- 不能转换boost::lambda::placeholder1_type