template <> BASE_IMPEXP double internal_kmeans<float>( const bool use_kmeansplusplus_method, const size_t nPoints, const size_t k, const size_t dims, const float *points, const size_t attempts, float* out_center, int *out_assignments) { std::vector<double> points_d(nPoints*dims); std::vector<double> centers_d(k*dims); // Convert: float -> double for (size_t i=0;i<nPoints*dims;i++) points_d[i] = double(points[i]); const double ret = RunKMeans(nPoints,k,dims,&points_d[0],attempts,¢ers_d[0],out_assignments); // Convert: double -> float if (out_center) for (size_t i=0;i<k*dims;i++) out_center[i] = float(centers_d[i]); return ret; }
double internal_kmeans<double>( const bool use_kmeansplusplus_method, const size_t nPoints, const size_t k, const size_t dims, const double* points, const size_t attempts, double* out_center, int* out_assignments) { MRPT_UNUSED_PARAM(use_kmeansplusplus_method); return RunKMeans( nPoints, k, dims, const_cast<double*>(points), attempts, out_center, out_assignments); }
/* ------------------------------------------- internal_kmeans ------------------------------------------- */ template <> BASE_IMPEXP double internal_kmeans<double>( const bool use_kmeansplusplus_method, const size_t nPoints, const size_t k, const size_t dims, const double *points, const size_t attempts, double* out_center, int *out_assignments) { return RunKMeans(nPoints,k,dims,const_cast<double*>(points),attempts,out_center,out_assignments); }