[Numpy-discussion] [RFC] should we argue for a matrix power operator, @@?

Alan G Isaac alan.isaac at gmail.com
Sat Mar 15 09:13:06 EDT 2014


On 3/15/2014 12:32 AM, Nathaniel Smith wrote:
>   I know you were worried
> about losing the .I attribute on matrices if switching to ndarrays for
> teaching -- given that ndarray will probably not get a .I attribute,
> how much would the existence of @@ -1 affect you?

Not much. Positive integer powers would be useful
(for illustrating e.g. graph theory and difference equations),
but not enough to delay the PEP.

I think NumPy should "take the money and run".
Getting `@` is great.  Let's get experience with
it before deciding whether it's worth asking for `@@`.

Questions for `@@`:
- would it just be `matrix_power`, with all the restrictions?
- or would `a(10,2,2)@@-1` return an array of matrix inverses?
- etc

In the end, I'd like to see a functional implementation before
deciding on `@@`, but I would not like to see `@` delayed at all.

Congratulations,
Alan




More information about the NumPy-Discussion mailing list