boolean getxVector(recompVectors *rvec, int nodenum, int *slot, int mxtips)
{
#ifdef _DEBUG_RECOMPUTATION
  double 
    tstart = gettime();
#endif

  boolean 
    slotNeedsRecomp = FALSE;

  *slot = rvec->iNode[nodenum - mxtips - 1];

  if(*slot == NODE_UNPINNED)
  {
    *slot = pinNode(rvec, nodenum, mxtips);
    slotNeedsRecomp = TRUE;
  }

  assert(*slot >= 0 && *slot < rvec->numVectors);

  rvec->unpinnable[*slot] = FALSE;
#ifdef _DEBUG_RECOMPUTATION
  rvec->pinTime += gettime() - tstart;
#endif

  return slotNeedsRecomp;
}
Ejemplo n.º 2
0
/** @brief Get a pinned slot \a slot that holds the likelihood vector for inner node \a nodenum
 *  
 *  If node \a node nodenum is not pinned to any slot yet, the minimum cost replacement strategy is used.
 *
 *  @param v
 *    Recomputation info
 *    
 *  @param nodenum
 *    node id
 *    
 *  @param slot
 *    slot id
 *
 *  @param mxtips
 *    Number of tips in the tree
 *
 */
boolean getxVector(recompVectors *rvec, int nodenum, int *slot, int mxtips)
{
  boolean 
    slotNeedsRecomp = PLL_FALSE;

  *slot = rvec->iNode[nodenum - mxtips - 1];

  if(*slot == PLL_NODE_UNPINNED)
  {
    *slot = pinNode(rvec, nodenum, mxtips); /* now we will run the replacement strategy */
    slotNeedsRecomp = PLL_TRUE;
  }

  assert(*slot >= 0 && *slot < rvec->numVectors);

  rvec->unpinnable[*slot] = PLL_FALSE;

  return slotNeedsRecomp;
}