Building up on the solution proposed here : Simplifying nested If statements
You can find here the data set : allGazes.dat
allGazesX =
Uncompress@
Import[FileNameJoin[{NotebookDirectory[], "allGazes.dat.gz"}],
"String"];
I need to filter large data set and believe I lack an efficient method to do so. The purpose here is to filter given the EuclideanDistance[] between gazes. Below is what I am using currently :
This is what i am using currently :
GZ[delta_] := ParallelTable[
Table[
Reap[z = allGazesX[[subNO, dispNo, 1, ;; 2]];Sow[z];
Scan[
If[
EuclideanDistance[#, z] > delta,
z = #;Sow[z]] &,
allGazesX[[subNO, dispNo, All, ;; 2]]]][[2, 1]],
{dispNo, Range[Length[allGazesX[[subNO]]]]}],
{subNO, Range[5]}];
ParallelTablefor bothdispNoandsubNO? – rcollyer Mar 02 '12 at 15:13TableandParallelTableaccept multiple iterator arguments, or should. So, you could writeParallelTable[..., {subNO, ...}, {dispNo, ...}]instead of nesting the secondTableinside. Note,dispNohas to go aftersubNOwhich it depends on. Does that clarify what I was asking? Or, do you still get an error message? – rcollyer Mar 02 '12 at 16:53TableinsideParallelTablemay make sense, if you want to force certain (coarse) granularity of your computations. – Leonid Shifrin Mar 02 '12 at 17:57Nearestworks? I timed it the other day, and the NearestFunction seemed to run in linear time in the number of points used to build it, both for 1D and 2D data with Euclidean distance. However, occasionally I got some inconsistent timings where the first run of the NearestFunction was slow, but the subsequent ones were fast. I couldn't reproduce this for large data though. Surely it must have better than linear complexity, but a naive measurement shows linear. Note I am talking about the timings for the NearestFunction, not Nearest. – Szabolcs Mar 02 '12 at 18:03