src/fisher.cpp
// pleaf is a vector of joint probabilities on the leaves
pleaf is a vector of joint probabilities on the leaves
pleaf is a vector of joint probabilities on the leaves
void fill_pleaf(Tree &T, StateList &sl, Parameters &Par, Array1 &pleaf) {
  long i, j, l, u, v;
  double p;
  pleaf.resize(T.nstleaves);
  for (i=0; i < T.nstleaves; i++) {
    pleaf[i] = 0;
  }
  for (i=0; i < T.nstleaves; i++) {
    for(j=0; j < T.nsthidden; j++) {
      p = Par.r[rootstate(sl.h[j])];
      for(l=0; l < T.nedges; l++) {
        edgestate(T, l, sl.h[j], sl.l[i], u, v);
        p = p*Par.tm[l][u][v];
      }
      pleaf[i] = pleaf[i] + p;
    }
  }
}
void fill_pleaf ( Tree & T , StateList & sl , Parameters & Par , Array1 & pleaf ) { long i , j , l , u , v ; double p ; pleaf . resize ( T . nstleaves ) ; for ( i = 0 ; i < T . nstleaves ; i ++ ) { pleaf [ i ] = 0 ; } for ( i = 0 ; i < T . nstleaves ; i ++ ) { for ( j = 0 ; j < T . nsthidden ; j ++ ) { p = Par . r [ rootstate ( sl . h [ j ] ) ] ; for ( l = 0 ; l < T . nedges ; l ++ ) { edgestate ( T , l , sl . h [ j ] , sl . l [ i ] , u , v ) ; p = p * Par . tm [ l ] [ u ] [ v ] ; } pleaf [ i ] = pleaf [ i ] + p ; } } }
pleaf is a vector of joint probabilities on the leaves
pleaf is a vector of joint probabilities on the leaves
// Initializations // Loop over all states // Compute leaf probabilities