Hi All, 

I have a pretty easy question about how/why the svd() behaves how it does. 

Why are my U and V matrices always a factor of -1 from the textbook 
examples? I'm just getting my feet wet with all this, so I wanted to check 
what the function returns vs what the textbook says the answers would be, 
and it looks like it's always off by negative one. 

julia> A = [1 2 ; 2 2; 2 1]
3x2 Array{Int64,2}:
 1  2
 2  2
 2  1

julia> U, s, V = svd(A, thin=false)
(
3x3 Array{Float64,2}:
 -0.514496   0.707107   0.485071
 -0.685994   0.0       -0.727607
 -0.514496  -0.707107   0.485071,

[4.123105625617661,0.9999999999999999],
2x2 Array{Float64,2}:
 -0.707107  -0.707107
 -0.707107   0.707107)


text book shows the 1,1 entry of U to be 
julia> 3/sqrt(34)
0.5144957554275265

without a negtive sign. really just all the negative signs are reversed. 
source: http://www.math.iit.edu/~fass/477577_Chapter_2.pdf

2nd example:
julia> A = [3 2 -2 ; 2 3 -2]
2x3 Array{Int64,2}:
 3  2  -2
 2  3  -2

julia> U, s, V = svd(A, thin=false)
(
2x2 Array{Float64,2}:
 -0.707107  -0.707107
 -0.707107   0.707107,

[5.744562646538029,1.0],
3x3 Array{Float64,2}:
 -0.615457  -0.707107     0.348155
 -0.615457   0.707107     0.348155
  0.492366   5.55112e-17  0.870388)

which is U and V are negative
http://www.d.umn.edu/~mhampton/m4326svd_example.pdf

So did I just get back luck with example problems? I feel like it's 
probably just a difference in convention or something, but figured I would 
ask for a definitive answer. Thank you for any help

Reply via email to