[Numpy-discussion] add .H attribute?

Nathaniel Smith njs at pobox.com
Sat Jul 13 13:46:12 EDT 2013

On 13 Jul 2013 16:30, "Alan G Isaac" <alan.isaac at gmail.com> wrote:
> > On Sun, Jul 7, 2013 at 9:28 AM, Alan G Isaac <alan.isaac at gmail.com<mailto:
alan.isaac at gmail.com>> wrote:
> > I miss being able to spell a.conj().T as a.H, as one can
> > with numpy matrices.
> On 7/7/2013 4:49 PM, Charles R Harris wrote:
> > There was a long thread about this back around 1.1 or so,
> > long time ago in any case. IIRC correctly, Travis was
> > opposed. I think part of the problem was that arr.T is
> > a view, but arr.H would not be. Probably it could be be
> > made to return an iterator that performed the conjugation,
> > or we could simply return a new array. I'm not opposed
> > myself, but I'd have to review the old discussion to see
> > if there was good reason not to have it in the first
> > place. I think the original discussion of an abs method
> > took place about the same time.
> If not being a view is determinative, could a .ct() method
> be considered?  Or would the objection apply there too?

Why not just write

def H(a):
    return a.conj().T

in your local namespace? The resulting code will be even more concise than
if we had a .ct() method.

ndarray has way too many attributes already IMHO (though I realize this may
be a minority view).

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20130713/4cd54cae/attachment.html>

More information about the NumPy-Discussion mailing list