[SciPy-user] wrong sign of determinants in numarray with lapack.

George Nurser agn at noc.soton.ac.uk
Wed Oct 5 18:04:41 CDT 2005


I'm sorry this is more of a numerix (or even a lapack) problem than a  
direct SciPy problem.


I've been trying to make up Numeric & numarray on a Linux opteron box,  
using atlas/lapack.

Numeric eventually seemed to work and pass its tests, though I had to  
compile ATLAS and LAPACK with -fPIC.
ATLAS passed sanity tests.

numarray-1.3.3 is proving more difficult.

Worked out that installing numarray with
python setup.py  config --use_lapack install --gencode

is the (undocumented) way to link to external libraries.

No compilation or installation problems, but when I ran testall.test()
found 3 problems to do with determinants (messages at end).

Sign of 2nx2n determinants seems to be wrong.
e.g.
import numarray.linear_algebra.LinearAlgebra2 as la2
import numarray.numeric as num
a = num.array([[1.,2.], [3.,4.]])
print la2.determinant(a)
  -> gives 2.0 (should be -2)
but 2n+1 x2n+1 seems OK.

c =  num.array([[1,0,0],[0,1.,-2.], [0,3.,4.]])
print la2.determinant(b)
-> gives (correctly) 10.0

Default installation w/o lapack gives the right answers.

So I tested lapack by compiling *all* the lapack stuff, (including the  
test suite) instead of just the lapacklib
i.e. I did
make all
instead of
make lapacklib

This gave 'major' (i.e. order 10^16) errors in
cgd.out, csep.out, ded.out, dgd.out, sgd.out, ssep.out,ssvd.out,  
zgd.out.

Now [cdsz]gd.out errors are apparently expected -- see  
http://web.mit.edu/lapack/www/faq.html#1.24

But errors in ded.out,ssep.out, ssvd.out may be more serious. Are they  
causing the incorrect-sign determinants?

Puzzled. --George Nurser.





compilation method
---------------------------

ATLAS.

make xconfig
./xconfig -F f '-fPIC -fomit-frame-pointer -O -m64  
-fno-second-underscore' -F c '-fPIC -fomit-frame-pointer -O  
-mfpmath=387 -m64' -F m '-fPIC -fomit-frame-pointer -O -mfpmath=387  
-m64' -b /usr/lib/libblas.a
make install arch=Linux_HAMMER64SSE2

LAPACK.
use ATLAS blas; OPTS/NOOPT following  
http://www.scipy.org/mailinglists/mailman?fn=scipy-user/2005-February/ 
004066.html

so in make.inc
OPTS     = -funroll-all-loops -O3 -m64 -fno-second-underscore -fPIC
NOOPT    = -m64 -fno-second-underscore -fPIC
BLASLIB      =  .....ATLAS/lib/Linux_HAMMER64SSE2/f77blas.a


lapack errors
------------------
grep ail *
cgd.out: Matrix types (see CDRGEV for details):
cgd.out: CGV drivers:     63 out of   1092 tests failed to pass the  
threshold
csep.out: Matrix types (see xDRVST for details):
csep.out: CST drivers:      1 out of  11664 tests failed to pass the  
threshold
ded.out: Matrix types (see DDRVES for details):
ded.out: DES:    1 out of  3270 tests failed to pass the threshold
ded.out: Matrix types (see DDRVSX for details):
ded.out: DSX:    1 out of  3500 tests failed to pass the threshold
dgd.out: Matrix types (see DDRGEV for details):
dgd.out: DGV drivers:      8 out of   1092 tests failed to pass the  
threshold
dgd.out: DXV drivers:    200 out of   5000 tests failed to pass the  
threshold
sgd.out: Matrix types (see SDRGEV for details):
sgd.out: SGV drivers:      8 out of   1092 tests failed to pass the  
threshold
sgd.out: SXV drivers:     37 out of   5000 tests failed to pass the  
threshold
ssep.out: Matrix types (see SCHKST for details):
ssep.out:Test performed:  see SCHKST for details.
ssep.out: SST:    2 out of  4662 tests failed to pass the threshold
ssep.out: Matrix types (see xDRVST for details):
ssep.out: SST drivers:      1 out of  14256 tests failed to pass the  
threshold
ssvd.out: Matrix types (see xCHKBD for details):
ssvd.out: SBD:      1 out of   5510 tests failed to pass the threshold
zgd.out: Matrix types (see ZDRGEV for details):
zgd.out: ZGV drivers:     62 out of   1092 tests failed to pass the  
threshold
zgd.out: ZXV drivers:     24 out of   5000 tests failed to pass the  
threshold











More information about the SciPy-user mailing list