On 8/7/10 3:14 AM, dagss wrote:
On Aug 3, 5:52 am, Jason Grout<jason-s...@creativetrax.com>  wrote:
6. TRANSPOSE/CONJUGATE
It seems that implementing this would just involve modifying the
__pos__(self) method for complexes, matrices and complex matrices, and
I think that both conjugating and transposing are common enough
operations to deserve its own operator.

Numpy has:

m.T for transpose
m.H for hermitian
m.I for inverse

(seehttp://www.scipy.org/NumPy_for_Matlab_Users312)

I think it would be great if we had similar shortcuts.


I always assumed that the lack of these was just that nobody had
bothered to implement them, not that anyone were actually against
them?


Well, there is a general trend towards using functions instead of attributes in Sage. I think the main reason is for documentation (I wish python had attribute docstrings that we could query!).

However, in this case, I think it makes a lot of sense to have m.T instead of m.T() (my reasoning is that you are usually using these in formulas, and the extra set of parentheses makes your formula look a lot more complicated and harder to parse).



a) At least the .T is so completely ingrained into the NumPy/SciPy
community that it would at least be very strange to go with some
*other* form of operator (like has been proposed)
b) It's Python compatible
c) It's incredibly convenient.

+1 to .T and .H.

BUT, -1 to .I for the inverse, because the *intent* of

arr.I * x

is almost certainly arr.solve_right(x). Actually taking the inverse,
"arr.inverse()", is something you rarely want to do, and in those
cases, having to type out "inverse" is a good thing IMO. Just keeping
shorthand syntax like that out helps reduce bad habits.

I usually just use python's inverse operator:

~A


Jason

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to