本文整理汇总了C++中ModelObject::GetFitStatistic方法的典型用法代码示例。如果您正苦于以下问题:C++ ModelObject::GetFitStatistic方法的具体用法?C++ ModelObject::GetFitStatistic怎么用?C++ ModelObject::GetFitStatistic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelObject
的用法示例。
在下文中一共展示了ModelObject::GetFitStatistic方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: myfunc_nlopt_gen
/// Objective function: calculates the objective value (ignore gradient calculation)
/// Keep track of how many times this function has been called, and report current
/// chi^2 (or other objective-function value) every 20 calls
/// Note that parameters n and grad are unused, but required by the NLopt interface.
double myfunc_nlopt_gen( unsigned n, const double *x, double *grad, void *my_func_data )
{
ModelObject *theModel = (ModelObject *)my_func_data;
// following is a necessary kludge bcs theModel->GetFitStatistic() won't accept
// const double*
double *params = (double *)x;
double fitStatistic;
nlopt_result junk;
fitStatistic = theModel->GetFitStatistic(params);
// feedback to user
funcCallCount++;
if (verboseOutput > 0) {
if ((funcCallCount % FUNCS_PER_REPORTING_STEP) == 0) {
printf("\tN-M simplex: function call %d: objective = %f\n", funcCallCount, fitStatistic);
if ( (verboseOutput > 1) && ((funcCallCount % (REPORT_STEPS_PER_VERBOSE_OUTPUT*FUNCS_PER_REPORTING_STEP)) == 0) ) {
PrintParametersSimple(theModel, params);
}
}
}
if (isnan(fitStatistic)) {
fprintf(stderr, "\n*** NaN-valued fit statistic detected (N-M optimization)!\n");
fprintf(stderr, "*** Terminating the fit...\n");
junk = nlopt_force_stop(theOptimizer);
}
return(fitStatistic);
}
示例2: EnergyFunction
double ImfitSolver::EnergyFunction( double *trial, bool &bAtSolution )
{
double fitStatistic;
fitStatistic = theModel->GetFitStatistic(trial);
return(fitStatistic);
}