Files
secondo/Algebras/ImageSimilarity/fast_kmeans/sort_kmeans.h
2026-01-23 17:03:45 +08:00

58 lines
1.4 KiB
C++

/*
----
This file is NOT part of SECONDO.
* Authors: Greg Hamerly and Jonathan Drake
* Feedback: hamerly@cs.baylor.edu
* See: http://cs.baylor.edu/~hamerly/software/kmeans.php
* Copyright 2014
*
* The SortKmeans algorithm is an implementation of Phillip's Sort-Means
* algorithm.
----
//paragraph [1] Title: [{\Large \bf \begin{center}] [\end{center}}]
//[TOC] [\tableofcontents]
[1] Declarations for the SortKmeans algorithm
1 Declarations for the SortKmeans algorithm
*/
#ifndef SORT_KMEANS_H
#define SORT_KMEANS_H
/* Authors: Greg Hamerly and Jonathan Drake
* Feedback: hamerly@cs.baylor.edu
* See: http://cs.baylor.edu/~hamerly/software/kmeans.php
* Copyright 2014
*
* The SortKmeans algorithm is an implementation of Phillip's Sort-Means
* algorithm.
*/
#include "original_space_kmeans.h"
class SortKmeans : public OriginalSpaceKmeans {
public:
SortKmeans() : sortedCenters(NULL) {}
virtual ~SortKmeans() { free(); }
virtual void free();
virtual void initialize(Dataset const *aX, unsigned short aK,
unsigned short *initialAssignment, int aNumThreads);
virtual std::string getName() const { return "sort"; }
private:
virtual int runThread(int threadId, int maxIterations);
void sort_centers();
// double is center-center distance squared, divided by 4;
// short is center index
std::pair<double, unsigned short> *sortedCenters;
};
#endif