Skip to content

Bug in out of place ldiv! #577

Closed
Closed
@gragusa

Description

@gragusa

The out-of-place version of ldiv!(Y, A, B) incorrectly overwrite B when A is a factorization of a non square matrix.

using LinearAlgebra
A = [ -3.0  -6.0; 0.0 1.0; 1.0   2.0]
B = [0.0 1.0; 1.0   2.0; 2.0   3.0]
Bc = copy(B)
Y = Array{Float64}(undef, 3,3)
ldiv!(Y, qr(A), B)
Bc == B #false

The problem is in https://github.com/JuliaLang/julia/blob/367aab3dc15a5543bd14c73d1e38a3ce7e310f05/stdlib/LinearAlgebra/src/factorization.jl#L103 where ldiv!(Y, A, B) reduces to a call to ldiv!(A,B) which overwrites B.

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