Skip to content

three-arg mul! with Q factor of type LinearAlgebra.QRCompactWYQ is wrong #725

@Jutho

Description

@Jutho

Test:

using LinearAlgebra
A = randn(11,10);
Q, R = qr(A);
X = randn(11,10);
mul!(X, Q, R);
norm(X-A)

the problem is with this implementation:
https://github.com/JuliaLang/julia/blob/master/stdlib/LinearAlgebra/src/qr.jl#L752

mul!(C::StridedVecOrMat{T}, Q::AbstractQ{T}, B::StridedVecOrMat{T}) where {T} = lmul!(Q, copyto!(C, B))

This is only correct if C and B are of the same size, which here they are not.
The same holds for the other combinations (i.e. the methods on the lines below).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions