[SciPy-user] multiplying scalar with complex matrix segfaults

LATORNELL, Doug Doug.LATORNELL at mdsinc.com
Thu Jan 19 16:30:58 EST 2006


Works okay for me, Andre

IsoInfoCompute:doug$ python
Python 2.4.1 (#1, Sep  3 2005, 13:08:59) 
[GCC 3.3.5 (propolice)] on openbsd3
Type "help", "copyright", "credits" or "license" for more information.
>>> from scipy import *
Overwriting fft=<function fft at 0x7efc487c> from scipy.fftpack.basic
(was <function fft at 0x88dbd3e4> from numpy.dft.fftpack)
Overwriting ifft=<function ifft at 0x7efc48b4> from scipy.fftpack.basic
(was <function inverse_fft at 0x88dbd41c> from numpy.dft.fftpack)
>>> 1.0 * matrix(eye(3, dtype=complex))
matrix([[ 1.+0.j,  0.+0.j,  0.+0.j],
       [ 0.+0.j,  1.+0.j,  0.+0.j],
       [ 0.+0.j,  0.+0.j,  1.+0.j]])
>>> 1.0 * matrix(eye(41, dtype=complex))
matrix([[ 1.+0.j,  0.+0.j,  0.+0.j, ...,  0.+0.j,  0.+0.j,  0.+0.j],
       [ 0.+0.j,  1.+0.j,  0.+0.j, ...,  0.+0.j,  0.+0.j,  0.+0.j],
       [ 0.+0.j,  0.+0.j,  1.+0.j, ...,  0.+0.j,  0.+0.j,  0.+0.j],
       ..., 
       [ 0.+0.j,  0.+0.j,  0.+0.j, ...,  1.+0.j,  0.+0.j,  0.+0.j],
       [ 0.+0.j,  0.+0.j,  0.+0.j, ...,  0.+0.j,  1.+0.j,  0.+0.j],
       [ 0.+0.j,  0.+0.j,  0.+0.j, ...,  0.+0.j,  0.+0.j,  1.+0.j]])
>>> import numpy
>>> numpy.__version__
'0.9.3.1868'
>>> import scipy
>>> scipy.__version__
'0.4.4.1549'
>>> import os
>>> os.uname()
('OpenBSD', 'IsoInfoCompute.mds.mdsinc.com', '3.8', 'GENERIC#0', 'i386')
>>> 

Doug
 

> -----Original Message-----
> From: scipy-user-bounces at scipy.net 
> [mailto:scipy-user-bounces at scipy.net] On Behalf Of Andre Radke
> Sent: January 19, 2006 11:53
> To: SciPy Users List
> Subject: [SciPy-user] multiplying scalar with complex matrix segfaults
> 
> 
> When I try to multiply a float value with a complex matrix 
> object, I get unexpected results or even a segfault, e.g.:
> 
> jannu:~ andre$ /usr/local/bin/python
> ActivePython 2.4.2 Build 248 (ActiveState Corp.) based on 
> Python 2.4.2 (#1, Oct  3 2005, 09:39:46) [GCC 3.3 20030304 
> (Apple Computer, Inc. build 1666)] on darwin Type "help", 
> "copyright", "credits" or "license" for more information.
> >>> from scipy import *
> >>> 1.0 * matrix(eye(3, dtype=complex))
> matrix([[ 1.+0.j,  0.+0.j,  0.+0.j],
>        [ 0.+0.j,  0.+0.j,  0.+0.j],
>        [ 0.+0.j,  0.+0.j,  1.+0.j]])
> >>> 1.0 * matrix(eye(41, dtype=complex))
> Segmentation fault
> 
> I'm aware that the matrix class overrides the * operator with 
> matrix multiplication and that's why I want to use it. 
> However, I still expected a scalar multiplied with a matrix 
> to yield a matrix where each entry has been multiplied with 
> that scalar.
> 
> In other words, I would expect both examples shown above to 
> return the identity matrix of the appropriate shape. 
> Obviously, that's not the case, at least not on my machine.
> 
> Can anybody else reproduce this?
> 
> This is using NumPy 0.9.4.1923, SciPy 0.4.4.1558, and 
> ActivePython 2.4.2 on Mac OS X 10.3.9.
> 
> Thanks,
> 
> -Andre
> 
>  
> 
> 
> 
> P.S. Here's the relevant portion of the crash log. It looks 
> like the segfault occurs in the ATLAS zaxpy function:
> 
> Exception:  EXC_BAD_ACCESS (0x0001)
> Codes:      KERN_INVALID_ADDRESS (0x0001) at 0x031090c0
> 
> Thread 0 Crashed:
> 0   libBLAS.dylib                  	0x9550f6e4 
> ATL_zaxpy_xp0yp0aXbX + 0x1c
> 1   _dotblas.so                    	0x0069beb8 
> dotblas_matrixproduct + 0x8d4 (_dotblas.c:341)
> 2   org.activestate.ActivePython24 	0x1007c4a0 
> call_function + 0x3bc (ceval.c:3558)
> 3   org.activestate.ActivePython24 	0x10079f4c 
> PyEval_EvalFrame + 0x22b8 (ceval.c:2163)
> 4   org.activestate.ActivePython24 	0x1007b0b4 
> PyEval_EvalCodeEx + 0x868 (ceval.c:2736)
> 5   org.activestate.ActivePython24 	0x10025a48 
> function_call + 0x158 (funcobject.c:548)
> 6   org.activestate.ActivePython24 	0x1000badc 
> PyObject_Call + 0x30 (abstract.c:1757)
> 7   org.activestate.ActivePython24 	0x1001526c 
> instancemethod_call + 0x31c (classobject.c:2448)
> 8   org.activestate.ActivePython24 	0x1000badc 
> PyObject_Call + 0x30 (abstract.c:1757)
> 9   org.activestate.ActivePython24 	0x10052a80 call_maybe + 
> 0x128 (typeobject.c:963)
> 10  org.activestate.ActivePython24 	0x1000bd00 binary_op1 + 
> 0x180 (abstract.c:378)
> 11  org.activestate.ActivePython24 	0x1000a518 
> PyNumber_Multiply + 0x28 (abstract.c:673)
> 12  org.activestate.ActivePython24 	0x100784ec 
> PyEval_EvalFrame + 0x858 (ceval.c:1049)
> 13  org.activestate.ActivePython24 	0x1007b0b4 
> PyEval_EvalCodeEx + 0x868 (ceval.c:2736)
> 14  org.activestate.ActivePython24 	0x1007e52c 
> PyEval_EvalCode + 0x30 (ceval.c:484)
> 15  org.activestate.ActivePython24 	0x100b2ebc run_node + 
> 0x4c (pythonrun.c:1265)
> 16  org.activestate.ActivePython24 	0x100b238c 
> PyRun_InteractiveOneFlags + 0x200 (pythonrun.c:763)
> 17  org.activestate.ActivePython24 	0x100b216c 
> PyRun_InteractiveLoopFlags + 0x10c (pythonrun.c:699)
> 18  org.activestate.ActivePython24 	0x100b3c10 
> PyRun_AnyFileExFlags + 0xa4 (pythonrun.c:659)
> 19  org.activestate.ActivePython24 	0x100bf6e0 Py_Main + 
> 0xa2c (main.c:487)
> 20  python                         	0x000018d0 _start + 
> 0x188 (crt.c:267)
> 21  dyld                           	0x8fe1a278 _dyld_start + 0x64
> 
> 
> 
> 
> 
> --
> Andre Radke + mailto:lists at spicynoodles.net + http://spicynoodles.net/
> 
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.net
> http://www.scipy.net/mailman/listinfo/scipy-user
> 


This email and any files transmitted with it may contain privileged or confidential information and may be read or used only by the intended recipient.  If you are not the intended recipient of the email or any of its attachments, please be advised that you have received this email in error and any use, dissemination, distribution, forwarding, printing or copying of this email or any attached files is strictly prohibited.  If you have received this email in error, please immediately purge it and all attachments and notify the sender by reply email or contact the sender at the number listed.




More information about the SciPy-User mailing list