Skip to content

Commit

Permalink
restrict LU to Matrix
Browse files Browse the repository at this point in the history
It used to be AbstractMatrix, but the algorithm assumes the rows and cols
are 1:n, so restricting to Matrix avoids any problem with that.
  • Loading branch information
rmsrosa committed Jun 13, 2022
1 parent 4f900c9 commit 900edf5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/UnitfulBuckinghamPi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ function parameterdimensionmatrix()
end

"""
lu_pq(A::AbstractMatrix)
lu_pq(A::Matrix)
Compute the LU factorization of `A` with full pivoting.
Expand Down Expand Up @@ -299,7 +299,7 @@ First Edition, SIAM, 1997.
[^pinv]: [LinearAlgebra.pinv](https://github.com/JuliaLang/julia/blob/master/stdlib/LinearAlgebra/src/dense.jl#L1362)
"""
function lu_pq(A::AbstractMatrix{T}) where T <: Number
function lu_pq(A::Matrix{T}) where T <: Number
tol = T <: Rational ? 0//1 : min(size(A)...)*eps(real(float(one(T))))
U = copy(A)
(n,m) = size(U)
Expand All @@ -324,8 +324,8 @@ function lu_pq(A::AbstractMatrix{T}) where T <: Number
end
return (L=L, U=U, p=p, q=q)
end
lu_pq(A::AbstractMatrix{T}) where T <: Integer = lu_pq(float(A))
lu_pq(A::AbstractMatrix{Complex{T}}) where T <: Integer = lu_pq(convert.(float(Complex{Int}),A))
lu_pq(A::Matrix{T}) where T <: Integer = lu_pq(float(A))
lu_pq(A::Matrix{Complex{T}}) where T <: Integer = lu_pq(convert.(float(Complex{Int}),A))

"""
lu_nullspace(mat)
Expand Down

0 comments on commit 900edf5

Please sign in to comment.