[Numpy-discussion] add .H attribute?

Pauli Virtanen pav at iki.fi
Tue Jul 23 09:09:27 EDT 2013

23.07.2013 15:42, Stéfan van der Walt kirjoitti:
> On Tue, Jul 23, 2013 at 10:35 AM, Dag Sverre Seljebotn
> <d.s.seljebotn at astro.uio.no> wrote:
>> So -1 on using A.H for anything but a proper view, and "A.conjt()" or
>> something similar for a method that does a copy.
> "A.T.conj()" is just as clear, so my feeling is that we should either
> add A.H / A.H() or leave it be.

The .H property has been implemented in Numpy matrices and Scipy's 
sparse matrices for many years, and AFAIK the view issue apparently 
hasn't caused much confusion.

I think having it return an iterator (similarly to .flat which I think 
is rarely used) that is not compatible with ndarrays would be quite 
confusing. Implementing a full complex-conjugating ndarray view for this 
purpose on the other hand seems quite a large hassle, for somewhat 
dubious gains.

If it is implemented as returning a copy, it can be documented in a way 
that leaves leeway for changing the implementation to a view later on.

Pauli Virtanen

More information about the NumPy-Discussion mailing list