本文整理汇总了C++中eigen::VectorXd::mean方法的典型用法代码示例。如果您正苦于以下问题:C++ VectorXd::mean方法的具体用法?C++ VectorXd::mean怎么用?C++ VectorXd::mean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eigen::VectorXd
的用法示例。
在下文中一共展示了VectorXd::mean方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
double Model::n1CDF(Eigen::VectorXd &d) {
gsl_function F;
F.function = &n1PDF;
F.params = &d;
double result, error;
// integration sometimes fails
gsl_set_error_handler_off();
int limit = 10000;
gsl_integration_workspace *w = gsl_integration_workspace_alloc(limit);
double epsabs = 0, epsrel = 1e-7;
double lower = 0, upper;
const double chi = 2,
sdI = 1; // following assumes these values. do not change these.
int status = gsl_integration_qagiu(&F, lower, epsabs, epsrel, limit, w,
&result, &error);
if (status != GSL_SUCCESS) {
double mean_drift = d.mean();
if (mean_drift > d(0)) {
lower = (chi - 0.98) / (mean_drift + 2 * sdI);
} else {
lower = (chi - 0.98) / (d(0) + 2 * sdI);
}
upper = 0.02 * chi / (mean_drift - 2 * sdI);
size_t neval;
status = gsl_integration_qng(&F, lower, upper, epsabs, epsrel, &result,
&error, &neval);
}
if (status != GSL_SUCCESS) {
// std::cout << "Integration Failed" << std::endl;
// result = GSL_NAN;
result = 0.0;
}
gsl_integration_workspace_free(w);
return result;
}
示例2: mean
double mean(Eigen::VectorXd &v)
{
return v.mean();
}