Skip to content

Commit b77ca44

Browse files
committed
@turbo findmax, and smaller nsplit
1 parent 2837b3e commit b77ca44

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/lu.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ end
144144
end
145145

146146
@inline function nsplit(::Type{T}, n) where {T}
147-
k = max(2, 512 ÷ (isbitstype(T) ? sizeof(T) : 8))
147+
# k = max(2, 512 ÷ (isbitstype(T) ? sizeof(T) : 8))
148+
k = max(2, 128 ÷ (isbitstype(T) ? sizeof(T) : 8))
148149
k_2 = k ÷ 2
149150
return n >= k ? ((n + k_2) ÷ k) * k_2 : n ÷ 2
150151
end
@@ -277,12 +278,11 @@ function _generic_lufact!(A, ::Val{Pivot}, ipiv, info) where {Pivot}
277278
kp = k
278279
if Pivot
279280
amax = abs(zero(eltype(A)))
280-
for i in k:m
281+
@turbo for i in k:m
281282
absi = abs(A[i, k])
282-
if absi > amax
283-
kp = i
284-
amax = absi
285-
end
283+
isnewmax = absi > amax
284+
kp = isnewmax ? i : kp
285+
amax = isnewmax ? absi : amax
286286
end
287287
ipiv[k] = kp
288288
end

0 commit comments

Comments
 (0)