# [Fwd: RE: [Fwd: query regarding output of jama svd]]

• Subject: [Fwd: RE: [Fwd: query regarding output of jama svd]]
• From: Ron Boisvert <boisvert@nist.gov>
• Date: Fri, 26 Oct 2007 13:27:06 -0400
• Content-Transfer-Encoding: 7bit
• Content-Type: text/plain; charset=ISO-8859-1; format=flowed
• User-Agent: Thunderbird 2.0.0.6 (Windows/20070728)

```Sender: "Cleve Moler" <Cleve.Moler@mathworks.com>
Subject: RE: [Fwd: query regarding output of jama svd]

>From April, 2006

Consider the real 1-by-1 case.  The 1-by-1 real orthogonal matrices are
[1] and [-1].  The 1-by-1 matrix [5] has two singular value
decompositions

5 = 1*5*1 = (-1)*5*(-1)

I'll leave it to the reader to generalize this to complex n-by-n
matrices.
-- Cleve Moler

-----Original Message-----
From: jama@nist.gov [mailto:jama@nist.gov] On Behalf Of Ron Boisvert
Sent: Friday, October 26, 2007 7:26 AM
To: Multiple recipients of list
Subject: [Fwd: query regarding output of jama svd]

-------- Original Message --------
Subject: 	query regarding output of jama svd
Date: 	Fri, 26 Oct 2007 01:05:46 -0400
From: 	Jundy Raga <jundy.raga@gmail.com>
To: 	jama@nist.gov

Greetings to everyone...

Just want to inquire regarding a problem I encountered while using the
SVD class of JAMA. I noticed that when the SVD class generates
the corresponding matrix decomposition some of the cell values generated

have mixed-up negative/positive values (meaning some values which are
supposed to be negative are returned as positive and vice-versa). This
occurred in both matrix u and v (i.e., on the first column of U and
first row of V), the S matrix however is fine.

I became aware of this when I multiplied the generated decomposition
matrix (without dimension reduction) and I was not able to acquire the
initial input matrix. later on I used an online matrix calculator to
process my input matrix and compared the result of Jama SVD with its
output. The results are indeed different, but when I remultiplied the
USV matrices generated by the online matrix calculator
(http://www.bluebit.gr/matrix-calculator/) it was able to generate the
input matrix. below is the input matrix I used:

1 0 0 1 0 0 0 0 0
1 0 1 0 0 0 0 0 0
1 1 0 0 0 0 0 0 0
0 1 1 0 1 0 0 0 0
0 1 1 2 0 0 0 0 0
0 1 0 0 1 0 0 0 0
0 1 0 0 1 0 0 0 0
0 0 1 1 0 0 0 0 0
0 1 0 0 0 0 0 0 1
0 0 0 0 0 1 1 1 0
0 0 0 0 0 0 1 1 1
0 0 0 0 0 0 0 1 1

below are the output of the online matrix calculator for the matrix U

-0.221 -0.113  0.289 -0.415 -0.106 -0.341 -0.523  0.060  0.407
-0.198 -0.072  0.135 -0.552  0.282  0.496  0.070  0.010  0.109
-0.240  0.043 -0.164 -0.595 -0.107 -0.255  0.302 -0.062 -0.492
-0.404  0.057 -0.338
0.099  0.332  0.385 -0.003  0.000 -0.012
-0.644 -0.167  0.361  0.333 -0.159 -0.207  0.166 -0.034 -0.271
-0.265  0.107 -0.426  0.074  0.080 -0.170 -0.283  0.016  0.054
-0.265  0.107 -0.426  0.074  0.080 -0.170 -
0.283  0.016  0.054
-0.301 -0.141  0.330  0.188  0.115  0.272 -0.033  0.019  0.165
-0.206  0.274 -0.178 -0.032 -0.537  0.081  0.467  0.036  0.579
-0.013  0.490  0.231  0.025  0.594 -0.392  0.288 -0.255  0.225

-0.036  0.623  0.223  0.001 -0.068  0.115 -0.160  0.681 -0.232
-0.032  0.451  0.141 -0.009 -0.300  0.277 -0.339 -0.678 -0.183

while below are the output of the JAMA SVD for the matrix U
0.221    -0.113    0.289     -0.415    -0.106    -0.341     0.523
-0.060     0.407
0.198    -0.072     0.135    -0.552     0.282     0.496    -0.070
-0.010     0.109
0.240     0.043    -0.164    -0.595    -0.107    -0.255    -0.302
0.062    -0.492
0.404     0.057    -0.338     0.099     0.332     0.385     0.003
-0.000    -0.012
0.644    -0.167     0.361     0.333    -0.159    -0.207    -0.166
0.034    -0.271
0.265     0.107    -0.426     0.074     0.080    -0.170     0.283
-0.016     0.054
0.265     0.107    -0.426     0.074     0.080    -0.170     0.283
-0.016     0.054
0.301    -0.141     0.330     0.188     0.115     0.272     0.033
-0.019     0.165
0.206     0.274    -0.178    -0.032    -0.537     0.081    -0.467
-0.036     0.579
0.013     0.490     0.231     0.025     0.594    -0.392    -0.288
0.255     0.225
0.036     0.623     0.223     0.001    -0.068     0.115     0.160
-0.681    -0.232
0.032     0.451     0.141    -0.009    -0.300     0.277     0.339
0.678    -0.183

notice the different signs for the first column, the same difference can

also be observed on the V matrix. Would just like to ask if this is a
real flaw of JAMA or am I just doing something wrong.

hope somebody can help me on this.
--
==================================================================
"The only necessary thing for the triumph of evil is for good men to do
nothing."
-Edmund Burke-
============ http://jundyraga.blogs.friendster.com/jundys_blog/
=============

```

Date Index | Thread Index | Problems or questions? Contact list-master@nist.gov