Skip to content

Commit 5eec95c

Browse files
committed
try to fix 1.0
1 parent 7b22b9e commit 5eec95c

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/kmeans.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ function Base.sort(res::KmeansResult; kw...)
133133
res.totalcost, res.iterations, res.converged)
134134
end
135135

136+
if VERSION < v"1.9" # then Base.eachcol doesn't exist, or returns an iterator
137+
eachcol(x::AbstractMatrix) = [view(x,:,i) for i in axes(x,2)]
138+
end
139+
136140
#### Core implementation
137141

138142
# core k-means skeleton

test/kmeans.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ end
212212
for i in 1:5
213213
@test mean(data[:, findall(==(i), res.assignments)]; dims=2) res.centers[:,i]
214214
end
215-
@test 1:5 == sortperm(eachcol(res.centers); by=last)
215+
@test 1:5 == sortperm(Clustering.eachcol(res.centers); by=last)
216216
end
217217

218218
end

0 commit comments

Comments
 (0)