in reply to Re: Processing values of a piddle (PDL) speedup using 'at' vs. 'index'
in thread Processing values of a piddle (PDL) speedup using 'at' vs. 'index'
Thanks for the reply.
I think your comment,
My (very limited) experience of working with PDL suggests that if you need to manipulate the values in a piddle individually, rather than applying each operation to the entire piddle as a whole, then you should export the piddle, en-masse, to a perl array first. It saves huge amounts of time,and this excerpt from the PDL Book,
Be careful with at, as you almost never want to use it - it is tedious for anything nontrivial, and extremely slow! Particularly if you find yourself placing an at call inside a for loop, you should probably stop and think about how to use threading for your problem - see below.are getting at the same idea. That is, one should avoid processing values in a piddle individually and take advantage of PDL's various commands for manipulating whole vecotrs or matrices.
The code example that I gave is a bit simplified compared to my actual use case. In my case, I iterate through a few thousand objects (these objects have attributes that are 1-dimensional pdls). The values from most (or all) of these pdls need to be exported into my text file. I take values from these pdls, check them to see if they are a special value, change the value if needed, and then put them into a perl array. The perl array is eventually written to a text file. Your comments have me thinking that another possibility might be to do something like this:
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Processing values of a piddle (PDL) speedup using 'at' vs. 'index'
by BrowserUk (Patriarch) on Jul 17, 2012 at 14:20 UTC | |
by kevbot (Vicar) on Jul 18, 2012 at 04:37 UTC | |
|
Re^3: Processing values of a piddle (PDL) speedup using 'at' vs. 'index'
by chm (Novice) on Mar 24, 2013 at 22:23 UTC |