From help-octave-request at bevo dot che dot wisc dot edu Tue Nov 3 18:04:09 1998 Subject: Re: uniq function? From: "John W. Eaton" To: Daniel Heiserer Cc: Andrea Cavallini , help-octave@bevo.che.wisc.edu Date: Tue, 3 Nov 1998 17:55:11 -0600 (CST) On 3-Nov-1998, Daniel Heiserer wrote: | Well intersection bases on create_set as far as I have seen. | Here a little benchmark between "create_set" and "unique". | Unique is a factor 70 faster!!!! | | octave:3> a=1:1000000; | octave:4> b=[a,a]; | octave:5> b=sort(b); | octave:6> tic;c=unique(b);toc | ans = 11 | octave:7> tic;d=create_set(b);toc | ans = 721 | octave:8> e=find(c-d) | e = [](0x0) The trouble is that create_set and intersection (and union, because it calls create_set) use loops when they should probably use find or some other method instead. The comments in those files say that I wrote them, but I think that is incorrect. They were added a long time ago and I don't remember who contributed them. I'll see if I can figure out who did and fix the comments. Any volunteers for speeding them up? Thanks, jwe