|
From: | Levente Torok |
Subject: | fast set operations |
Date: | Sat, 9 Aug 2008 16:40:49 +0200 |
User-agent: | KMail/1.9.6 (enterprise 0.20070907.709405) |
Dear All, I was in the need to have a fast set operations such as intersection and complement but the those that I could use with the current octave versions (<3.0) are very very slow to my needs. For this reason I wrote a version in STL C++. May be not optimal in terms of strorage (I convert everything to STL vector since it has fast iterators) however this is still 100-500 times faster for vectors with 10^5 elements, at least, than the versions currently supplied by octave. I enclose the sources. l=100000; x= floor(l * rand(l,1)); y=floor(l * rand(l,1)) ; t=time; z=intersection( x, y ); dt=time -t; x= floor(l * rand(l,1)); y=floor(l * rand(l,1)) ; t=time; z=intersection2( x, y ); dt2=time -t; dt / dt2 > 500 Bests, Levente (Makefile-s are for personal usage) --
complement2.cpp
Description: Text Data
intersection2.cpp
Description: Text Data
Makefile.complement
Description: Text Data
Makefile.intersection
Description: Text Data
[Prev in Thread] | Current Thread | [Next in Thread] |