Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions src/lu.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,20 @@ end

# the following method is meant to catch calls to lu!(A::LAPACKArray) without a pivoting strategy
lu!(A::StridedMatrix{<:BlasFloat}; check::Bool = true, allowsingular::Bool = false) = lu!(A, RowMaximum(); check, allowsingular)
function lu!(A::StridedMatrix{T}, ::RowMaximum; check::Bool = true, allowsingular::Bool = false) where {T<:BlasFloat}
lpt = LAPACK.getrf!(A; check)
function lu!(A::StridedMatrix{T}, ::RowMaximum,ipiv::AbstractVector{BlasInt} = Vector{BlasInt}(undef,min(size(A)...)); check::Bool = true, allowsingular::Bool = false) where {T<:BlasFloat}
lpt = LAPACK.getrf!(A, ipiv; check)
check && _check_lu_success(lpt[3], allowsingular)
return LU{T,typeof(lpt[1]),typeof(lpt[2])}(lpt[1], lpt[2], lpt[3])
end
function lu!(A::HermOrSym{T}, pivot::Union{RowMaximum,NoPivot,RowNonZero} = lupivottype(T);
function lu!(A::HermOrSym{T}, pivot::Union{RowMaximum,NoPivot,RowNonZero} = lupivottype(T), ipiv::AbstractVector{BlasInt} = Vector{BlasInt}(undef,min(size(A)...));
check::Bool = true, allowsingular::Bool = false) where {T}
copytri!(A.data, A.uplo, isa(A, Hermitian))
@inbounds if isa(A, Hermitian) # realify diagonal
for i in axes(A, 1)
A.data[i,i] = A[i,i]
end
end
lu!(A.data, pivot; check, allowsingular)
lu!(A.data, pivot, ipiv; check, allowsingular)
end
# for backward compatibility
# TODO: remove towards Julia v2
Expand Down Expand Up @@ -147,9 +147,9 @@ Stacktrace:
[...]
```
"""
lu!(A::AbstractMatrix, pivot::Union{RowMaximum,NoPivot,RowNonZero} = lupivottype(eltype(A));
check::Bool = true, allowsingular::Bool = false) = generic_lufact!(A, pivot; check, allowsingular)
function generic_lufact!(A::AbstractMatrix{T}, pivot::Union{RowMaximum,NoPivot,RowNonZero} = lupivottype(T);
lu!(A::AbstractMatrix, pivot::Union{RowMaximum,NoPivot,RowNonZero} = lupivottype(eltype(A)), ipiv::AbstractVector{BlasInt} = Vector{BlasInt}(undef,min(size(A)...));
check::Bool = true, allowsingular::Bool = false) = generic_lufact!(A, pivot, ipiv; check, allowsingular)
function generic_lufact!(A::AbstractMatrix{T}, pivot::Union{RowMaximum,NoPivot,RowNonZero} = lupivottype(T), ipiv::AbstractVector{BlasInt} = Vector{BlasInt}(undef,min(size(A)...));
check::Bool = true, allowsingular::Bool = false) where {T}
check && LAPACK.chkfinite(A)
# Extract values
Expand All @@ -158,7 +158,6 @@ function generic_lufact!(A::AbstractMatrix{T}, pivot::Union{RowMaximum,NoPivot,R

# Initialize variables
info = 0
ipiv = Vector{BlasInt}(undef, minmn)
@inbounds begin
for k = 1:minmn
# find index max
Expand Down