示例#1
0
  inline
  Tp dot_product(const FeatureVector<Tp1, Alloc1>& x, Iterator first, Iterator last, Tp __dot)
  {
    typedef FeatureVector<Tp1, Alloc1> feature_vector1_type;
    
    for (/**/; first != last; ++ first) {
      typename feature_vector1_type::const_iterator iter = x.find(first->first);
      
      if (iter != x.end())
	__dot += iter->second * first->second;
    }
    return __dot;
  }
示例#2
0
  inline
  Tp dot_product(Iterator first, Iterator last, const FeatureVector<Tp2, Alloc2>& y, Tp __dot)
  {
    typedef FeatureVector<Tp2, Alloc2> feature_vector2_type;
    
    for (/**/; first != last; ++ first) {
      typename feature_vector2_type::const_iterator iter = y.find(first->first);
      
      if (iter != y.end())
	__dot += first->second * iter->second;
    }
    
    return __dot;
  }