# [PYTHON MATRIX-SIG] Bug in LinearAlgebra

**tim@lassi.ece.uiuc.edu
**
tim@lassi.ece.uiuc.edu

*Tue, 15 Oct 1996 15:26:45 -0500*

I just found the following bug - appologies if it's allready been
reported and I missed it.
Determinant doestn't work correctly in LinearAlgebra. I think this may
be indicative of a problem in singular value decomposition, but I'm
not sure 'cause my memory of SVDs is fuzzy at best. Here's a case that
doesn't work:
a = Numeric.array([[-1,0,0],[0,1,0],[0,0,1]])
print a
print
print Numeric.LinearAlgebra.determinate(a)
print
================
-1 0 0
0 1 0
0 0 1
1.0
Investigating this further I noted that the eigenvalues were computed
as the product of the diagonal term (s) of the SVD. That seems fine,
since I believe s should be composed of the matrices
eigenvalues. However, when I checked out the value of s for this
simple case I got a suprise:
u, s, vt = Numeric.LinearAlgebra.singular_value_decomposition(a)
print u
print
print s
print
print vt
================
1. 0. 0.
0. 1. 0.
0. 0. 1.
1. 1. 1. # These are not the eigenvalues, where is -1.
-1. 0. 0.
0. 1. 0.
0. 0. 1.
So either a) my memory of how SVD works AND the way determinant is
implemented is wrong, or b) svd is messed up somehow. Someone who
remembers their linear algebra wanna' help me out here?
--
-tim
+--------------------------------------------------------------------+
|* Tim Hochberg Ultrahigh Speed Digital Electronics Lab |
*|* tim@lassi.ece.uiuc.edu University of Illinois |
*|* http://dogbert.ece.uiuc.edu/~tim (217) 333-6014 |
*+--------------------------------------------------------------------+
=================
MATRIX-SIG - SIG on Matrix Math for Python
send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
=================