1 /* rTrait.c 2010-05-26 */
3 /* Copyright 2010 Emmanuel Paradis */
5 /* This file is part of the R-package `ape'. */
6 /* See the file ../COPYING for licensing issues. */
10 void rTraitCont(int *model, int *Nedge, int *edge1, int *edge2, double *el,
11 double *sigma, double *alpha, double *theta, double *x)
13 /* The tree must be in pruningwise order */
17 case 1 : for (i = *Nedge - 1; i >= 0; i--) {
19 x[edge2[i]] = x[edge1[i]] + sqrt(el[i]) * sigma[i] * norm_rand();
23 case 2 : for (i = *Nedge - 1; i >= 0; i--) {
25 x[edge2[i]] = x[edge1[i]] + (sigma[i]*norm_rand() - alpha[i]*(x[edge1[i]] - theta[i])) * el[i]; /* need sqrt(el[i]) ? */