Skip to content

Commit 64fd46c

Browse files
authored
Merge pull request #259 from JuliaStats/ast/fix_distances
Update to Distances.jl 0.10.9
2 parents 45d4ccc + 647fc69 commit 64fd46c

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
1313
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
1414

1515
[compat]
16-
Distances = "0.8, 0.9, 0.10"
16+
Distances = "0.10.9"
1717
NearestNeighbors = "0.4"
1818
StatsBase = "0.25, 0.26, 0.27, 0.28, 0.29, 0.30, 0.31, 0.32, 0.33, 0.34"
1919
julia = "1"

src/kmeans.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,11 @@ function _kmeans!(X::AbstractMatrix{<:Real}, # in: data matrix (d
169169
end
170170

171171
if t == 1 || num_affected > 0.75 * k
172-
pairwise!(dmat, distance, centers, X, dims=2)
172+
pairwise!(distance, dmat, centers, X, dims=2)
173173
else
174174
# if only a small subset is affected, only compute for that subset
175175
affected_inds = findall(to_update)
176-
pairwise!(view(dmat, affected_inds, :), distance,
176+
pairwise!(distance, view(dmat, affected_inds, :),
177177
view(centers, :, affected_inds), X, dims=2)
178178
end
179179

@@ -387,7 +387,7 @@ function repick_unused_centers(X::AbstractMatrix{<:Real}, # in: the data matrix
387387
tcosts[j] = 0
388388
v = view(X, :, j)
389389
centers[:, i] = v
390-
colwise!(ds, distance, v, X)
390+
colwise!(distance, ds, v, X)
391391
tcosts = min(tcosts, ds)
392392
end
393393
end

src/seeding.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ function initseeds!(iseeds::AbstractVector{<:Integer}, alg::KmppAlg,
181181

182182
# update mincosts
183183
c = view(X, :, p)
184-
colwise!(tmpcosts, metric, X, view(X, :, p))
184+
colwise!(metric, tmpcosts, X, view(X, :, p))
185185
updatemin!(mincosts, tmpcosts)
186186
mincosts[p] = 0
187187
end

test/kmeans.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ rng = StableRNG(42)
1111
struct MySqEuclidean <: SemiMetric end
1212

1313
# redefinition of Distances.pairwise! for MySqEuclidean type
14-
function Distances.pairwise!(r::AbstractMatrix, dist::MySqEuclidean,
14+
function Distances.pairwise!(dist::MySqEuclidean, r::AbstractMatrix,
1515
a::AbstractMatrix, b::AbstractMatrix; dims::Integer=2)
1616
dims == 2 || throw(ArgumentError("only dims=2 supported for MySqEuclidean distance"))
1717
mul!(r, transpose(a), b)

0 commit comments

Comments
 (0)