473,372 Members | 1,033 Online

# numarray.linear_algebra.eigenvectors bug ?

Hi all,
I need eigen values and vectors for symmetric matrices (like VCV).
Solving with numarray and testing the results, I've got
strange results - input and output matrices of some sizes are
very different. That's an example of differencies:

Size MaxDif(E.Val) MaxDif(E.Vect)
2 0 1.110223e-016
3 1.776357e-015 2.053913e-015
10 1.221245e-015 7.255307e-014
11 3.552714e-015 0.8455322
12 1.526557e-016 1.345035e-013
13 8.881784e-016 0.7796273
14 2.775558e-016 0.7504375
15 2.331468e-015 2.045031e-013

This is for numarray 0.7 on W2K.
I hoped to have all the differencies below 1e-15 or so.
What's wrong ? Program text is below.

Thanks,
Eugene Druker
import numarray, numarray.linear_algebra

EigenVectors = numarray.linear_algebra.eigenvectors
Multiply = numarray.matrixmultiply
Zeros = numarray.zeros
Transpose = numarray.transpose

def makeCovMat(size):
covmat = Zeros((size,size),'f8')
d,t = 0.9,0.8
for i in xrange(size):
v = covmat[i,i] = d
for j in xrange(i+1,size):
v *= t
covmat[i,j] = covmat[j,i] = v
return covmat

print 'Size MaxDif(E.Val) MaxDif(E.Vect)'
for size in [2,3]+range(10,24):
covmat = makeCovMat(size)
eval,evec = EigenVectors(covmat)
# Test S = V L V'
mdiag = Zeros((size,size),'f8') # L
for j in xrange(size):
mdiag[j,j] = eval[j]
testmat = Multiply(Transpose(evec),Multiply(mdiag,evec))
ival,ivec = EigenVectors(testmat)
print ' %3d %-14.7g %-14.7g' % \
(size, (eval-ival).max(), (evec-ivec).max())
Jul 18 '05 #1
1 2796
eu***********@yahoo.com (Eugene Druker) writes:
I need eigen values and vectors for symmetric matrices (like VCV).
Solving with numarray and testing the results, I've got
strange results - input and output matrices of some sizes are

[...]

You'll probably be much better off posting this to whichever mailing
list the numarray people use. Google for it. HTH
John
Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

### Similar topics

 0 by: RJS | last post by: Hi all, I can't get a py2exe compiled app to run with numarray (numarray-0.5.win32- py2.2). Also wxPythonWIN32-2.3.3.1-Py22 and ActivePython-2.2.1-222. In the sample below, commenting out... 3 by: Alexander Schwaigkofler | last post by: Hi! I have the following problem with numarray. I read the install.txt manual, but it doesn't already work. OS: Microsoft Windows 2000 python: Python 2.2.3 (#42, May 30 2003, 18:12:08) on... 4 by: Marco Bubke | last post by: Hi I have tried to include numarray in Pyrex but I get allways this error: Traceback (most recent call last): File "gears.py", line 9, in ? import gl File... 4 by: Marco Bubke | last post by: Hi Ok, I get a reproduceable seqmentation fault. Ok, fist the code: cdef NumArray array_to_double(NumArray array): # maybe here is memoty leak! cdef NumArray flat_array_obj flat_array_obj... 2 by: Marc Schellens | last post by: Following the NumPy documentation, I took over some C code, but run into an error. Does anybody have a suggestion? Thanks, marc gdlpython.cpp:225: `PyArray_Type' undeclared (first use this... 0 by: andrewfelch | last post by: Below is the code to/from Boolean arrays and Unsigned integers. On my Pentium 4, functions such as "bitwise_and" are 32 times faster when run on 32-bit integers instead of the... 0 by: robert | last post by: just a note - some speed comparisons : 0.60627370238398726 0.42836673376223189 0.36965815487747022 0.016557970357098384 0.15692469294117473 0.01951756438393204 4 by: Christian Convey | last post by: I need to bang out an image processing library (it's schoolwork, so I can't just use an existing one). But I see three libraries competing for my love: numpy, numarray, and numeric. Can anyone... 18 by: Jedora | last post by: Hi all, I want to write a C program to compute eigenvalues and eigenvectors. But the matrix is a complex matrix which has all complex numbers. Like this: 5.8751 5.8774 + 1.5423i ... 0 by: isladogs | last post by: The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former... 0 by: ryjfgjl | last post by: In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import... 0 by: taylorcarr | last post by: A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,... 0 by: aa123db | last post by: Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function \$name\$ (\$parameters\$) { } ... 0 by: ryjfgjl | last post by: If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming... 0 by: ryjfgjl | last post by: In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files... 0 by: BarryA | last post by: What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress... 1 by: nemocccc | last post by: hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions? 0 by: Hystou | last post by: There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...