Skip to content

Overly restrictive type constraints in LinearAlgebra #713

@YingboMa

Description

@YingboMa

Many functions in LinearAlgebra have the ::StridedVecOrMat constraint. In many cases, it seems unnecessary. Just to list a few:

https://github.com/JuliaLang/julia/blob/8a5b3233a1fad479ed417345fc2b9de0a5d23c1d/stdlib/LinearAlgebra/src/lu.jl#L394-L397
https://github.com/JuliaLang/julia/blob/8a5b3233a1fad479ed417345fc2b9de0a5d23c1d/stdlib/LinearAlgebra/src/lu.jl#L339-L389

This causes problems like

julia> using LinearAlgebra
julia> A = rand(3, 3); x = rand(3)';
julia> ldiv!(lu(A), vec(x))
ERROR: MethodError: no method matching ldiv!(::LU{Float64,Array{Float64,2}}, ::Base.ReshapedArray{Float64,1,Adjoint{Float64,Array{Float64,1}},Tuple{}})

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