Skip to content

Commit

Permalink
Fix Schur Factorization for 0x0 matrices (#23360)
Browse files Browse the repository at this point in the history
Fixes #23359

(cherry picked from commit db88dd1)
  • Loading branch information
andreasnoack authored and ararslan committed Sep 15, 2017
1 parent ea8810f commit 3f9f868
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
28 changes: 14 additions & 14 deletions base/linalg/lapack.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5479,13 +5479,13 @@ for (gees, gges, elty) in
# $ WR( * )
function gees!(jobvs::Char, A::StridedMatrix{$elty})
chkstride1(A)
n = checksquare(A)
sdim = Vector{BlasInt}(1)
wr = similar(A, $elty, n)
wi = similar(A, $elty, n)
ldvs = jobvs == 'V' ? n : 1
vs = similar(A, $elty, ldvs, n)
work = Vector{$elty}(1)
n = checksquare(A)
sdim = Vector{BlasInt}(1)
wr = similar(A, $elty, n)
wi = similar(A, $elty, n)
vs = similar(A, $elty, jobvs == 'V' ? n : 0, n)
ldvs = max(size(vs, 1), 1)
work = Vector{$elty}(1)
lwork = BlasInt(-1)
info = Ref{BlasInt}()
for i = 1:2
Expand Down Expand Up @@ -5572,13 +5572,13 @@ for (gees, gges, elty, relty) in
# COMPLEX*16 A( LDA, * ), VS( LDVS, * ), W( * ), WORK( * )
function gees!(jobvs::Char, A::StridedMatrix{$elty})
chkstride1(A)
n = checksquare(A)
sort = 'N'
sdim = BlasInt(0)
w = similar(A, $elty, n)
ldvs = jobvs == 'V' ? n : 1
vs = similar(A, $elty, ldvs, n)
work = Vector{$elty}(1)
n = checksquare(A)
sort = 'N'
sdim = BlasInt(0)
w = similar(A, $elty, n)
vs = similar(A, $elty, jobvs == 'V' ? n : 1, n)
ldvs = max(size(vs, 1), 1)
work = Vector{$elty}(1)
lwork = BlasInt(-1)
rwork = Vector{$relty}(n)
info = Ref{BlasInt}()
Expand Down
6 changes: 6 additions & 0 deletions test/linalg/schur.jl
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,10 @@ aimg = randn(n,n)/2
@test NS[:Z] sZ
end
end
@testset "0x0 matrix" for A in (zeros(eltya, 0, 0), view(rand(eltya, 2, 2), 1:0, 1:0))
T, Z, λ = Base.LinAlg.schur(A)
@test T == A
@test Z == A
@test λ == zeros(0)
end
end

0 comments on commit 3f9f868

Please sign in to comment.