@@ -22,19 +22,33 @@ function lu(A::AbstractMatrix, pivot = Val(true), thread = Val(true); kwargs...)
2222 return lu! (copy (A), normalize_pivot (pivot), thread; kwargs... )
2323end
2424
25- struct NotIPIV <: AbstractVector{BlasInt} len:: Int end
25+ struct NotIPIV <: AbstractVector{BlasInt}
26+ len:: Int
27+ end
2628Base. size (A:: NotIPIV ) = (A. len,)
2729Base. getindex (:: NotIPIV , i:: Int ) = i
2830Base. view (:: NotIPIV , r:: AbstractUnitRange ) = NotIPIV (length (r))
2931init_pivot (:: Val{false} , minmn) = NotIPIV (minmn)
3032init_pivot (:: Val{true} , minmn) = Vector {BlasInt} (undef, minmn)
3133
34+ if isdefined (LinearAlgebra, :_ipiv_cols! )
35+ function LinearAlgebra. _ipiv_cols! (:: LU{<:Any, <:Any, NotIPIV} , :: OrdinalRange ,
36+ B:: StridedVecOrMat )
37+ return B
38+ end
39+ end
40+ if isdefined (LinearAlgebra, :_ipiv_rows! )
41+ function LinearAlgebra. _ipiv_rows! (:: LU{<:Any, <:Any, NotIPIV} , :: OrdinalRange ,
42+ B:: StridedVecOrMat )
43+ return B
44+ end
45+ end
3246
3347function lu! (A, pivot = Val (true ), thread = Val (true ); check = true , kwargs... )
3448 m, n = size (A)
3549 minmn = min (m, n)
3650 # we want the type on both branches to match. When pivot = Val(false), we construct
37- # a `NotIPIV`, which `LinearAlgebra.generic_lufact!` does not.
51+ # a `NotIPIV`, which `LinearAlgebra.generic_lufact!` does not.
3852 F = if pivot === Val (true ) && minmn < 10 # avx introduces small performance degradation
3953 LinearAlgebra. generic_lufact! (A, to_stdlib_pivot (pivot); check = check)
4054 else
102116 # [AL AR]
103117 AL = @view A[:, 1 : m]
104118 AR = @view A[:, (m + 1 ): n]
105- apply_permutation! (ipiv, AR, Val ( Thread))
106- ldiv! (_unit_lower_triangular (AL), AR, Val ( Thread))
119+ apply_permutation! (ipiv, AR, Val { Thread} ( ))
120+ ldiv! (_unit_lower_triangular (AL), AR, Val { Thread} ( ))
107121 end
108122 info
109123end
0 commit comments