27 #include <mrpt/config.h> 35 #elif defined(HAVE_MALLOC_MALLOC_H) 36 #include <malloc/malloc.h> 63 for (
int i = 0; i < d; i++) p1[i] += p2[i];
68 for (
int i = 0; i < d; i++) p[i] *= scale;
74 for (
int i = 0; i < d; i++) result += (p1[i] - p2[i]) * (p1[i] - p2[i]);
82 #define ENABLE_KMEANS_ASSERTS 83 #ifdef ENABLE_KMEANS_ASSERTS 85 const char* file,
int line,
const char* expression);
86 #define KM_ASSERT(expression) \ 87 (void)((expression) != 0 ? 0 : __KMeansAssertionFailure(__FILE__, __LINE__, #expression)) 89 #define KM_ASSERT(expression) 102 int u = rand() * RAND_MAX + rand();
103 return ((u % n) + n) % n;
Scalar * PointAllocate(int d)
void PointCopy(Scalar *p1, const Scalar *p2, int d)
void PointAdd(Scalar *p1, const Scalar *p2, int d)
void PointScale(Scalar *p, Scalar scale, int d)
int __KMeansAssertionFailure(const char *file, int line, const char *expression)
void PointFree(Scalar *p)
Scalar PointDistSq(const Scalar *p1, const Scalar *p2, int d)
void memcpy(void *dest, size_t destSize, const void *src, size_t copyCount) noexcept
An OS and compiler independent version of "memcpy".