示例#1
0
 static void getFloats(const char *str, AzByte dlm, AzDvect *v) {
   AzIFarr ifa; 
   AzStrPool sp; 
   getStrings(str, dlm, &sp); 
   int ix; 
   for (ix = 0; ix < sp.size(); ++ix) {
     ifa.put(-1, atof(sp.c_str(ix))); 
   }
   v->reform(ifa.size()); 
   for (ix = 0; ix < ifa.size(); ++ix) {
     v->set(ix, ifa.get(ix)); 
   }
 }
示例#2
0
/*-------------------------------------------------------------------------*/
void AzPrepText2::set_ifeat(const AzSmat *m_feat, int top_num, 
                 int col, int offs, AzIFarr *ifa_ctx, feat_info fi[2]) const
{                 
  if (col < 0 || col >= m_feat->colNum()) return; 
  AzIFarr ifa; m_feat->col(col)->nonZero(&ifa); 
  fi[0].update(ifa); 
  if (top_num > 0 && ifa.size() > top_num) {
    ifa.sort_FloatInt(false); /* descending order */
    ifa.cut(top_num); 
  }
  fi[1].update(ifa); 
  if (offs == 0) ifa_ctx->concat(&ifa); 
  else {
    for (int ix = 0; ix < ifa.size(); ++ix) {
      int row = ifa.getInt(ix); 
      double val = ifa.get(ix); 
      ifa_ctx->put(row+offs, val); 
    }    
  }
}   
示例#3
0
/*-------------------------------------------------------------*/
void AzDmat::convert(AzSmat *m_out)
{
  m_out->reform(row_num, col_num); 
  int col; 
  for (col = 0; col < col_num; ++col) {
    if (column[col] != NULL) {
      AzIFarr ifq; 
      column[col]->nonZero(&ifq); 
      if (ifq.size() > 0) {
        m_out->col_u(col)->load(&ifq); 
      }
    }
  }
}