[SciPy-User] problem with dot for complex matrices

Aronne Merrelli aronne.merrelli@gmail....
Wed Mar 28 00:22:30 CDT 2012


On Tue, Mar 27, 2012 at 2:56 PM, Ryan Krauss <ryanlists@gmail.com> wrote:
> The matrices are initially created by these lines:
>
>        matout=scipy.zeros((n,n),dtype=complex128)#+0j
>        colout=scipy.zeros((n,1),dtype=complex128)#+0j
>
> They get assigned values from a matrix created using
>
> U=scipy.eye(self.maxsize+1,dtype=complex128)
>
> And when I ask for their types I get:
>
> In [15]: type(augcol_num)
> Out[15]: <type 'numpy.ndarray'>
>
> In [16]: type(submat_inv_num)
> Out[16]: <type 'numpy.ndarray'>
>
> So, I don't believe they are subtyped.
>

The only other idea I have is to check if you can save the "problem"
arrays. Specifically, try this, with the arrays that give the
incorrect dot product:

In [6]: savez('testing.npz', submat_inv_num=submat_inv_num,
augcol_num=augcol_num)

Then load them into a new session:

In [1]: d = load('testing.npz')

In [2]: submat_inv_num = d['submat_inv_num']; augcol_num = d['augcol_num']

Do the reloaded variables give the same incorrect dot product? It is
probably a long shot, since I would imagine the save/load would be
similar to copy... but if it works then others might be able to
inspect the object to see what might be different. One last detail -
it looks like the augcol is getting cast to a real number - (this is a
clearer example than what I showed earlier):

In [17]: dot(submat_inv_num,  augcol_num.real)
Out[17]:
array([[ -5.30985748e-05-0.00038316j],
       [ -1.72370374e-04-0.00115503j]])

That might be a clue that something is causing augcol_num to get cast
into a "normal" float before the dot product is taken.


More information about the SciPy-User mailing list