void computeWordFrequencies(AddressableMatrixT const & points, U * histogram, double const * point_weights = NULL, typename std::enable_if< std::is_base_of< AbstractAddressableMatrix<typename AddressableMatrixT::Value>, AddressableMatrixT >::value >::type * dummy = NULL) const { long num_points = points.rows(); Array<long> labeling((size_t)num_points); vocabulary.mapToClusters(points, &labeling[0]); long num_words = numWords(); for (long i = 0; i < num_words; ++i) histogram[i] = 0; for (size_t i = 0; i < labeling.size(); ++i) { if (labeling[i] >= 0) histogram[labeling[i]] += static_cast<U>(point_weights ? point_weights[i] : 1); } }
// PathCounter(S&& s): spec(std::forward<S>(s)), hasher(spec), stateWords(numWords(spec.datasize())) { // } PathCounter(S& s) : spec(s), hasher(spec), stateWords(numWords(spec.datasize())) { }