Permalink
Browse files

Merge pull request #11 from cosinequanon/fix-deprecated-unsafe_view

change unsafe_view to view
  • Loading branch information...
lindahua committed Feb 1, 2014
2 parents f7c4e80 + 99939c6 commit 737dca89ae6ed938ec902784ad2ef63fe40050f9
Showing with 10 additions and 10 deletions.
  1. +2 −2 src/kmeans.jl
  2. +8 −8 src/utils.jl
View
@@ -134,7 +134,7 @@ function update_centers!{T<:FloatingPoint}(
for i = 1 : k
if to_update[i]
@inbounds ci::T = 1 / cweights[i]
- multiply!(unsafe_view(centers,:,i), ci)
+ multiply!(view(centers,:,i), ci)
end
end
end
@@ -169,7 +169,7 @@ function update_centers!{T<:FloatingPoint}(
for i = 1 : k
if to_update[i]
@inbounds ci::T = 1 / cweights[i]
- multiply!(unsafe_view(centers,:,i), ci)
+ multiply!(view(centers,:,i), ci)
end
end
end
View
@@ -21,8 +21,8 @@ function accumulate_cols!(
@inbounds cj = c[j]
1 <= cj <= K || error("assignment out of boundary.")
- rj = unsafe_view(r, :, cj)
- xj = unsafe_view(x, :, j)
+ rj = view(r, :, cj)
+ xj = view(x, :, j)
if rw[cj] > 0
add!(rj, xj)
else
@@ -54,8 +54,8 @@ function accumulate_cols!(
@inbounds cj = c[j]
1 <= cj <= K || error("assignment out of boundary.")
- rj = unsafe_view(r, :, cj)
- xj = unsafe_view(x, :, j)
+ rj = view(r, :, cj)
+ xj = view(x, :, j)
if rw[cj] > 0
fma!(rj, xj, wj)
else
@@ -86,8 +86,8 @@ function accumulate_cols_u!(
1 <= cj <= K || error("assignment out of boundary.")
if u[cj]
- rj = unsafe_view(r, :, cj)
- xj = unsafe_view(x, :, j)
+ rj = view(r, :, cj)
+ xj = view(x, :, j)
if rw[cj] > 0
add!(rj, xj)
else
@@ -122,8 +122,8 @@ function accumulate_cols_u!(
1 <= cj <= K || error("assignment out of boundary.")
if u[cj]
- rj = unsafe_view(r, :, cj)
- xj = unsafe_view(x, :, j)
+ rj = view(r, :, cj)
+ xj = view(x, :, j)
if rw[cj] > 0
fma!(rj, xj, wj)
else

0 comments on commit 737dca8

Please sign in to comment.