void CosineTreeBuilder::SplitData(std::vector<double> c, arma::mat& ALeft,
                                  arma::mat& ARight,arma::mat A)
{
  Log::Info<<"SplitData"<<std::endl;
  double cMax,cMin;
  //Calculating the lower and the Upper Limit
  cMin = GetMaxSimilarity(c);
  cMax = GetMinSimilarity(c);
  //Couter for left and right
  size_t lft, rgt;
  lft = 0;
  rgt = 0;
  //Splitting on the basis of nearness to the the high or low value
  for(size_t i=0;i<A.n_rows;i++)
  {
    if ((cMax - c[i])<=(c[i] - cMin))
    {
      ALeft.insert_rows(lft,A.row(i));
      lft ++;
    }
    else
    {
      ARight.insert_rows(rgt,A.row(i));
      rgt ++;
    }
  }
}
Ejemplo n.º 2
0
 void saveHistory() {
   trajectories.insert_rows(trajectories.n_rows, abundance.t());
 }