Skip to content

Commit

Permalink
[clustering] type dispatching via explicit specialization
Browse files Browse the repository at this point in the history
  • Loading branch information
clonker authored and marscher committed Oct 15, 2019
1 parent 385c4b7 commit 1a4327c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.9)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 14)

if(DEFINED PROJECT_NAME)
set(SKTIME_IS_SUBPROJECT ON)
Expand Down
5 changes: 5 additions & 0 deletions sktime/clustering/include/bits/metric_base_bits.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
#include <omp.h>
#endif

template<>
inline float Metric::compute<float>(const float* xs, const float* ys, std::size_t dim) const {
return this->compute_f(xs, ys, dim);
}

template<typename T>
inline py::array_t<int> assign_chunk_to_centers(const np_array<T>& chunk,
const np_array<T>& centers,
Expand Down
3 changes: 0 additions & 3 deletions sktime/clustering/include/metric.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ class Metric {
T compute(const T* xs, const T* ys, std::size_t dim) const {
return compute_d(xs, ys, dim);
}
float compute(const float* xs, const float* ys, std::size_t dim) const {
return compute_f(xs, ys, dim);
}
};

class EuclideanMetric : public Metric {
Expand Down

0 comments on commit 1a4327c

Please sign in to comment.