matrix problem: float to matrix power
![](https://secure.gravatar.com/avatar/39916bae984cb93b797efd2b175f59c0.jpg?s=120&d=mm&r=g)
Why the restriction for matrices? Same question for matrices conformable for broadcasting: why not produce the equivalent of the array result? Cheers, Alan Isaac
![](https://secure.gravatar.com/avatar/764323a14e554c97ab74177e0bce51d4.jpg?s=120&d=mm&r=g)
Charles R Harris wrote:
For ndarrays, it does elementwise exponentiation, so it is neither here nor there with respect to matrices. What is the definition of a scalar raised to a matrix power? I don't ever recall seeing one. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco
![](https://secure.gravatar.com/avatar/764323a14e554c97ab74177e0bce51d4.jpg?s=120&d=mm&r=g)
Charles R Harris wrote:
Ah, yes. Of course. How silly of me. That raises the question of how to calculate the bloody thing, though. We have three implementations of expm() in scipy.linalg.matfuncs. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco
![](https://secure.gravatar.com/avatar/5b2449484c19f8e037c5d9c71e429508.jpg?s=120&d=mm&r=g)
On Oct 30, 2007 11:40 PM, Alan G Isaac <aisaac@american.edu> wrote:
With the caveat that I don't use the matrix class: I believe it's because M**n results in the matrix power of n. It would be confusing if n**M did a broadcast element wise power. -- . __ . |-\ . . tim.hochberg@ieee.org
![](https://secure.gravatar.com/avatar/39916bae984cb93b797efd2b175f59c0.jpg?s=120&d=mm&r=g)
On Wed, 31 Oct 2007, Timothy Hochberg apparently wrote:
because M**n results in the matrix power of n. It would be confusing if n**M did a broadcast element wise power.
In an attempt to summarize: scalar to a matrix power 1. may have been overlooked, or may have been omitted as confusing 2. if overlooked there are two possible answers as to what it could reasonably be a. a**m = exp(ln(a)*m) natural definition b. a**m = a**m.A broadcasting In languages that provide an answer, I have the impression that the answer is usually (b). (E.g., GAUSS.) However perhaps in NumPy this is the least interesting way to go? But it is what I was expecting. Cheers, Alan Isaac
![](https://secure.gravatar.com/avatar/5b2449484c19f8e037c5d9c71e429508.jpg?s=120&d=mm&r=g)
On Nov 1, 2007 12:20 PM, Alan G Isaac <aisaac@american.edu> wrote:
For some definition of natural: it makes sense once you see it, but is seem like most people expected something else (in our four person sample, only one person came up with this definition -- not that that's good statistics.).
I'd inclined to leave it unimplemented. It seems like it's likely to cause confusion and my impression is that it's not a common enough construction that having to use a function should be a big burden for most if not all people. -- . __ . |-\ . . tim.hochberg@ieee.org
![](https://secure.gravatar.com/avatar/764323a14e554c97ab74177e0bce51d4.jpg?s=120&d=mm&r=g)
Charles R Harris wrote:
For ndarrays, it does elementwise exponentiation, so it is neither here nor there with respect to matrices. What is the definition of a scalar raised to a matrix power? I don't ever recall seeing one. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco
![](https://secure.gravatar.com/avatar/764323a14e554c97ab74177e0bce51d4.jpg?s=120&d=mm&r=g)
Charles R Harris wrote:
Ah, yes. Of course. How silly of me. That raises the question of how to calculate the bloody thing, though. We have three implementations of expm() in scipy.linalg.matfuncs. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco
![](https://secure.gravatar.com/avatar/5b2449484c19f8e037c5d9c71e429508.jpg?s=120&d=mm&r=g)
On Oct 30, 2007 11:40 PM, Alan G Isaac <aisaac@american.edu> wrote:
With the caveat that I don't use the matrix class: I believe it's because M**n results in the matrix power of n. It would be confusing if n**M did a broadcast element wise power. -- . __ . |-\ . . tim.hochberg@ieee.org
![](https://secure.gravatar.com/avatar/39916bae984cb93b797efd2b175f59c0.jpg?s=120&d=mm&r=g)
On Wed, 31 Oct 2007, Timothy Hochberg apparently wrote:
because M**n results in the matrix power of n. It would be confusing if n**M did a broadcast element wise power.
In an attempt to summarize: scalar to a matrix power 1. may have been overlooked, or may have been omitted as confusing 2. if overlooked there are two possible answers as to what it could reasonably be a. a**m = exp(ln(a)*m) natural definition b. a**m = a**m.A broadcasting In languages that provide an answer, I have the impression that the answer is usually (b). (E.g., GAUSS.) However perhaps in NumPy this is the least interesting way to go? But it is what I was expecting. Cheers, Alan Isaac
![](https://secure.gravatar.com/avatar/5b2449484c19f8e037c5d9c71e429508.jpg?s=120&d=mm&r=g)
On Nov 1, 2007 12:20 PM, Alan G Isaac <aisaac@american.edu> wrote:
For some definition of natural: it makes sense once you see it, but is seem like most people expected something else (in our four person sample, only one person came up with this definition -- not that that's good statistics.).
I'd inclined to leave it unimplemented. It seems like it's likely to cause confusion and my impression is that it's not a common enough construction that having to use a function should be a big burden for most if not all people. -- . __ . |-\ . . tim.hochberg@ieee.org
participants (4)
-
Alan G Isaac
-
Charles R Harris
-
Robert Kern
-
Timothy Hochberg