本文整理汇总了C++中ModelType::getGLD方法的典型用法代码示例。如果您正苦于以下问题:C++ ModelType::getGLD方法的具体用法?C++ ModelType::getGLD怎么用?C++ ModelType::getGLD使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelType
的用法示例。
在下文中一共展示了ModelType::getGLD方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: calcExpectedEffectiveLengths
void calcExpectedEffectiveLengths(ModelType& model) {
int lb, ub, span;
double *pdf = NULL, *cdf = NULL, *clen = NULL; // clen[i] = sigma_{j=1}^{i}pdf[i]*(lb+i)
model.getGLD().copyTo(pdf, cdf, lb, ub, span);
clen = new double[span + 1];
clen[0] = 0.0;
for (int i = 1; i <= span; i++) {
clen[i] = clen[i - 1] + pdf[i] * (lb + i);
}
eel.clear();
eel.resize(M + 1, 0.0);
for (int i = 1; i <= M; i++) {
int totLen = refs.getRef(i).getTotLen();
int fullLen = refs.getRef(i).getFullLen();
int pos1 = max(min(totLen - fullLen + 1, ub) - lb, 0);
int pos2 = max(min(totLen, ub) - lb, 0);
if (pos2 == 0) { eel[i] = 0.0; continue; }
eel[i] = fullLen * cdf[pos1] + ((cdf[pos2] - cdf[pos1]) * (totLen + 1) - (clen[pos2] - clen[pos1]));
assert(eel[i] >= 0);
if (eel[i] < MINEEL) { eel[i] = 0.0; }
}
delete[] pdf;
delete[] cdf;
delete[] clen;
}