![](https://secure.gravatar.com/avatar/dfa7ea87a46fa5c41c2f568e5f874ac1.jpg?s=120&d=mm&r=g)
Dear Guido, Thank you for your email. On Tue, Jul 29, 2008 at 8:26 PM, Guido van Rossum <guido@python.org> wrote:
But would it be totally outlandish to propose A**B for matrix multiplication? I can't think of what "matrix exponentiation" would mean...
Right now, ** is the pointwise power:
from numpy import * A=array([[1,2],[3,4]]) print(A**A) [[ 1 4] [ 27 256]]
Since all the scalar operators have meaning as pointwise operator, like you say it's hard to bump one off to give it to the matrix product instead. I don't know if it's a good idea with **, it will destroy the orthogonality of the system. They used to say, ignore LISP at your own peril. In that spirit, let me describe MATLAB's approach to this. It features a complete suite of matrix operators (+-*/\^), and their pointwise variants (.+ .- ./ .* .^), although + and .+ are synonyms, as are - and.-. Right now, numpy's *,**,/ correspond to MATLAB .*,.^,./. MATLAB implements scalar^matrix, matrix^scalar, but not matrix^matrix (although since log and exp are defined, I guess you could clobber together a meaning for matrix^matrix). Since ^ is the matrix-product version of "power", 2^A may not be what you expect:
2^A 10.4827 14.1519 21.2278 31.7106
Sincerely, -- Sébastien Loisel