Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
test/Manifest.toml
Manifest.toml
docs/build
.vscode/
25 changes: 4 additions & 21 deletions src/utils.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
struct NotImplementedError <: Exception
struct NotImplementedError <: Exception
msg::String
end

Expand All @@ -10,7 +10,7 @@ end
"""
maxdiff(a, b)

Get the maximum difference between vectors. Equivalent to the infinity norm of the
Get the maximum difference between vectors. Equivalent to the infinity norm of the
difference, but avoids forming the temporary difference vector.
"""
function maxdiff(a, b)
Expand All @@ -27,26 +27,9 @@ using LinearAlgebra.BLAS: @blasfunc
@static if VERSION < v"1.7"
const libblas = LinearAlgebra.LAPACK.liblapack
else
const libblas = LinearAlgebra.LAPACK.libblastrampoline
end
for (getrf,elty) in ((:dgetrf_, :Float64), (:sgetrf, :Float32))
@eval begin
function LinearAlgebra.LAPACK.getrf!(A::AbstractMatrix{$elty}, ipiv::AbstractVector{BlasInt})
LinearAlgebra.require_one_based_indexing(A)
LinearAlgebra.chkstride1(A)
m, n = size(A)
@assert length(ipiv) == min(m, n)
lda = max(1,stride(A, 2))
info = Ref{BlasInt}()
ccall((@blasfunc($getrf), libblas), Cvoid,
(Ref{BlasInt}, Ref{BlasInt}, Ptr{$elty},
Ref{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}),
m, n, A, lda, ipiv, info)
LAPACK.chkargsok(info[])
A, ipiv, info[] #Error code is stored in LU factorization type
end
end
const libblas = LinearAlgebra.LAPACK.libblastrampoline
end

function LinearAlgebra.lu!(A::StridedMatrix{T}, ipiv::AbstractVector{BlasInt}; check::Bool=true) where T
lpt = LAPACK.getrf!(A, ipiv)
check && LinearAlgebra.checknonsingular(lpt[3])
Expand Down