[Numpy-discussion] numarray.linear_algrebra > cholesky_decomposition problem

LUK ShunTim shuntim.luk at polyu.edu.hk
Fri Aug 29 22:18:03 CDT 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Todd Miller wrote:

| It's a bug in the recent port of mlab.py.  Numarray doesn't really
| support spacesaver, and it doesn't fake it yet either.  I removed
| the spacesaver code for numarray-0.7.
|
| On Fri, 2003-08-29 at 04:04, Justin Worrall wrote:
|
|>Hi,
|>
|>I'm having problems using the cholesky decomposition function -
|>perhaps someone could point out where I am going wrong. Many thanks,
|>
|>Justin
|>
|>dingy /ms/user/w/worrall 22$ python
|>Python 2.3 (#1, Aug 19 2003, 16:53:06)
|>[GCC 2.95.2 19991024 (release)] on sunos5
|>Type "help", "copyright", "credits" or "license" for more information.
|>
|>>>>from numarray import *
|>>>>from numarray.linear_algebra import *
|>>>>x=array([[1.0,0.0],[0.5,1.0]])
|>>>>x
|>
|>array([[ 1. ,  0. ],
|>       [ 0.5,  1. ]])
|>
|>>>>cholesky_decomposition(x)
|>

[snipped]

A big Thanks for the *very* quick response.

But I found it strange that Cholesky decomposition is used for an
unsymmetric matrix and then I discover that in fact this goes through
raising no error. Here's the code snippet

<quote>
from numarray import *
import numarray.linear_algebra as la

# Good
x=array([[1.0,0.5],[0.5,1.0]])
print "\n", x
al=la.cholesky_decomposition(x)
print "\n", al
print "\n", matrixmultiply(al,transpose(al))

# Bad
x=array([[1.0,0],[0.5,1.0]])
print "\n", x
al=la.cholesky_decomposition(x)
print "\n", al
print "\n", matrixmultiply(al,transpose(al))
<quote>

and the results:

<quote>
H:\>python chol-numarray.py

[[ 1.   0.5]
~ [ 0.5  1. ]]

[[ 1.         0.       ]
~ [ 0.5        0.8660254]]

[[ 1.   0.5]
~ [ 0.5  1. ]]

[[ 1.   0. ]
~ [ 0.5  1. ]]

[[ 1.         0.       ]
~ [ 0.5        0.8660254]]

[[ 1.   0.5]
~ [ 0.5  1. ]]
</quote>

It appears that there is no checking (at least) for the symmetry of the
matrix. Of course, the user's responsibilty, ultimately ...

Regards,
ST

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (MingW32)

iD8DBQE/UDKdNmKlQkqct/IRAqIMAJ9T2xg/45Cf08SD4jvy5M4QBrNFvgCcDvrZ
PVxuUjQmVmXfSmm0WGilFhE=
=1aji
-----END PGP SIGNATURE-----





More information about the Numpy-discussion mailing list