@@ -3,11 +3,9 @@ using TriangularSolve: ldiv!
3
3
using LinearAlgebra: BlasInt, BlasFloat, LU, UnitLowerTriangular, checknonsingular, BLAS,
4
4
LinearAlgebra, Adjoint, Transpose, UpperTriangular, AbstractVecOrMat
5
5
using StrideArraysCore
6
+ using StrideArraysCore: square_view
6
7
using Polyester: @batch
7
8
8
- @generated function _unit_lower_triangular (B:: A ) where {T, A <: AbstractMatrix{T} }
9
- Expr (:new , UnitLowerTriangular{T, A}, :B )
10
- end
11
9
# 1.7 compat
12
10
normalize_pivot (t:: Val{T} ) where {T} = t
13
11
to_stdlib_pivot (t) = t
55
53
if CUSTOMIZABLE_PIVOT
56
54
function LinearAlgebra. ldiv! (A:: LU{T, <:StridedMatrix, <:NotIPIV} ,
57
55
B:: StridedVecOrMat{T} ) where {T <: BlasFloat }
56
+ tri = @inbounds square_view (A. factors, size (A. factors, 1 ))
58
57
ldiv! (UpperTriangular (A. factors), ldiv! (UnitLowerTriangular (A. factors), B))
59
58
end
60
59
end
@@ -138,10 +137,10 @@ end
138
137
info = reckernel! (A, Val (Pivot), m, mnmin, ipiv, info, blocksize, Val (Thread)):: Int
139
138
@inbounds if m < n # fat matrix
140
139
# [AL AR]
141
- AL = @view A[:, 1 : m]
140
+ AL = square_view (A, m)
142
141
AR = @view A[:, (m + 1 ): n]
143
142
Pivot && apply_permutation! (ipiv, AR, Val {Thread} ())
144
- ldiv! (_unit_lower_triangular (AL), AR, Val {Thread} ())
143
+ ldiv! (UnitLowerTriangular (AL), AR, Val {Thread} ())
145
144
end
146
145
info
147
146
end
@@ -190,7 +189,7 @@ function reckernel!(A::AbstractMatrix{T}, pivot::Val{Pivot}, m, n, ipiv, info, b
190
189
191
190
# ======================================== #
192
191
# Now, our LU process looks like this
193
- # [ P1 ] [ A11 A21 ] [ L11 0 ] [ U11 U12 ]
192
+ # [ P1 ] [ A11 A12 ] [ L11 0 ] [ U11 U12 ]
194
193
# [ ] [ ] = [ ] [ ]
195
194
# [ P2 ] [ A21 A22 ] [ L21 I ] [ 0 A′22 ]
196
195
# ======================================== #
@@ -203,7 +202,7 @@ function reckernel!(A::AbstractMatrix{T}, pivot::Val{Pivot}, m, n, ipiv, info, b
203
202
# AL AR
204
203
# [A11 A12]
205
204
# [A21 A22]
206
- A11 = @view A[ 1 : n1, 1 : n1]
205
+ A11 = square_view (A, n1)
207
206
A12 = @view A[1 : n1, (n1 + 1 ): n]
208
207
A21 = @view A[(n1 + 1 ): m, 1 : n1]
209
208
A22 = @view A[(n1 + 1 ): m, (n1 + 1 ): n]
@@ -223,7 +222,7 @@ function reckernel!(A::AbstractMatrix{T}, pivot::Val{Pivot}, m, n, ipiv, info, b
223
222
# [ A22 ] [ 0 ] [ A22 ]
224
223
Pivot && apply_permutation! (P1, AR, thread)
225
224
# A12 = L11 U12 => U12 = L11 \ A12
226
- ldiv! (_unit_lower_triangular (A11), A12, thread)
225
+ ldiv! (UnitLowerTriangular (A11), A12, thread)
227
226
# Schur complement:
228
227
# We have A22 = L21 U12 + A′22, hence
229
228
# A′22 = A22 - L21 U12
0 commit comments