fast set operations
Levente Torok
toroklev at gmail.com
Sat Aug 9 09:40:49 CDT 2008
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)
--
-------------- next part --------------
A non-text attachment was scrubbed...
Name: complement2.cpp
Type: text/x-c++src
Size: 1806 bytes
Desc: not available
Url : https://www.cae.wisc.edu/pipermail/octave-maintainers/attachments/20080809/5871af44/attachment.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: intersection2.cpp
Type: text/x-c++src
Size: 1821 bytes
Desc: not available
Url : https://www.cae.wisc.edu/pipermail/octave-maintainers/attachments/20080809/5871af44/attachment-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Makefile.complement
Type: text/x-makefile
Size: 2086 bytes
Desc: not available
Url : https://www.cae.wisc.edu/pipermail/octave-maintainers/attachments/20080809/5871af44/attachment-0002.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Makefile.intersection
Type: text/x-makefile
Size: 2090 bytes
Desc: not available
Url : https://www.cae.wisc.edu/pipermail/octave-maintainers/attachments/20080809/5871af44/attachment-0003.bin
More information about the Octave-maintainers
mailing list