| 321 | typedef default_memory_manager mem_manager_type; |
| 322 | |
| 323 | scalar_type operator() ( |
| 324 | const sample_type& a, |
| 325 | const sample_type& b |
| 326 | ) const |
| 327 | { |
| 328 | typename sample_type::const_iterator ai = a.begin(); |
| 329 | typename sample_type::const_iterator bi = b.begin(); |
| 330 | |
| 331 | scalar_type sum = 0; |
| 332 | while (ai != a.end() && bi != b.end()) |
| 333 | { |
| 334 | if (ai->first == bi->first) |
| 335 | { |
| 336 | sum += std::min(ai->second , bi->second); |
| 337 | ++ai; |
| 338 | ++bi; |
| 339 | } |
| 340 | else if (ai->first < bi->first) |
| 341 | { |
| 342 | ++ai; |
| 343 | } |
| 344 | else |
| 345 | { |
| 346 | ++bi; |
| 347 | } |
| 348 | } |
| 349 | |
| 350 | return sum; |
| 351 | } |
| 352 | |
| 353 | bool operator== ( |
| 354 | const sparse_histogram_intersection_kernel& |