Thanks for posting these, Pablo. For my most frequent use case I care about 
n = 3, but I suppose the O(n) algorithms would be more appropriate in Base.

You are also correct that sign(::AbstractVector) currently does an 
element-wise sign(). I didn't realize before writing my post that 
combinatorics.jl defines Permutations and Combinations types, but not the 
singular equivalents. So, that still leaves the naming issue unresolved.

Pablo, would you mind opening an issue or pull request to continue the 
discussion?

--Blake

On Wednesday, February 11, 2015 at 3:11:27 PM UTC-5, Pablo Zubieta wrote:
>
> 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