Skip to content
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

lufact fails for Diagonal, Bidiagonal, and SymTridiagonal #375

Closed
Sacha0 opened this issue Oct 16, 2016 · 2 comments · Fixed by JuliaLang/julia#43700
Closed

lufact fails for Diagonal, Bidiagonal, and SymTridiagonal #375

Sacha0 opened this issue Oct 16, 2016 · 2 comments · Fixed by JuliaLang/julia#43700

Comments

@Sacha0
Copy link
Member

Sacha0 commented Oct 16, 2016

lufact fails for Diagonal, Bidiagonal, and SymTridiagonal matrices. (I realize the former two are in factored form and LDLt is a better choice for SymTridiagonal.) Contrast with qrfact, which succeeds for all such types. (The difference seems to be that qrfact calls similar to construct necessary fully mutable containers, whereas lufact merely copies the input matrix. The fix may be as simple as replacing the copy with similar and an appropriate type computation.) Ref. #136. Best!

julia> VERSION
v"0.6.0-dev.979"

julia> lufact(Diagonal(ones(4)))
ERROR: MethodError: no method matching lufact!(::Diagonal{Float64}, ::Type{Val{true}})
Closest candidates are:
  lufact!{T<:Union{Complex{Float32},Complex{Float64},Float32,Float64}}(::Union{Base.ReshapedArray{T<:Union{Complex{Float32},Complex{Float64},Float32,Float64},2,A<:DenseArray,MI<:Tuple{Vararg{Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64},N}}},DenseArray{T<:Union{Complex{Float32},Complex{Float64},Float32,Float64},2},SubArray{T<:Union{Complex{Float32},Complex{Float64},Float32,Float64},2,A<:Union{Base.ReshapedArray{T,N,A<:DenseArray,MI<:Tuple{Vararg{Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64},N}}},DenseArray},I<:Tuple{Vararg{Union{Base.AbstractCartesianIndex,Colon,Int64,Range{Int64}},N}},L}}, ::Union{Type{Val{false}},Type{Val{true}}}) at linalg/lu.jl:16
  lufact!(::Union{Base.ReshapedArray{T,2,A<:DenseArray,MI<:Tuple{Vararg{Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64},N}}},DenseArray{T,2},SubArray{T,2,A<:Union{Base.ReshapedArray{T,N,A<:DenseArray,MI<:Tuple{Vararg{Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64},N}}},DenseArray},I<:Tuple{Vararg{Union{Base.AbstractCartesianIndex,Colon,Int64,Range{Int64}},N}},L}}, ::Union{Type{Val{false}},Type{Val{true}}}) at linalg/lu.jl:31
  lufact!{T}(::Tridiagonal{T}, ::Union{Type{Val{false}},Type{Val{true}}}) at linalg/lu.jl:261
 in lufact(::Diagonal{Float64}) at ./linalg/lu.jl:81

julia> lufact(Bidiagonal(fill(2, 4), ones(3), true))
ERROR: MethodError: no method matching lufact!(::Bidiagonal{Float64}, ::Type{Val{true}})
Closest candidates are:
  lufact!{T<:Union{Complex{Float32},Complex{Float64},Float32,Float64}}(::Union{Base.ReshapedArray{T<:Union{Complex{Float32},Complex{Float64},Float32,Float64},2,A<:DenseArray,MI<:Tuple{Vararg{Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64},N}}},DenseArray{T<:Union{Complex{Float32},Complex{Float64},Float32,Float64},2},SubArray{T<:Union{Complex{Float32},Complex{Float64},Float32,Float64},2,A<:Union{Base.ReshapedArray{T,N,A<:DenseArray,MI<:Tuple{Vararg{Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64},N}}},DenseArray},I<:Tuple{Vararg{Union{Base.AbstractCartesianIndex,Colon,Int64,Range{Int64}},N}},L}}, ::Union{Type{Val{false}},Type{Val{true}}}) at linalg/lu.jl:16
  lufact!(::Union{Base.ReshapedArray{T,2,A<:DenseArray,MI<:Tuple{Vararg{Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64},N}}},DenseArray{T,2},SubArray{T,2,A<:Union{Base.ReshapedArray{T,N,A<:DenseArray,MI<:Tuple{Vararg{Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64},N}}},DenseArray},I<:Tuple{Vararg{Union{Base.AbstractCartesianIndex,Colon,Int64,Range{Int64}},N}},L}}, ::Union{Type{Val{false}},Type{Val{true}}}) at linalg/lu.jl:31
  lufact!{T}(::Tridiagonal{T}, ::Union{Type{Val{false}},Type{Val{true}}}) at linalg/lu.jl:261
 in lufact(::Bidiagonal{Float64}) at ./linalg/lu.jl:81

julia> lufact(SymTridiagonal(fill(2, 4), ones(3)))
ERROR: MethodError: no method matching lufact!(::SymTridiagonal{Float64}, ::Type{Val{true}})
Closest candidates are:
  lufact!{T<:Union{Complex{Float32},Complex{Float64},Float32,Float64}}(::Union{Base.ReshapedArray{T<:Union{Complex{Float32},Complex{Float64},Float32,Float64},2,A<:DenseArray,MI<:Tuple{Vararg{Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64},N}}},DenseArray{T<:Union{Complex{Float32},Complex{Float64},Float32,Float64},2},SubArray{T<:Union{Complex{Float32},Complex{Float64},Float32,Float64},2,A<:Union{Base.ReshapedArray{T,N,A<:DenseArray,MI<:Tuple{Vararg{Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64},N}}},DenseArray},I<:Tuple{Vararg{Union{Base.AbstractCartesianIndex,Colon,Int64,Range{Int64}},N}},L}}, ::Union{Type{Val{false}},Type{Val{true}}}) at linalg/lu.jl:16
  lufact!(::Union{Base.ReshapedArray{T,2,A<:DenseArray,MI<:Tuple{Vararg{Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64},N}}},DenseArray{T,2},SubArray{T,2,A<:Union{Base.ReshapedArray{T,N,A<:DenseArray,MI<:Tuple{Vararg{Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64},N}}},DenseArray},I<:Tuple{Vararg{Union{Base.AbstractCartesianIndex,Colon,Int64,Range{Int64}},N}},L}}, ::Union{Type{Val{false}},Type{Val{true}}}) at linalg/lu.jl:31
  lufact!{T}(::Tridiagonal{T}, ::Union{Type{Val{false}},Type{Val{true}}}) at linalg/lu.jl:261
 in lufact(::SymTridiagonal{Float64}) at ./linalg/lu.jl:81
@andyferris
Copy link
Member

Also, the matrices in StaticArrays.jl fail for lufact. Besides the inconsistent use of similar, I'm also see a problem that the LU container won't accept a vector container other than Vector, which seems too specific (compare with Eig).

@andreasnoack
Copy link
Member

For most of the problems mentioned here, I think that using similar would be sufficient. It wouldn't help for the problems that @andyferris mentions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants