本文整理汇总了C++中Branch::set_dlen方法的典型用法代码示例。如果您正苦于以下问题:C++ Branch::set_dlen方法的具体用法?C++ Branch::set_dlen怎么用?C++ Branch::set_dlen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Branch
的用法示例。
在下文中一共展示了Branch::set_dlen方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: calc_deriv
/**
* Calculates contributions to partial derivatives of LL function wrt
* each of the model parameters for current data bin. Contributions are
* added to totals in provided deriv argument.
*/
static void calc_deriv(BkgdEvoMdlParam *ll_deriv,
BkgdEvoMdlConfig *conf,
const BkgdEvoMdlParam *param,
const BkgdBin *bin) {
Branch *br;
ColType *cltype;
int i;
double coef;
/* calculate branch length and branch substitution probability
* partial derivatives
*/
for(i = 0; i < conf->n_branch; i++) {
br = &conf->branches[i];
br->set_dlen(br, bin, param);
branch_set_dprob(br, bin, param, conf);
}
/* calculate column probability partial derivatives */
for(i = 0; i < conf->n_cltype; i++) {
cltype = conf->cltypes[i];
if(cltype->subst_type == SUBST_TYPE_CONSERVED) {
/* only do columns with substitutions in first step */
continue;
}
cltype_set_dprob(cltype, param, conf);
if(cltype->n > 0) {
/* add contribution to LL partial derivs */
coef = cltype->n / cltype->prob;
if(isnan(coef)) {
fprintf(stderr, "nan coef, cltype->name=%s, cltype->n=%ld, "
"cltype->prob=%g\n",cltype->name, cltype->n, cltype->prob);
}
param_add(&cltype->dprob, coef, ll_deriv);
}
}
/* now conserved column */
if(conf->cons_cltype != NULL) {
cltype = conf->cons_cltype;
cltype_cons_set_dprob(cltype, param, conf);
if(cltype->n) {
/* add contribution to LL partial derivs */
coef = cltype->n / cltype->prob;
param_add(&cltype->dprob, coef, ll_deriv);
}
}
return;
}