| 6 | |
| 7 | |
| 8 | float_type dot_product(const DataSet::node2d &instances, int x, int y) { |
| 9 | float_type sum = 0; |
| 10 | auto i = instances[x].begin(); |
| 11 | auto j = instances[y].begin(); |
| 12 | while (i != instances[x].end() && j != instances[y].end()) { |
| 13 | if (i->index < j->index) { |
| 14 | i++; |
| 15 | } else if (i->index > j->index) { |
| 16 | j++; |
| 17 | } else { |
| 18 | sum += i->value * j->value; |
| 19 | i++; |
| 20 | j++; |
| 21 | } |
| 22 | } |
| 23 | return sum; |
| 24 | } |
| 25 | |
| 26 | kernel_type get_cpu_kernel(const DataSet::node2d &instances, int x, int y, const SvmParam ¶m) { |
| 27 | kernel_type r; |
no test coverage detected