示例#1
0
  // used for dump data
  friend std::ostream& operator<<(std::ostream& os, const local_storage& ls) {
    os << "{" << std::endl;
    for (id_features3_t::const_iterator it = ls.tbl_.begin();
         it != ls.tbl_.end();
         ++it) {
      os << "  {" << it->first << ": " << "{" << std::endl;
      const id_feature_val3_t val = it->second;
      for (id_feature_val3_t::const_iterator jt = val.begin();
           jt != val.end();
           ++jt) {
        os << "    " << ls.class2id_.get_key(jt->first) << ": " << jt->second;

        {
          id_feature_val3_t::const_iterator jt_next = jt;
          ++jt_next;
          if (jt_next != val.end()) {
            os << ", ";
          }
        }
        os << std::endl;
      }
      os << "  }";

      {
        id_features3_t::const_iterator it_next = it;
        ++it_next;
        if (it_next != ls.tbl_.end()) {
          os << ",";
        }
      }
      os << std::endl;
    }
    os << "}";
    return os;
  }
示例#2
0
double feature_fabssum(const id_feature_val3_t& f) {
  double sum = 0.0;
  for (id_feature_val3_t::const_iterator it = f.begin(); it != f.end(); ++it) {
    sum += std::fabs(it->second.v1);
  }
  return sum;
}
示例#3
0
float feature_fabssum(const id_feature_val3_t& f) {
  float sum = 0.f;
  for (id_feature_val3_t::const_iterator it = f.begin(); it != f.end(); ++it) {
    sum += fabs(it->second.v1);
  }
  return sum;
}