[PYTHON MATRIX-SIG] PyArray_Transpose [multiarraymodule.c] dumps core
Andy Dustman
andy@CCMSD.chem.uga.edu
Thu, 30 Jan 1997 13:27:45 -0500 (EST)
I was testing some of the LinearAlgebra functions and discovered that
eigenvectors and eigenvalues apparently work fine for ordinary arrays, but
for Matrix instances, I get a core dump (SGI IRIX 5.3, R4400). I did some
tracing around and it appears to happen in PyArray_Transpose when it does
a Py_XDECREF. Note: If I try tracing with pdb, it dumps core immediately
before I get any output. Matrix is a subclass of array, is it not?
Anyway, I don't know enough about how the Python-C interface works to even
begin to debug this, but I suspect a reference count problem. Hopefully
this is of some use to someone.
% python
Python 1.4 (Oct 28 1996) [C]
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> from LinearAlgebra import eigenvalues
>>> from Numeric import array
>>> a=array([[1,2,3],[4,5,6],[7,8,9]])
>>> a.shape
(3, 3)
>>> u=eigenvalues(a)
>>> u
1.61168440e+01 -1.11684397e+00 -1.26888098e-15
>>> from LinearAlgebra import eigenvectors
>>> u,v=eigenvectors(a)
>>> u,v
( 1.61168440e+01 -1.11684397e+00 -1.26888098e-15, 0.23197069
0.52532209 0.8186735
0.78583024 0.08675134 -0.61232756
0.40824829 -0.81649658 0.40824829)
>>> from Matrix import Matrix
>>> b=matrix([[1,2,3],[4,5,6],[7,8,9]])
Traceback (innermost last):
File "<stdin>", line 1, in ?
NameError: matrix
>>> b=Matrix([[1,2,3],[4,5,6],[7,8,9]])
>>> b.shape
(3, 3)
>>> u=eigenvalues(b)
Bus error (core dumped)
% dbx /usr/local/bin/python core
dbx version 3.19 Nov 3 1994 19:59:46
Core from signal SIGBUS: Bus error
(dbx) dump
PyArray_Transpose(0x1002cc90, 0x1002a5f8, 0x2, 0x1b)
["./../NumPy/multiarraymodule.c":153, 0x5fc91f98]
(dbx) list
>* 153 Py_XDECREF(ret);
154 if (permutation != NULL) free(permutation);
155 PyArray_Free(op, (char *)axes);
156 return NULL;
157 }
158
159 extern PyObject *PyArray_Repeat(PyObject *aop, PyObject *op, int
axis) {
160 int *counts;
161 int n, n_outer, i, j, k, chunk, total, tmp;
162 PyArrayObject *ret, *ap;
(dbx) quit
--
Andy Dustman / Computational Center for Molecular Structure and Design / UGA
You can have my PGP public key by sending mail with subject "send file key".
You can have my PGP secret key when you pry it out of my cold, dead neurons.
http://charon.chem.uga.edu/~andy mailto:andy@CCMSD.chem.uga.edu <}+++<
_______________
MATRIX-SIG - SIG on Matrix Math for Python
send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
_______________