[Numpy-discussion] .M .A .T .H attribute result

Fernando Perez fperez.net at gmail.com
Sat Jul 8 14:50:17 CDT 2006


Hi all,

On 7/7/06, Travis Oliphant <oliphant at ee.byu.edu> wrote:
>
> I didn't compile the results, but the discussion on the idea of adding
> new attributes to the array object led to the following result.
>
> Added:  .T attribute to mean self.transpose()

[...]

> .H
>
> A few were in favor, but this can now be written .T.conj()  which is not
> bad so does not get a new attribute.

I didn't have strong feelings one way or another on this, so I didn't
vote, but at this point I'd like to make a comment before the freeze.
Given that .T went in, I'd argue that .H should be in as well.
Basically, I now think these two should have been considered as a
bundle and not as separate options.

The reason isn't (just) my OCD surfacing again, but the fact that the
hermitian conjugate plays /exactly/ the role that transposition plays,
in regards to defining norms and (positive definite) inner products,
when complex arrays are in play.

The fact that numpy has excellent complex support is a major source of
joy for many.  I think that having .T but not .H would be a big wart
in this regard.  If you are trying to write code for inner products
with complex arrays, the natural language change from real ones is:

 dot(A.T,B)  -> dot(A.H,B)

For people who play with quantum mechanics this is an everyday need
(self-adjoint operators require expressions like this all the time),
but I suspect its use will be common in any field requiring normed
spaces with complex arrays.

Just my 1e-2j

Cheers,

f




More information about the Numpy-discussion mailing list