![](https://secure.gravatar.com/avatar/5c9fb379c4e97b58960d74dcbfc5dee5.jpg?s=120&d=mm&r=g)
Hi, There is an operation I do a lot, I would call it "unrolling" a array. The best way to describe it is probably to give the code: def unroll(M): """ Flattens the array M and returns a 2D array with the first columns being the indices of M, and the last column the flatten M. """ return hstack((indices(M.shape).reshape(-1,M.ndim),M.reshape(-1,1))) Example:
The docstring sucks. The function is trivial (when you know numpy a bit). Maybe this function already exists in numpy, if so I couldn't find it. Elsewhere I propose it for inclusion. Cheers, Gaël ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
![](https://secure.gravatar.com/avatar/5c9fb379c4e97b58960d74dcbfc5dee5.jpg?s=120&d=mm&r=g)
Hi all, I didn't get any answers to this email. Is it because the proposed addition to numpy is not of any interest to anybody apart from me ? Maybe the way I introduced this is wrong. Please tell me what is wrong with this proposition. Regards, Gaël On Fri, Oct 20, 2006 at 01:28:52PM +0200, Gael Varoquaux wrote:
Hi,
There is an operation I do a lot, I would call it "unrolling" a array. The best way to describe it is probably to give the code:
Example:
Cheers,
Gaël
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
![](https://secure.gravatar.com/avatar/2b8a71c6c4c0df90de065ce45ee9df33.jpg?s=120&d=mm&r=g)
Gael Varoquaux schrieb:
Well you didn't mentioned why it would be useful for a broad audience, only that you yourself use it alot. Together with the fact that it's a one-liner this presumably means that it's not exactly a prime candidate for adoption. (I'm just another user, so I'm speculating a bit here based on my reading of past postings on this list.) -sven ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
![](https://secure.gravatar.com/avatar/5c9fb379c4e97b58960d74dcbfc5dee5.jpg?s=120&d=mm&r=g)
You're probably right. Well it would most definitely be useful for all the lads in my lab, but I am not sure this is a broad audience. The use case is when you have a array representing data in an "mgrid" way, and you wnat to apply transformations to the coordinates. It is something I have done and seen done quite often. If I am the only one a the list who see a use for this, then forget it. Gaël On Sun, Nov 12, 2006 at 06:07:30PM +0100, Sven Schreiber wrote:
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
![](https://secure.gravatar.com/avatar/5c9fb379c4e97b58960d74dcbfc5dee5.jpg?s=120&d=mm&r=g)
Hi all, I didn't get any answers to this email. Is it because the proposed addition to numpy is not of any interest to anybody apart from me ? Maybe the way I introduced this is wrong. Please tell me what is wrong with this proposition. Regards, Gaël On Fri, Oct 20, 2006 at 01:28:52PM +0200, Gael Varoquaux wrote:
Hi,
There is an operation I do a lot, I would call it "unrolling" a array. The best way to describe it is probably to give the code:
Example:
Cheers,
Gaël
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
![](https://secure.gravatar.com/avatar/2b8a71c6c4c0df90de065ce45ee9df33.jpg?s=120&d=mm&r=g)
Gael Varoquaux schrieb:
Well you didn't mentioned why it would be useful for a broad audience, only that you yourself use it alot. Together with the fact that it's a one-liner this presumably means that it's not exactly a prime candidate for adoption. (I'm just another user, so I'm speculating a bit here based on my reading of past postings on this list.) -sven ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
![](https://secure.gravatar.com/avatar/5c9fb379c4e97b58960d74dcbfc5dee5.jpg?s=120&d=mm&r=g)
You're probably right. Well it would most definitely be useful for all the lads in my lab, but I am not sure this is a broad audience. The use case is when you have a array representing data in an "mgrid" way, and you wnat to apply transformations to the coordinates. It is something I have done and seen done quite often. If I am the only one a the list who see a use for this, then forget it. Gaël On Sun, Nov 12, 2006 at 06:07:30PM +0100, Sven Schreiber wrote:
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
participants (2)
-
Gael Varoquaux
-
Sven Schreiber