diff --git a/src/lapack.jl b/src/lapack.jl index 001cfc82..79455bc5 100644 --- a/src/lapack.jl +++ b/src/lapack.jl @@ -6135,10 +6135,11 @@ for (ormhr, elty) in chkside(side) chktrans(trans) n = checksquare(A) + ntau = length(tau) mC, nC = size(C, 1), size(C, 2) - if n - length(tau) != 1 - throw(DimensionMismatch(lazy"tau has length $(length(tau)), needs $(n - 1)")) + if max(n - 1, 0) != ntau + throw(DimensionMismatch(lazy"tau has length $ntau, needs $(n - 1)")) end if (side == 'L' && mC != n) || (side == 'R' && nC != n) throw(DimensionMismatch("A and C matrices are not conformable")) diff --git a/test/hessenberg.jl b/test/hessenberg.jl index 91f6d155..8485c014 100644 --- a/test/hessenberg.jl +++ b/test/hessenberg.jl @@ -286,4 +286,11 @@ end end end +@testset "multiplication with empty HessenbergQ" begin + @test ones(2, 0)*hessenberg(zeros(0,0)).Q == zeros(2,0) + @test_throws DimensionMismatch ones(2, 1)*hessenberg(zeros(0,0)).Q + @test hessenberg(zeros(0,0)).Q * ones(0, 2) == zeros(0,2) + @test_throws DimensionMismatch hessenberg(zeros(0,0)).Q * ones(1, 2) +end + end # module TestHessenberg