[SciPy-User] problem with dot for complex matrices

Aronne Merrelli aronne.merrelli@gmail....
Tue Mar 27 14:35:38 CDT 2012

On Tue, Mar 27, 2012 at 2:26 PM, Ryan Krauss <ryanlists@gmail.com> wrote:
> To further add to my own mystery, why does this fix the problem:
> In [37]: -1*numpy.dot(submat_inv_num, augcol_num)
> Out[37]:
> array([[  5.30985737e-05+0.00038316j],
>       [  1.72370377e-04+0.00115503j]])

It appears to be equal to:

In [1]: M = array([[-0.22740265-1.63857451j, -0.07740957-0.55847886j],
   ...:       [-3.20602957-4.93959054j, -0.36746252-1.68352465j]])

In [2]: x = array([[ -3.74729148e-05-0.0005937j ],
   ...:       [  7.96025801e-04+0.01137658j]])

In [16]: -1 * (dot(M.real,x.real) + 1j*dot(M.imag,x.real))
array([[  5.30985748e-05+0.00038316j],
       [  1.72370374e-04+0.00115503j]])

I don't have any idea why it is doing that. You've never posted what
the type of those arrays are, though - is it possible it is a subclass
of ndarray that is doing something strange to the dot method? I think
the call to copy might put it back into a "plain" ndarray.

More information about the SciPy-User mailing list