From: Keith G. <kwg...@gm...> - 2006-06-21 17:16:48
|
The NumPy for Matlab Users page suggests mat(a.A * b.A) for element-by-element matrix multiplication. I think it would be helpful to also include multiply(a, b). a.*b mat(a.A * b.A) or multiply(a, b) |
From: Robert K. <rob...@gm...> - 2006-06-21 17:22:21
|
Keith Goodman wrote: > The NumPy for Matlab Users page suggests mat(a.A * b.A) for > element-by-element matrix multiplication. I think it would be helpful > to also include multiply(a, b). > > a.*b > > mat(a.A * b.A) or > multiply(a, b) It is a wiki page. You may edit it yourself without needing to ask permission. -- 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 |
From: Keith G. <kwg...@gm...> - 2006-06-21 17:45:55
|
On 6/21/06, Robert Kern <rob...@gm...> wrote: > Keith Goodman wrote: > > The NumPy for Matlab Users page suggests mat(a.A * b.A) for > > element-by-element matrix multiplication. I think it would be helpful > > to also include multiply(a, b). > > > > a.*b > > > > mat(a.A * b.A) or > > multiply(a, b) > > It is a wiki page. You may edit it yourself without needing to ask permission. OK. Done. I also added a notice about SciPy's PayPal account being suspended. |
From: Bill B. <wb...@gm...> - 2006-06-21 22:40:49
|
Actually I think using mat() (just an alias for the matrix constructor) is a bad way to do it. That mat() (and most others on that page) should probably be replaced with asmatrix() to avoid the copy. --bb On 6/22/06, Keith Goodman <kwg...@gm...> wrote: > > On 6/21/06, Robert Kern <rob...@gm...> wrote: > > > Keith Goodman wrote: > > > The NumPy for Matlab Users page suggests mat(a.A * b.A) for > > > element-by-element matrix multiplication. I think it would be helpful > > > to also include multiply(a, b). > > > > > > a.*b > > > > > > mat(a.A * b.A) or > > > multiply(a, b) > > > > It is a wiki page. You may edit it yourself without needing to ask > permission. > > OK. Done. I also added a notice about SciPy's PayPal account being > suspended. > > All the advantages of Linux Managed Hosting--Without the Cost and Risk! > Fully trained technicians. The highest number of Red Hat certifications in > the hosting industry. Fanatical Support. Click to learn more > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642 > _______________________________________________ > Numpy-discussion mailing list > Num...@li... > https://lists.sourceforge.net/lists/listinfo/numpy-discussion > -- William V. Baxter III OLM Digital Kono Dens Building Rm 302 1-8-8 Wakabayashi Setagaya-ku Tokyo, Japan 154-0023 +81 (3) 3422-3380 |
From: Ed S. <sch...@ft...> - 2006-06-22 07:54:35
|
On 22/06/2006, at 12:40 AM, Bill Baxter wrote: > Actually I think using mat() (just an alias for the matrix > constructor) is a bad way to do it. That mat() (and most others on > that page) should probably be replaced with asmatrix() to avoid the > copy. Perhaps the 'mat' function should become an alias for 'asmatrix'. I've thought this for a while. Then code and documentation like this page could remain short and simple without incurring the performance penalty. Go on, shoot me down! :) -- Ed |
From: Travis O. <oli...@ee...> - 2006-06-23 17:14:27
|
Ed Schofield wrote: >On 22/06/2006, at 12:40 AM, Bill Baxter wrote: > > > >>Actually I think using mat() (just an alias for the matrix >>constructor) is a bad way to do it. That mat() (and most others on >>that page) should probably be replaced with asmatrix() to avoid the >>copy. >> >> > >Perhaps the 'mat' function should become an alias for 'asmatrix'. >I've thought this for a while. Then code and documentation like this >page could remain short and simple without incurring the performance >penalty. > > I wanted this too a while back but when I tried it a lot of code broke because there were quite a few places (in SciPy and NumPy) that were using the fact that mat returned a copy of the array. -Travis |
From: Bill B. <wb...@gm...> - 2006-06-22 10:53:41
|
On 6/22/06, Ed Schofield <sch...@ft...> wrote: > > > On 22/06/2006, at 12:40 AM, Bill Baxter wrote: > > > Actually I think using mat() (just an alias for the matrix > > constructor) is a bad way to do it. That mat() (and most others on > > that page) should probably be replaced with asmatrix() to avoid the > > copy. > > Perhaps the 'mat' function should become an alias for 'asmatrix'. > I've thought this for a while. That makes sense to me. As far as I know, asmatrix() defaults to calling the constructor if it can't snarf the memory of the object being passed in. So, go on, shoot Ed and me down! :-) --Bill |
From: Keith G. <kwg...@gm...> - 2006-06-22 16:47:29
|
On 6/22/06, Bill Baxter <wb...@gm...> wrote: > On 6/22/06, Ed Schofield <sch...@ft...> wrote: > > > > > On 22/06/2006, at 12:40 AM, Bill Baxter wrote: > > > > > Actually I think using mat() (just an alias for the matrix > > > constructor) is a bad way to do it. That mat() (and most others on > > > that page) should probably be replaced with asmatrix() to avoid the > > > copy. > > > > Perhaps the 'mat' function should become an alias for 'asmatrix'. > > I've thought this for a while. > > > That makes sense to me. As far as I know, asmatrix() defaults to calling > the constructor if it can't snarf the memory of the object being passed in. > > So, go on, shoot Ed and me down! :-) I can anticipate one problem: the Pirates will want their three-letter abbreviation for asarray. Will functions like rand and eye always return arrays? Or will there be a day when you can tell numpy that you are working with matrices and then it will return matrices when you call rand, eye, etc? |
From: Bill B. <wb...@gm...> - 2006-06-22 19:11:13
|
On 6/23/06, Keith Goodman <kwg...@gm...> wrote: > > On 6/22/06, Bill Baxter <wb...@gm...> wrote: > > On 6/22/06, Ed Schofield <sch...@ft...> wrote: > > > > > > > > On 22/06/2006, at 12:40 AM, Bill Baxter wrote: > > > > > > > Actually I think using mat() (just an alias for the matrix > > > > constructor) is a bad way to do it. That mat() (and most others on > > > > that page) should probably be replaced with asmatrix() to avoid the > > > > copy. > > > > > > Perhaps the 'mat' function should become an alias for 'asmatrix'. > > > I've thought this for a while. > > > > > > That makes sense to me. As far as I know, asmatrix() defaults to > calling > > the constructor if it can't snarf the memory of the object being passed > in. > > > > So, go on, shoot Ed and me down! :-) > > I can anticipate one problem: the Pirates will want their three-letter > abbreviation for asarray. arr() me maties! Will functions like rand and eye always return arrays? Or will there > be a day when you can tell numpy that you are working with matrices > and then it will return matrices when you call rand, eye, etc? > I don't disagree there's a need, but you can always make your own: def mrand(*vargs): return asmatrix(rand(*vargs)) def meye(N, **kwargs): return asmatrix(eye(N,**kwargs)) --bb |