Skip to content

Commit d19a113

Browse files
committed
Type checks kmsr
1 parent a501307 commit d19a113

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

kmsr/cpp/heuristic.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,17 +130,17 @@ vector<Cluster> kMeansPlusPlus(vector<Point> &points, int k, int seed)
130130

131131
vector<Cluster> heuristik(vector<Point> &points, int k)
132132
{
133-
size_t n = points.size();
133+
int n = static_cast<int>(points.size());
134134
vector<Cluster> bestCluster;
135135
bestCluster.push_back(
136136
Cluster(points)); // Initialize with all points in one cluster
137137
vector<vector<double>> distances(n, vector<double>(n, 0));
138138

139139
// Calculation of distances between all points
140140
#pragma omp parallel for collapse(2)
141-
for (size_t i = 0; i < n; i++)
141+
for (int i = 0; i < n; i++)
142142
{
143-
for (size_t j = 0; j < n; j++)
143+
for (int j = 0; j < n; j++)
144144
{
145145
distances[i][j] = Point::distance(points[i], points[j]);
146146
}
@@ -154,9 +154,9 @@ vector<Cluster> heuristik(vector<Point> &points, int k)
154154
cost(localBestCluster); // Cost of the local best clusters
155155

156156
#pragma omp for
157-
for (size_t i = 0; i < n; i++)
157+
for (int i = 0; i < n; i++)
158158
{
159-
for (size_t j = 0; j < n; j++)
159+
for (int j = 0; j < n; j++)
160160
{
161161
vector<Point> centers;
162162
Point largestCenter = points[i];
@@ -169,7 +169,7 @@ vector<Cluster> heuristik(vector<Point> &points, int k)
169169
int nextCenter = -1;
170170
double maxDist = -1.0;
171171

172-
for (size_t h = 0; h < n; h++)
172+
for (int h = 0; h < n; h++)
173173
{
174174
double dist = numeric_limits<double>::max();
175175
for (const Point &center : centers)

0 commit comments

Comments
 (0)