MRPT  1.9.9
Macros | Functions | Variables
kmeans++/KMeans.cpp File Reference
#include "KMeans.h"
#include <ctime>
#include <sstream>
#include <vector>
#include "KmTree.h"
Include dependency graph for kmeans++/KMeans.cpp:

Go to the source code of this file.

Macros

#define LOG(verbose, text)
 

Functions

void AddKMeansLogging (std::ostream *out, bool verbose)
 
void ClearKMeansLogging ()
 
static double GetSeconds ()
 
static void RunKMeansOnce (const KmTree &tree, int n, int k, int d, Scalar *points, Scalar *centers, Scalar *min_cost, Scalar *max_cost, Scalar *total_cost, double start_time, double *min_time, double *max_time, double *total_time, Scalar *best_centers, int *best_assignment)
 
void LogMetaStats (Scalar min_cost, Scalar max_cost, Scalar total_cost, double min_time, double max_time, double total_time, int num_attempts)
 
Scalar RunKMeans (int n, int k, int d, Scalar *points, int attempts, Scalar *ret_centers, int *ret_assignment)
 
Scalar RunKMeansPlusPlus (int n, int k, int d, Scalar *points, int attempts, Scalar *ret_centers, int *ret_assignment)
 

Variables

static vector< ostream * > gLogOutputs
 
static vector< ostream * > gVerboseLogOutputs
 

Macro Definition Documentation

◆ LOG

#define LOG (   verbose,
  text 
)
Value:
{ \
vector<ostream*>& outputs = \
if (outputs.size() > 0) \
{ \
ostringstream string_stream; \
string_stream << text; \
for (int i = 0; i < (int)outputs.size(); i++) \
*(outputs[i]) << string_stream.str(); \
} \
}
static vector< ostream * > gVerboseLogOutputs
static vector< ostream * > gLogOutputs

Definition at line 24 of file kmeans++/KMeans.cpp.

Referenced by LogMetaStats(), RunKMeans(), RunKMeansOnce(), and RunKMeansPlusPlus().

Function Documentation

◆ AddKMeansLogging()

void AddKMeansLogging ( std::ostream *  out,
bool  verbose 
)

Definition at line 36 of file kmeans++/KMeans.cpp.

References gLogOutputs, gVerboseLogOutputs, out, and verbose.

◆ ClearKMeansLogging()

void ClearKMeansLogging ( )

Definition at line 41 of file kmeans++/KMeans.cpp.

References gLogOutputs, and gVerboseLogOutputs.

◆ GetSeconds()

static double GetSeconds ( )
static

Definition at line 48 of file kmeans++/KMeans.cpp.

Referenced by RunKMeans(), RunKMeansOnce(), and RunKMeansPlusPlus().

Here is the caller graph for this function:

◆ LogMetaStats()

void LogMetaStats ( Scalar  min_cost,
Scalar  max_cost,
Scalar  total_cost,
double  min_time,
double  max_time,
double  total_time,
int  num_attempts 
)

Definition at line 103 of file kmeans++/KMeans.cpp.

References LOG.

Referenced by RunKMeans(), and RunKMeansPlusPlus().

Here is the caller graph for this function:

◆ RunKMeans()

Scalar RunKMeans ( int  n,
int  k,
int  d,
Scalar points,
int  attempts,
Scalar ret_centers,
int *  ret_assignment 
)

Definition at line 118 of file kmeans++/KMeans.cpp.

References GetRandom(), GetSeconds(), KM_ASSERT, LOG, LogMetaStats(), mrpt::system::os::memcpy(), and RunKMeansOnce().

Referenced by mrpt::math::detail::internal_kmeans< double >(), and mrpt::math::detail::internal_kmeans< float >().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RunKMeansOnce()

static void RunKMeansOnce ( const KmTree tree,
int  n,
int  k,
int  d,
Scalar points,
Scalar centers,
Scalar min_cost,
Scalar max_cost,
Scalar total_cost,
double  start_time,
double *  min_time,
double *  max_time,
double *  total_time,
Scalar best_centers,
int *  best_assignment 
)
static

Definition at line 55 of file kmeans++/KMeans.cpp.

References KmTree::DoKMeansStep(), GetSeconds(), LOG, and mrpt::system::os::memcpy().

Referenced by RunKMeans(), and RunKMeansPlusPlus().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RunKMeansPlusPlus()

Scalar RunKMeansPlusPlus ( int  n,
int  k,
int  d,
Scalar points,
int  attempts,
Scalar ret_centers,
int *  ret_assignment 
)

Definition at line 177 of file kmeans++/KMeans.cpp.

References GetSeconds(), KM_ASSERT, LOG, LogMetaStats(), RunKMeansOnce(), and KmTree::SeedKMeansPlusPlus().

Here is the call graph for this function:

Variable Documentation

◆ gLogOutputs

vector<ostream*> gLogOutputs
static

Definition at line 22 of file kmeans++/KMeans.cpp.

Referenced by AddKMeansLogging(), and ClearKMeansLogging().

◆ gVerboseLogOutputs

vector<ostream*> gVerboseLogOutputs
static

Definition at line 23 of file kmeans++/KMeans.cpp.

Referenced by AddKMeansLogging(), and ClearKMeansLogging().




Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: c7a3bec24 Sun Mar 29 18:33:13 2020 +0200 at dom mar 29 18:50:38 CEST 2020