Skip to content
This repository was archived by the owner on Apr 26, 2021. It is now read-only.

Commit 5d5fff2

Browse files
committed
Fix conjugate of complex Givens
This won't affect the program, as the only time this branch is taken is for Reals, but just added for completeness.
1 parent 7e31a5d commit 5d5fff2

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/utils.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function givens{T}(f::T, g::T, i1::Integer, i2::Integer)
3939
end
4040
c, s, r = Base.LinAlg.givensAlgorithm(f, g)
4141
if i1 > i2
42-
s = -s
42+
s = -conj(s)
4343
i1,i2 = i2,i1
4444
end
4545
Base.LinAlg.Givens(i1, i2, convert(T, c), convert(T, s)), r

test/bigfloat.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,18 @@ bSt = svdfact(bXt)
5959
@test isapprox(full(bSt), bXt, rtol=1e3*eps(BigFloat))
6060
@test isapprox(svdvals(bXt), svdvals(X), rtol=1e3*eps())
6161
@test bXt == X' # check we didn't modify the input
62+
63+
64+
X = Complex128[1 2 0; 0 1 2; 0 0 0]
65+
bX = big(X)
66+
bS = svdfact(bX)
67+
@test isapprox(full(bS), bX, rtol=1e3*eps(BigFloat))
68+
@test isapprox(svdvals(bX), svdvals(X), rtol=1e3*eps())
69+
@test bX == X # check we didn't modify the input
70+
71+
X = Complex128[0 2 0; 0 1 2; 0 0 1]
72+
bX = big(X)
73+
bS = svdfact(bX)
74+
@test isapprox(full(bS), bX, rtol=1e3*eps(BigFloat))
75+
@test isapprox(svdvals(bX), svdvals(X), rtol=1e3*eps())
76+
@test bX == X # check we didn't modify the input

0 commit comments

Comments
 (0)