-
-
Notifications
You must be signed in to change notification settings - Fork 61
Remove ipiv allocation from GenericLUFactorization #618
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
||
y = _ldiv!(cache.u, @get_cacheval(cache, $(Meta.quot(defaultalg_symbol(alg)))), | ||
cache.b) | ||
return SciMLBase.build_linear_solution(alg, y, nothing, cache; retcode = ReturnCode.Success) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
return SciMLBase.build_linear_solution(alg, y, nothing, cache; retcode = ReturnCode.Success) | |
return SciMLBase.build_linear_solution( | |
alg, y, nothing, cache; retcode = ReturnCode.Success) |
|
||
cache.isfresh = false | ||
end | ||
y = ldiv!(cache.u, LinearSolve.@get_cacheval(cache, :GenericLUFactorization)[1], cache.b) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
y = ldiv!(cache.u, LinearSolve.@get_cacheval(cache, :GenericLUFactorization)[1], cache.b) | |
y = ldiv!( | |
cache.u, LinearSolve.@get_cacheval(cache, :GenericLUFactorization)[1], cache.b) |
b8b65a8
to
d51e5d0
Compare
function generic_lufact!(A::AbstractMatrix{T}, pivot::Union{RowMaximum,NoPivot,RowNonZero} = LinearAlgebra.lupivottype(T), | ||
ipiv = Vector{LinearAlgebra.BlasInt}(undef, min(size(A)...)); | ||
check::Bool = true, allowsingular::Bool = false) where {T} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
function generic_lufact!(A::AbstractMatrix{T}, pivot::Union{RowMaximum,NoPivot,RowNonZero} = LinearAlgebra.lupivottype(T), | |
ipiv = Vector{LinearAlgebra.BlasInt}(undef, min(size(A)...)); | |
check::Bool = true, allowsingular::Bool = false) where {T} | |
function generic_lufact!(A::AbstractMatrix{T}, | |
pivot::Union{RowMaximum, NoPivot, RowNonZero} = LinearAlgebra.lupivottype(T), | |
ipiv = Vector{LinearAlgebra.BlasInt}(undef, min(size(A)...)); | |
check::Bool = true, allowsingular::Bool = false) where {T} |
check && LinearAlgebra.LAPACK.chkfinite(A) | ||
# Extract values | ||
m, n = size(A) | ||
minmn = min(m,n) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
minmn = min(m,n) | |
minmn = min(m, n) |
|
||
# Initialize variables | ||
info = 0 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
info = 0 | ||
|
||
@inbounds begin | ||
for k = 1:minmn |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
for k = 1:minmn | |
for k in 1:minmn |
for i = k+1:m | ||
absi = abs(A[i,k]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
for i = k+1:m | |
absi = abs(A[i,k]) | |
for i in (k + 1):m | |
absi = abs(A[i, k]) |
for i = 1:n | ||
tmp = A[k,i] | ||
A[k,i] = A[kp,i] | ||
A[kp,i] = tmp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
for i = 1:n | |
tmp = A[k,i] | |
A[k,i] = A[kp,i] | |
A[kp,i] = tmp | |
for i in 1:n | |
tmp = A[k, i] | |
A[k, i] = A[kp, i] | |
A[kp, i] = tmp |
Akkinv = inv(A[k,k]) | ||
for i = k+1:m | ||
A[i,k] *= Akkinv |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
Akkinv = inv(A[k,k]) | |
for i = k+1:m | |
A[i,k] *= Akkinv | |
Akkinv = inv(A[k, k]) | |
for i in (k + 1):m | |
A[i, k] *= Akkinv |
for j = k+1:n | ||
for i = k+1:m | ||
A[i,j] -= A[i,k]*A[k,j] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
for j = k+1:n | |
for i = k+1:m | |
A[i,j] -= A[i,k]*A[k,j] | |
for j in (k + 1):n | |
for i in (k + 1):m | |
A[i, j] -= A[i, k] * A[k, j] |
info = -info | ||
end | ||
check && LinearAlgebra._check_lu_success(info, allowsingular) | ||
return LinearAlgebra.LU{T,typeof(A),typeof(ipiv)}(A, ipiv, convert(LinearAlgebra.BlasInt, info)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
return LinearAlgebra.LU{T,typeof(A),typeof(ipiv)}(A, ipiv, convert(LinearAlgebra.BlasInt, info)) | |
return LinearAlgebra.LU{T, typeof(A), typeof(ipiv)}( | |
A, ipiv, convert(LinearAlgebra.BlasInt, info)) |
else | ||
generic_lufact!(args...; kwargs...) = LinearAlgebra.generic_lufact!(args...; kwargs...) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
else | |
generic_lufact!(args...; kwargs...) = LinearAlgebra.generic_lufact!(args...; kwargs...) | |
end | |
else | |
generic_lufact!(args...; kwargs...) = LinearAlgebra.generic_lufact!(args...; kwargs...) | |
end |
No description provided.