ulthiel / JuLie.jl

Mathematically sound structures and fast algorithms for things around representation theory, especially algebraic Lie theory and accompanying combinatorics.
GNU General Public License v3.0
6 stars 7 forks source link

Young tableaux #12

Closed schto223 closed 3 years ago

schto223 commented 3 years ago

After a fruitless search for a good algorithm to generate all young tableaux of a given shape, I decided to write my own algorithm.

I am pretty happy with it's performance:

@benchmark semistandard_tableaux([4,3,2,1])
BenchmarkTools.Trial: 
  memory estimate:  1.53 GiB
  allocs estimate:  12684703
  --------------
  minimum time:     2.148 s (21.97% GC)
  median time:      2.413 s (31.98% GC)
  mean time:        2.530 s (34.27% GC)
  maximum time:     3.030 s (44.80% GC)

The main Contributor being push!(SST, Tableau{T}(deepcopy(Tab))) which adds the computated tableau to the output array. Whithout this line, we can see that the rest of the algorithm contributes to less than 1% of the time it needs:

@benchmark semistandard_tableaux([4,3,2,1]) #without push!()
BenchmarkTools.Trial: 
  memory estimate:  1.11 KiB
  allocs estimate:  11
  --------------
  minimum time:     9.334 ms (0.00% GC)
  median time:      9.412 ms (0.00% GC)
  mean time:        9.474 ms (0.00% GC)
  maximum time:     12.053 ms (0.00% GC)
  --------------
  samples:          528
  evals/sample:     1

For comparison, Sage took 29,4s for this computation.

I also implemented the schensted algorithm which might be handy at some point.