Skip to content

Commit 6659fe1

Browse files
committed
clean up
1 parent 35d2f79 commit 6659fe1

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/Utils.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -133,17 +133,17 @@ array.
133133
- `dij_min`: The minimum value in the first `n` elements of the `dij` array.
134134
- `best`: The index of the minimum value in the `dij` array.
135135
"""
136-
function fast_findmin(x, n)
137-
laneIndices = SIMD.Vec{8, Int64}((1, 2, 3, 4, 5, 6, 7, 8))
138-
minvals = SIMD.Vec{8, Float64}(Inf)
139-
min_indices = SIMD.Vec{8, Int64}(0)
136+
function fast_findmin(dij::DenseVector{T}, n) where T
137+
laneIndices = SIMD.Vec{8, Int}((1, 2, 3, 4, 5, 6, 7, 8))
138+
minvals = SIMD.Vec{8, T}(Inf)
139+
min_indices = SIMD.Vec{8, Int}(0)
140140

141141
n_batches, remainder = divrem(n, 8)
142142
lane = VecRange{8}(0)
143143
i = 1
144144
@inbounds @fastmath for _ in 1:n_batches
145-
predicate = x[lane + i] < minvals
146-
minvals = vifelse(predicate, x[lane + i], minvals)
145+
predicate = dij[lane + i] < minvals
146+
minvals = vifelse(predicate, dij[lane + i], minvals)
147147
min_indices = vifelse(predicate, laneIndices, min_indices)
148148

149149
i += 8
@@ -157,9 +157,9 @@ function fast_findmin(x, n)
157157
min_value == minvals[7] ? min_indices[7] : min_indices[8]
158158

159159
@inbounds @fastmath for _ in 1:remainder
160-
xi = x[i]
161-
pred = x[i] < min_value
162-
min_value = ifelse(pred, xi, min_value)
160+
xi = dij[i]
161+
pred = dij[i] < min_value
162+
min_value= ifelse(pred, xi, min_value)
163163
min_index = ifelse(pred, i, min_index)
164164
i += 1
165165
end

0 commit comments

Comments
 (0)