Hi again,

There were some bugs in my implementations. I updated the gist 
<https://gist.github.com/pabloferz/01675f1bf4c8be359767#file-levicivita-jl> 
with the corrected versions and added a simpler looking function (but of 
O(n²) running time).

I did some tests and found (with my slow processor) that for permutations 
of length <= 5 the quadratic implementation (levicivita_simple) performs as 
fast as the (levicivita_inplace_check). For lengths from 5 to 15, 
levicivita_inplace_check 
is the fastest, followed by levicivita_simple. For lengths from 15 to 25 
levicivita_simple 
and levicivita perform the same (but slower than levicivita_inplace_check). 
For more than 25 elements levicivita_inplace_check is always the fastest, 
2x faster than levicivita and n times faster than levicivita_simple.

For people wanting the 3D Levi-Civita tensor, levicivita_simple and 
levicivita_inplace_check 
should be the same. For people wanting the parity of a permutation for long 
permutations levicivita_inplace_check should work the best.

Greetings!

Reply via email to