本文整理汇总了C++中IFunction::nParams方法的典型用法代码示例。如果您正苦于以下问题:C++ IFunction::nParams方法的具体用法?C++ IFunction::nParams怎么用?C++ IFunction::nParams使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IFunction
的用法示例。
在下文中一共展示了IFunction::nParams方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: exec
/// Execute
void EstimatePeakErrors::exec() {
IFunction_sptr function = getProperty("Function");
ITableWorkspace_sptr results =
WorkspaceFactory::Instance().createTable("TableWorkspace");
results->addColumn("str", "Parameter");
results->addColumn("double", "Value");
results->addColumn("double", "Error");
auto matrix = function->getCovarianceMatrix();
if (!matrix) {
g_log.warning() << "Function doesn't have covariance matrix.\n";
setProperty("OutputWorkspace", results);
return;
}
IPeakFunction *peak = dynamic_cast<IPeakFunction *>(function.get());
if (peak) {
GSLMatrix covariance(*matrix);
calculatePeakValues(*peak, *results, covariance, "");
} else {
CompositeFunction *cf = dynamic_cast<CompositeFunction *>(function.get());
if (cf) {
size_t ip = 0;
for (size_t i = 0; i < cf->nFunctions(); ++i) {
IFunction *fun = cf->getFunction(i).get();
size_t np = fun->nParams();
peak = dynamic_cast<IPeakFunction *>(fun);
if (peak) {
std::string prefix = "f" + std::to_string(i) + ".";
GSLMatrix covariance(*matrix, ip, ip, np, np);
calculatePeakValues(*peak, *results, covariance, prefix);
}
ip += np;
}
} else {
g_log.warning() << "Function has no peaks.\n";
}
}
setProperty("OutputWorkspace", results);
}