# [Numpy-discussion] Can you help me find a dumb matrix multiply mistake

Rick Muller rpmuller@gmail....
Fri Feb 26 18:43:04 CST 2010

```Argh! I mixed up where the .H went!!

Thanks for pointing out the mistake. Thought it was something mindless.

On Fri, Feb 26, 2010 at 2:18 PM, <josef.pktd@gmail.com> wrote:

> On Fri, Feb 26, 2010 at 4:01 PM, Rick Muller <rpmuller@gmail.com> wrote:
> > I'm making a mistake here, one that I suspect is a dumb error. I'm not as
> > familiar with the math of complex hermetian matrices as I am with real
> > symmetry matrices.
> >
> > I want to diagonalize the matrix:
> >
> > Y = matrix([[0,-1j],[1j,0]])     # this is the Y Pauli spin matrix
> >
> > Ey,Uy = eigh(Y)
> >
> > When I try to do:
> >
> > print Uy.H * diag(Ey) * Uy
> >
> > rather than getting Y back, I get:
> >
> > [[ 0.+0.j -1.+0.j]
> >  [-1.+0.j  0.+0.j]]
>
> to get Y back:
>
> >>> Uy * np.diag(Ey) * Uy.H
> matrix([[ 0.+0.j,  0.-1.j],
>        [ 0.+1.j,  0.+0.j]])
>
> >>> Uy * np.diag(Ey) * Uy.H - Y
> matrix([[ 0. +0.00000000e+00j,  0. +2.22044605e-16j],
>        [ 0. -2.22044605e-16j,  0. +0.00000000e+00j]])
>
> Josef
>
> >
> > I also tried
> >
> > dot(Uy.H,dot(diag(Ey),Uy))
> >
> > to make sure this isn't a matrix/array problem with the same result. Can
> > someone spot what I'm doing wrong?
> >
> >
> >
> > --
> > Rick Muller
> > rpmuller@gmail.com
> > 505-750-7557
> >
> >
> > _______________________________________________
> > NumPy-Discussion mailing list
> > NumPy-Discussion@scipy.org
> > http://mail.scipy.org/mailman/listinfo/numpy-discussion
> >
> >
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>

--
Rick Muller
rpmuller@gmail.com
505-750-7557
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100226/b7cb25f2/attachment.html
```