diff --git a/Project.toml b/Project.toml index fa4a80fa2..1620a7f71 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "LinearSolve" uuid = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae" -version = "5.10.0" +version = "5.10.1" authors = ["SciML"] [deps] diff --git a/src/blocked_lufact.jl b/src/blocked_lufact.jl index 470c9a9d8..113a84b3d 100644 --- a/src/blocked_lufact.jl +++ b/src/blocked_lufact.jl @@ -53,9 +53,7 @@ end return kp, amax end -# Unblocked factorization for the whole matrix at small sizes. Identical -# control flow to the scalar `generic_lufact!` RowMaximum path, with hoisted -# multipliers, `muladd`, and `@simd ivdep` on the column updates. +# Keep small factorizations identical to the scalar `generic_lufact!` RowMaximum path. function _blocked_lu_unblocked!(A::AbstractMatrix{T}, ipiv, m::Int, n::Int) where {T} minmn = min(m, n) info = 0 @@ -79,8 +77,8 @@ function _blocked_lu_unblocked!(A::AbstractMatrix{T}, ipiv, m::Int, n::Int) wher end for j in (k + 1):n Akj = A[k, j] - @simd ivdep for i in (k + 1):m - A[i, j] = muladd(-A[i, k], Akj, A[i, j]) + for i in (k + 1):m + A[i, j] -= A[i, k] * Akj end end end diff --git a/test/Core/blocked_lufact.jl b/test/Core/blocked_lufact.jl index 79aafa674..a087931fa 100644 --- a/test/Core/blocked_lufact.jl +++ b/test/Core/blocked_lufact.jl @@ -41,6 +41,17 @@ end @test !endswith(String(m_generic.file), "blocked_lufact.jl") end + @testset "small path matches scalar arithmetic" begin + A = randn(MersenneTwister(1234), 4, 4) + F = LinearSolve.generic_lufact!(copy(A), RowMaximum(), _ipiv(4); check = false) + A_scalar_dispatch = @view copy(A)[:, [1, 2, 3, 4]] + F_scalar = LinearSolve.generic_lufact!( + A_scalar_dispatch, RowMaximum(), _ipiv(4); check = false + ) + @test F.factors == F_scalar.factors + @test F.ipiv == F_scalar.ipiv + end + @testset "residual, square, default params ($T)" for T in (Float64, Float32) for n in ( 1, 2, 3, 5, 7, 8, 9, 13, 16, 17, 31, 32, 33, 40, 41, 63, 64, 65,