Skip to content

ldiv! ambiguous for fully blocked problem #319

Open
@termi-official

Description

@termi-official

MWE on Julia 1.9.3 with latest release

julia> mortar(reshape([spdiagm([1.0,1.0]), spzeros(2,2), spzeros(2,2), spdiagm([1.0,1.0])], 2,2)) \ Vector(mortar([[1.0,1.0],[1.0,1.0]]))
4-element Vector{Float64}:
 1.0
 1.0
 1.0
 1.0

julia> mortar(reshape([spdiagm([1.0,1.0]), spzeros(2,2), spzeros(2,2), spdiagm([1.0,1.0])], 2,2)) \ mortar([[1.0,1.0],[1.0,1.0]])
ERROR: MethodError: ldiv!(::LinearAlgebra.QRCompactWY{Float64, Matrix{Float64}, Matrix{Float64}}, ::PseudoBlockVector{Float64, Vector{Float64}, Tuple{BlockedUnitRange{Vector{Int64}}}}) is ambiguous.

Candidates:
  ldiv!(A::LinearAlgebra.QRCompactWY{T, M, C} where {M<:AbstractMatrix{T}, C<:AbstractMatrix{T}}, b::AbstractVector{T}) where T<:Union{Float32, Float64, ComplexF32, ComplexF64}
    @ LinearAlgebra ~/Tools/julia-1.9.3/share/julia/stdlib/v1.9/LinearAlgebra/src/qr.jl:873
  ldiv!(A::LinearAlgebra.QRCompactWY, x::ArrayLayouts.LayoutVector; kwds...)
    @ ArrayLayouts ~/.julia/packages/ArrayLayouts/RwIbZ/src/ldiv.jl:153
  ldiv!(A::LinearAlgebra.Factorization, x::ArrayLayouts.LayoutVector; kwds...)
    @ ArrayLayouts ~/.julia/packages/ArrayLayouts/RwIbZ/src/ldiv.jl:150

Possible fix, define
  ldiv!(::LinearAlgebra.QRCompactWY{T, M, C} where {M<:AbstractMatrix{T}, C<:AbstractMatrix{T}}, ::ArrayLayouts.LayoutVector{T}) where T<:Union{Float32, Float64, ComplexF32, ComplexF64}

Stacktrace:
  [1] ldiv!(Y::PseudoBlockVector{Float64, Vector{Float64}, Tuple{BlockedUnitRange{Vector{Int64}}}}, A::LinearAlgebra.QRCompactWY{Float64, Matrix{Float64}, Matrix{Float64}}, B::BlockVector{Float64, Vector{Vector{Float64}}, Tuple{BlockedUnitRange{Vector{Int64}}}})
    @ LinearAlgebra ~/Tools/julia-1.9.3/share/julia/stdlib/v1.9/LinearAlgebra/src/factorization.jl:126
  [2] #_ldiv!#17
    @ ~/.julia/packages/ArrayLayouts/RwIbZ/src/ldiv.jl:84 [inlined]
  [3] _ldiv!
    @ ~/.julia/packages/ArrayLayouts/RwIbZ/src/ldiv.jl:84 [inlined]
  [4] copyto!(dest::PseudoBlockVector{Float64, Vector{Float64}, Tuple{BlockedUnitRange{Vector{Int64}}}}, M::ArrayLayouts.Ldiv{ArrayLayouts.QRCompactWYLayout{ArrayLayouts.DenseColumnMajor, ArrayLayouts.DenseColumnMajor}, BlockArrays.BlockLayout{ArrayLayouts.DenseColumnMajor, ArrayLayouts.DenseColumnMajor}, LinearAlgebra.QRCompactWY{Float64, Matrix{Float64}, Matrix{Float64}}, BlockVector{Float64, Vector{Vector{Float64}}, Tuple{BlockedUnitRange{Vector{Int64}}}}}; kwds::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ ArrayLayouts ~/.julia/packages/ArrayLayouts/RwIbZ/src/ldiv.jl:113
  [5] copyto!
    @ ~/.julia/packages/ArrayLayouts/RwIbZ/src/ldiv.jl:113 [inlined]
  [6] #ldiv!#24
    @ ~/.julia/packages/ArrayLayouts/RwIbZ/src/ldiv.jl:104 [inlined]
  [7] ldiv!
    @ ~/.julia/packages/ArrayLayouts/RwIbZ/src/ldiv.jl:104 [inlined]
  [8] #_ldiv!#16
    @ ~/.julia/packages/ArrayLayouts/RwIbZ/src/ldiv.jl:83 [inlined]
  [9] _ldiv!
    @ ~/.julia/packages/ArrayLayouts/RwIbZ/src/ldiv.jl:83 [inlined]
 [10] #copyto!#27
    @ ~/.julia/packages/ArrayLayouts/RwIbZ/src/ldiv.jl:113 [inlined]
 [11] copyto!
    @ ~/.julia/packages/ArrayLayouts/RwIbZ/src/ldiv.jl:113 [inlined]
 [12] #copy#12
    @ ~/.julia/packages/ArrayLayouts/RwIbZ/src/ldiv.jl:21 [inlined]
 [13] copy
    @ ~/.julia/packages/ArrayLayouts/RwIbZ/src/ldiv.jl:21 [inlined]
 [14] #materialize#13
    @ ~/.julia/packages/ArrayLayouts/RwIbZ/src/ldiv.jl:22 [inlined]
 [15] materialize
    @ ~/.julia/packages/ArrayLayouts/RwIbZ/src/ldiv.jl:22 [inlined]
 [16] #ldiv#20
    @ ~/.julia/packages/ArrayLayouts/RwIbZ/src/ldiv.jl:98 [inlined]
 [17] ldiv
    @ ~/.julia/packages/ArrayLayouts/RwIbZ/src/ldiv.jl:98 [inlined]
 [18] \(A::BlockMatrix{Float64, Matrix{SparseMatrixCSC{Float64, Int64}}, Tuple{BlockedUnitRange{Vector{Int64}}, BlockedUnitRange{Vector{Int64}}}}, x::BlockVector{Float64, Vector{Vector{Float64}}, Tuple{BlockedUnitRange{Vector{Int64}}}}; kwds::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ ArrayLayouts ~/.julia/packages/ArrayLayouts/RwIbZ/src/ldiv.jl:199
 [19] \(A::BlockMatrix{Float64, Matrix{SparseMatrixCSC{Float64, Int64}}, Tuple{BlockedUnitRange{Vector{Int64}}, BlockedUnitRange{Vector{Int64}}}}, x::BlockVector{Float64, Vector{Vector{Float64}}, Tuple{BlockedUnitRange{Vector{Int64}}}})
    @ ArrayLayouts ~/.julia/packages/ArrayLayouts/RwIbZ/src/ldiv.jl:199
 [20] top-level scope
    @ REPL[17]:1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions