|
|
|
Your skill will accomplish what the force of many cannot |
|
| PerlMonks |
Re^2: Processing values of a piddle (PDL) speedup using 'at' vs. 'index'by kevbot (Friar) |
| on Jul 16, 2012 at 05:52 UTC ( #981961=note: print w/ replies, xml ) | Need Help?? |
|
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:
In Section
Meditations
|
|
||||||||||||||||||||||||||