See the demo here
Young Tableaux can be constructed as follows:
julia> using YoungTableaux
julia> YoungTableau([[1, 3, 4], [2, 5], [6]])
3×3 YoungTableau{Int64}
┌───┬───┬───┐
│ 1 │ 3 │ 4 │
├───┼───┼───┘
│ 2 │ 5 │
├───┼───┘
│ 6 │
└───┘
Alternatively they can also be constructed from a permutation:
julia> π = [4, 6, 3, 8, 1, 2, 7, 5]
8-element Vector{Int64}:
4
6
3
8
1
2
7
5
julia> P, Q = rs_pair(π)
(YoungTableau{Int64}([[1, 2, 5], [3, 6, 7], [4, 8]]), YoungTableau{Int64}([[1, 2, 4], [3, 6, 7], [5, 8]]))
julia> P
3×3 YoungTableau{Int64}
┌───┬───┬───┐
│ 1 │ 2 │ 5 │
├───┼───┼───┤
│ 3 │ 6 │ 7 │
├───┼───┼───┘
│ 4 │ 8 │
└───┴───┘
julia> Q
3×3 YoungTableau{Int64}
┌───┬───┬───┐
│ 1 │ 2 │ 4 │
├───┼───┼───┤
│ 3 │ 6 │ 7 │
├───┼───┼───┘
│ 5 │ 8 │
└───┴───┘
Broadcasting works just like with arrays!
julia> P .+ Q
3×3 YoungTableau{Int64}
┌────┬────┬────┐
│ 2 │ 4 │ 9 │
├────┼────┼────┤
│ 6 │ 12 │ 14 │
├────┼────┼────┘
│ 9 │ 16 │
└────┴────┘
Partitions are just like Young Tableaux, but without entries. When iterating a
partition only true
is returned. Indices of the square can be computed using
eachindex
.
julia> Partition([3, 3, 2])
3×3 Partition
┌───┬───┬───┐
│ │ │ │
├───┼───┼───┤
│ │ │ │
├───┼───┼───┘
│ │ │
└───┴───┘
julia> eachindex(Partition([3, 3, 2]))
3×3 YoungTableaux.EachIndexOf{Partition}
┌─────┬─────┬─────┐
│ 1,1 │ 1,2 │ 1,3 │
├─────┼─────┼─────┤
│ 2,1 │ 2,2 │ 2,3 │
├─────┼─────┼─────┘
│ 3,1 │ 3,2 │
└─────┴─────┘
The partition corresponding to a Young Tableaux can be requested using
shape
, which will return a lazy wrapper:
julia> shape(P)
3×3 YoungTableaux.PartitionOf{YoungTableau{Int64}}
┌───┬───┬───┐
│ │ │ │
├───┼───┼───┤
│ │ │ │
├───┼───┼───┘
│ │ │
└───┴───┘
Addition and substraction work as defined in Macdonald: "Symmetric Functions and Hall Polynomials"
julia> shape(P) - Partition([2, 1])
3×3 SkewPartition
┌───┬───┬───┐
│ │ │ * │
├───┼───┼───┤
│ │ * │ * │
├───┼───┼───┘
│ * │ * │
└───┴───┘
julia> shape(P) + Partition([2, 1])
3×5 Partition
┌───┬───┬───┬───┬───┐
│ │ │ │ │ │
├───┼───┼───┼───┼───┘
│ │ │ │ │
├───┼───┼───┴───┘
│ │ │
└───┴───┘
There is also initial support for conjugating diagrams using the adjoint operator like with regular matrices. It is currently implemented lazily but this may be subject to change.
julia> P'
3×3 YoungTableaux.ConjugateDiagram{Int64, YoungTableau{Int64}}
┌───┬───┬───┐
│ 1 │ 3 │ 4 │
├───┼───┼───┤
│ 2 │ 6 │ 8 │
├───┼───┼───┘
│ 5 │ 7 │
└───┴───┘