combinatorics.at

Combinatorial functions: binomial and multinomial coefficients, integer partitions, and Young tableau operations.

Lines:
1159
Definitions:
122
Dependencies:
basic.atsort.atgroups.at
Source:
GitHub
Mathematical background

Includes binomial coefficients \(\binom{n}{k}\) for integer and rational \(n\), multinomials, integer partitions (represented as decreasing sequences), and operations on Young diagrams and tableaux.

Definitions

NameSignatureDescription
binom(int n, int k) = int:
binom(rat n, int k) = rat:
multinom([int] a) = int: { multinomial coefficient, upper index implicit }multinomial coefficient, upper index implicit
multi_choose(int n,int k) = int: binom(n+k-1,k)
falling_power(int n, int k) = int: assert(@:k>=0,"Negative exponent");
rising_power(int n, int k) = int: assert(@:k>=0,"Negative exponent");
combination_encodelist) = int: { |list| strictly increasing }|list| strictly increasing
combination_decodek) = (int->[int]):
even_places([int] v) = for i:-(-#v)\2 do v[2*i] od
odd_places([int] v) = for i:#v\2 do v[2*i+1] od
is_permutation(vec v) = bool:
permutation_matrix(Permutation pi) = mat:
permutation(mat P) { assumed a permutation matrix} = Permutation:assumed a permutation matrix
compose_permutations(Permutation sigma, Permutation pi) = Permutation:
inverse(Permutation pi) = Permutation: { hope the name causes no conflict }hope the name causes no conflict
permutation_inverse(Permutation pi) = Permutation:
permutation_product(mat M) = Permutation:
cyclic_permutation(int n) = ([int] cycle) Permutation:
cycle_product(int n) = ([[int]]->Permutation):
permute(Permutation pi,vec v) = vec:
permute(Permutation pi,[T]a) = [T]:
permutation_act(Permutation sigma, mat M) = mat:
permutation_right_act(mat M,Permutation sigma) = mat:
permute_rows= permutation_act@(Permutation,mat)
permute_columns(Permutation sigma,mat M) = mat:
permutation_conjugation(Permutation sigma, mat M) = mat:
permutation_cycles(Permutation pi) = [[int]]:
permutation_encode(Permutation sigma) = int:
permutation_decodecode, int n) = Permutation:
permutation_iterator(vec pi) = Iterator<vec>:
permutationsxs) = [[T]]:
root_orbits(WeylElt w) = [[int]]:
multiset_permutations([int] multiplicities) = [[int]]:
strip_to_partition(Partition lambda) = [int]:
is_partition([int] seq) = bool: backward_differences(seq).>=
frequencies(Partition lambda) = vec: { frequency vector, position 0 unused }frequency vector, position 0 unused
repeat_parts(vec frequencies) = Partition:
sort_to_partition([int] parts) = Partition:
cycle_type([int] pi) = Partition: { cycle sizes in decreasing order }cycle sizes in decreasing order
transpose([int] parts) = Partition:
Levi_A([int] parts) = (int,LieType,[int]): { |(n,Levi_type,simples)| }|(n,Levi_type,simples)|
compressed_stringP) = string:
rlex_leq_partitions(Partition lambda, Partition mu) = bool:
rlex_cmp_partitions(Partition lambda, Partition mu) = int:
slex_leq_partitions((Partition,Partition) (lambda,mu):pair) = bool:
slex_cmp_partitions((Partition,Partition) (lambda,mu):pair) = int:
index_partitionsorted_list) = (Partition->int):
dominance_leq_compositions(Partition v,Partition w) = bool:
dominance_leq_partitions(Partition v,Partition w) = bool:
hook_lengths(Partition lambda) = [int]:
Sn_representation_dimension(Partition lambda) = int:
hook_lengths([bool] edges) = [int]:
edge_sequence(Partition lambda) = ([bool],int):
cycle_type_order= lcm@[int]
cycle_centralizer_order([int] cycles) = int:
cycle_class_size([int] cycles) = int:
cycle_power([int] cycles, int k) = [int]:
Murnaghan_Nakayama(Partition lambda, [int] cycle_type) = int:
partitions= (int n) [Partition]:
part_restricted_partitions((int->bool)pred) =
odd_part_partitions= part_restricted_partitions(is_odd@int)
strict_partitions= (int n) [Partition]:
is_valid(string type,Partition P) = bool:
is_valid(LieType t) = (Partition->bool):
parity_restricted_partitions(bool restrict_odd_parts) = (int->[Partition]):
rank(Signed_cycles cycles) = int: for (c,) in cycles do c od.sum
rank(BiPartition(lambda,mu)) = int: lambda.sum+mu.sum
=(Signed_cycles cyc0,Signed_cycles cyc1) = bool:
!(Signed_cycles cyc0,Signed_cycles cyc1) = bool: not(cyc0=cyc1)
same_as(Signed_cycles cyc) = (Signed_cycles->bool):
to_cycles(BiPartition(lambda,mu)) = Signed_cycles:
to_partition_paircy) = BiPartition:
pairs_of_total_sum(int n,(int->[Partition]) lister) = [BiPartition]:
partition_pairs(int n) = [BiPartition]:
=(BiPartition (P,Q), BiPartition (R,S)) = bool: P=R and Q=S
<=(P,Q), BiPartition (R,S)) = bool:
index_bipartition([BiPartition] sorted_list) = (BiPartition->int):
hyperoctahedral_character(
core_length(int n) = int: if n.<= then 2*-n else 2*n-1 fi
core_number(int k) = int: assert(@:k>=0); case k in -k\2, -k\-2 esac
core_quotient_2(Partition lambda) = (int,BiPartition):
from_core_quotient_2(int d,BiPartition(lambda,mu)) = Partition:
classic_permutation(WeylElt w) = Permutation:
signed_permutationw) = [int]:
signed_cycle_type_code([int] sigma) = vec:
cycle_codew) = vec: { assuming |w| is for |Sp(2n)| or |SO(m)| }assuming |w| is for |Sp(2n)| or |SO(m)|
as_signed_cycles(vec v) = Signed_cycles:
as_bipartition(vec v) = BiPartition:
signed_cycle_type([int] sigma) = Signed_cycles:
cycle_type_order(Signed_cycles cycles) = int:
cycle_centralizer_order(Signed_cycles cycles) = int:
cycle_class_size(Signed_cycles cycles) = int:
cycle_power(Signed_cycles cycles, int k) = Signed_cycles:
normalize(Symbol S) = Symbol:
symbol(BiPartition(lambda,mu)) = Symbol: { normalized }normalized
symbol_to_bipartition(Symbol S) = BiPartition:
is_special(Symbol S) = bool:
make_special(Symbol S) = Symbol:
make_special(BiPartition bip) = BiPartition:
is_very_even(Partition P) = bool: =P%2 { whether all parts are even }whether all parts are even
is_doubly_even(Partition P) = bool: { even parts even multiplicities only }even parts even multiplicities only
rank(D_class c) = int:
rank(D_irrep chi) = int:
cycle_type_order(D_class c) = int:
centralizer_order(D_class c) = int:
class_size(D_class c) = int:
cycle_power(D_class c, int k) = D_class:
to_D_class([int] sigma) { as from |classic_permutation } = D_class:as from |classic_permutation
same_as(D_class c0) = (D_class->bool):
=(D_class c0, D_class c1) = bool: c0.same_as(c1)
!(D_class c0,D_class c1) = bool: not c0.same_as(c1)
D_classes(int n) = [D_class]:
D_irreducibles(int n) = [D_irrep]:
less_eq(D_class elt) = (D_class->bool):
<=(D_class a,D_class b) = bool: a.(less_eq(b)) { i.e., |less_eq(b)(a)| }i.e., |less_eq(b)(a)|
index_D_classes([D_class] sorted_list) = (D_class->int):
same_as(D_irrep chi) = (D_irrep->bool):
=(D_irrep c0, D_irrep c1) = bool: c0.same_as(c1)
!(D_irrep c0,D_irrep c1) = bool: not c0.same_as(c1)
make_special(D_irrep chi) = D_irrep:
character(D_irrep chi, D_class c) = int:
compressed_string= string: