help-octave
[Top][All Lists]

## Re: uniq function?

 From: Daniel Heiserer Subject: Re: uniq function? Date: Wed, 04 Nov 1998 09:15:05 +0100

John W. Eaton wrote:
>
> On  3-Nov-1998, Daniel Heiserer <address@hidden> 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?

Well I posted a "unique" script a day ago.
Should do what "create_set" does.

I think about a more generic approach like "twice", "triple" .....
putting into one routine. Once that works I think "intersection"
and the other "boolean" things could be done much faster.
Takes some time.

Bye
daniel

--
Mit freundlichen Gruessen
Daniel Heiserer
-----
--------------------------------------------------------------
Dipl.-Pys. Daniel Heiserer, BMW AG, Knorrstrasse 147, 80788 Muenchen
Abteilung EK-20
Tel.: 089-382-21187, Fax.: 089-382-42820