[Numpy-discussion] Syntax Improvement for Array Transpose

Marten van Kerkwijk m.h.vankerkwijk at gmail.com
Tue Jun 25 09:05:13 EDT 2019


Hi All,

The examples with different notation brought back memory of another
solution: define
`m.ᵀ` and m.ᴴ`. This is possible, since python3 allows any unicode for
names, nicely readable, but admittedly a bit annoying to enter (in emacs,
set-input-method to TeX and then ^T, ^H).

More seriously, still hoping to move to just being able to use .T and .H as
matrix (conjugate) transpose in newer numpy versions, is it really not
possible within a property to know whether the context where the operation
was defined has some specific "matrix_transpose" variable set? After all,
an error or warning generates a stack backtrace and from the ndarray C code
one would have to look only one stack level up (inside a warning, one can
even ask for the warning to be given from inside a different level, if I
recall correctly).

If that is truly impossible, then I think we need different names for both
.T and .H.  Some suggestions:

1. a.MT, a.MH (original suggestion at top of the thread)
2. a.mT, a.mH (m still for matrix, but no standing out as much, maybe
making it is easier to guess what is means)
3. a.RT and .CT (regular and conjugate transpose - the C also reminds of
complex)

All the best,

Marten
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20190625/00fc37d3/attachment.html>


More information about the NumPy-Discussion mailing list