Project

General

Profile

Slug #1284

Updated by Anna Maria Bigatti over 4 years ago

Cartesian product operator is much faster than @CartesianProductList@.
Example:
<pre>
t := CpuTime();
>>> L := (0..1) >< (0..1) >< (0..1) >< (0..1) >< (0..1) >< (0..1) >< (0..1) >< (0..1) >< (0..1) >< (0..1) >< (0..1) >< (0..1) >< (0..1) >< (0..1) >< (0..1);
TimeFrom(t); >>> TimeFrom(0);
0.134

t := CpuTime();

>>> LL := [0..1 | j in 1..15];
>>> LLL := CartesianProductList(LL);
TimeFrom(t); >>> TimeFrom(0);
19.414
</pre>

Also, if I call @CartesianproductList@ with 16 factors instead 15 as above then the time increases to about 80s, which is much worse than linear!

Back