Question: Interesting behavior!!!

Interesting behavior!!

> restart
> N := 150; L := LinearAlgebra[RandomVector](N);

                              150

> st := time(); for j to 10^4 do ArrayTools[SearchArray](`~`[`=`](L, max(L))) end do; time()-st;

                             4.250

> st := time(); for j to 10^4 do member(max(L), convert(L, list), 'i') end do; time()-st;

                             0.516

> member(max(L), convert(L, list), 'i');

                              true
> i;

                              139

> ArrayTools[SearchArray](`~`[`=`](L, max(L)));

                Vector[column](%id = 223065520)

#+++++++++++++++++++++++++++++++++++++++++++
> restart;
> N := 150; L := evalf(LinearAlgebra[RandomVector](N));

                              150

> st := time(); for j to 10^4 do ArrayTools[SearchArray](`~`[`=`](L, max(L))) end do; time()-st;

                             4.454

> st := time(); for j to 10^4 do member(max(L), convert(L, list), 'i') end do; time()-st;

                             0.610

> member(max(L), convert(L, list), 'i');

                              true
> i;

                               29

> ArrayTools[SearchArray](`~`[`=`](L, max(L)));

                Vector[column](%id = 193574436)

#+++++++++++++++++++++++++++++++++++++++++++
> restart;
> N := 150; L := LinearAlgebra[RandomVector](N, datatype = float[8]);

                              150

> st := time(); for j to 10^4 do ArrayTools[SearchArray](`~`[`=`](L, max(L))) end do; time()-st;

                             2.875

> st := time(); for j to 10^4 do member(max(L), convert(L, list), 'i') end do; time()-st;

                             0.829

> member(max(L), convert(L, list), 'i');

                             false
> i;

                               i

> ArrayTools[SearchArray](`~`[`=`](L, max(L)));

                Vector(1, {(1) = 114})

#+++++++++++++++++++++++++++++++++++++++++++
> restart;
> N := 150; L := evalf(LinearAlgebra[RandomVector](N, datatype = float[8]));

                              150

> st := time(); for j to 10^4 do ArrayTools[SearchArray](`~`[`=`](L, max(L))) end do; time()-st;

                             0.969

> st := time(); for j to 10^4 do member(max(L), convert(L, list), 'i') end do; time()-st;

                             0.828

> member(max(L), convert(L, list), 'i');

                             false
> i;

                               i

> ArrayTools[SearchArray](`~`[`=`](L, max(L)));

                Vector(1, {(1) = 27})

Please Wait...