On Sun, Jun 23, 2019 at 10:05 PM Stewart Clelland <stewartclell...@gmail.com> wrote:
> Hi All, > > Based on discussion with Marten on github > <https://github.com/numpy/numpy/issues/13797>, I have a couple of > suggestions on syntax improvements on array transpose operations. > > First, introducing a shorthand for the Hermitian Transpose operator. I > thought "A.HT" might be a viable candidate. > I agree that short-hand for the Hermitian transpose would make sense, though I would try to stick with "A.H". It's one of the last reasons to prefer the venerable np.matrix. NumPy arrays already has loads of methods/properties, and this is a case (like @ for matrix multiplication) where the operator significantly improves readability: consider "(x.H @ M @ x) / (x.H @ x)" vs "(x.conj().T @ M @ x) / (x.conj().T @ x)" [1]. Nearly everyone who does linear algebra with complex numbers would find this useful. If I recall correctly, the last time this came up, it was suggested that we might implement this with NumPy view as a "complex conjugate" dtype rather than a memory copy. This would allow the operation to be essentially free. I find this very appealing, both due to symmetry with ".T" and because of the principle that properties should be cheap to compute. So my tentative vote would be (1) yes, let's do the short-hand attribute, but (2) let's wait until we have a complex conjugate dtype that do this efficiently. My hope is that this should be relatively doable in a year or two after current dtype refactor/usability effect comes to fruition. Best, Stephan [1] I copied the first non-trivial example off the Wikipedia page for a Hermitian matrix: https://en.wikipedia.org/wiki/Hermitian_matrix
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@python.org https://mail.python.org/mailman/listinfo/numpy-discussion