mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-04-15 05:32:21 +00:00
.. with grateful thanks to Greg Hamerly A fast kmeans algorithm described here: https://epubs.siam.org/doi/10.1137/1.9781611972801.12 The source repository is also here: https://github.com/ghamerly/fast-kmeans NOTE: The original source has been included largely as-is with a view to writing a wrapper around it using Qt semantics for use in GoldenCheetah (e.g. via datafilter) The original source included multiple kmeans algorithms we have only kept the `fast' Hamerly variant.
30 lines
810 B
C++
30 lines
810 B
C++
#ifndef HAMERLY_KMEANS_H
|
|
#define HAMERLY_KMEANS_H
|
|
|
|
/* Authors: Greg Hamerly and Jonathan Drake
|
|
* Feedback: hamerly@cs.baylor.edu
|
|
* See: http://cs.baylor.edu/~hamerly/software/kmeans.php
|
|
* Copyright 2014
|
|
*
|
|
* HamerlyKmeans implements Hamerly's k-means algorithm that uses one lower
|
|
* bound per point.
|
|
*/
|
|
|
|
#include "triangle_inequality_base_kmeans.h"
|
|
|
|
class HamerlyKmeans : public TriangleInequalityBaseKmeans {
|
|
public:
|
|
HamerlyKmeans() { numLowerBounds = 1; }
|
|
virtual ~HamerlyKmeans() { free(); }
|
|
virtual std::string getName() const { return "hamerly"; }
|
|
|
|
protected:
|
|
// Update the upper and lower bounds for the given range of points.
|
|
void update_bounds(int startNdx, int endNdx);
|
|
|
|
virtual int runThread(int threadId, int maxIterations);
|
|
};
|
|
|
|
#endif
|
|
|