Lines Matching refs:dimension
26 inline void sum(T values[], int len, int dimension, int stride, N dst[]) {
29 for (x = 0; x < dimension; x++) {
33 for (y = 0; y < dimension; y++) {
40 inline void set(T val1[], N val2[], int dimension) {
42 for (x = 0; x < dimension; x++) {
48 inline void add(T val[], N dst[], int dimension) {
50 for (x = 0; x < dimension; x++) {
56 inline void divide(T dst[], N divisor, int dimension) {
61 for (x = 0; x < dimension; x++) {
71 inline N euclideanDist(T val1[], T val2[], int dimension) {
74 for (x = 0; x < dimension; x++) {
88 void initialPickHeuristicRandom(int k, T values[], int len, int dimension, int stride, T dst[],
114 set<T,T>(dst + cntr, values + r, dimension);
123 inline int findClosest(T values[], T oldCenters[], int dimension, int stride, int pop_size) {
125 N best_len = euclideanDist <T, N>(values, oldCenters, dimension);
128 N l = euclideanDist <T, N>(values, oldCenters + y, dimension);
141 int calculateNewCentroids(int k, T values[], int len, int dimension, int stride, T oldCenters[],
157 int best = findClosest<T, N>(values + x, oldCenters, dimension, stride, pop_size);
158 add<T, N>(values + x, tmp + best, dimension);
167 divide<N, int>(tmp + x, popularities[x / stride], dimension);
168 for (y = 0; y < dimension; y++) {
173 set(dst + x, tmp + x, dimension);
179 void runKMeansWithPicks(int k, T finalCentroids[], T values[], int len, int dimension, int stride,
194 ret = calculateNewCentroids<T, N>(k, values, len, dimension, stride, c1, c2);
202 set<T, T>(finalCentroids, c1, dimension);
209 void runKMeans(int k, T finalCentroids[], T values[], int len, int dimension, int stride,
213 initialPickHeuristicRandom<T>(k, values, len, dimension, stride, initialPicks, seed);
215 runKMeansWithPicks<T, N>(k, finalCentroids, values, len, dimension, stride,
223 void applyCentroids(int k, T centroids[], T values[], int len, int dimension, int stride) {
227 int best = findClosest<T, N>(values + x, centroids, dimension, stride, pop_size);
228 set<T, T>(values + x, centroids + best, dimension);