Skip to content

Commit afe8123

Browse files
committed
More fixes for documentation
1 parent 77db66d commit afe8123

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

src/youngdiagrams.jl

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
# Young diagrams, partitions of unity and characters of the symmetric group Sn #
33
################################################################################
44

5-
typealias Partition Vector{Int64}
6-
typealias YoungDiagram Array{Int64,2}
5+
typealias Partition Vector{Int}
6+
typealias YoungDiagram Array{Int,2}
77
typealias SkewDiagram Tuple{Partition, Partition}
88

99
export Partition,
@@ -20,15 +20,15 @@ import Base.\
2020
# Skew diagrams #
2121
#################
2222

23-
#This uses a very simple internal representation for skew diagrams
23+
"This uses a very simple internal representation for skew diagrams"
2424
\::Partition, μ::Partition) = MakeSkewDiagram(λ, μ)
2525
function MakeSkewDiagram::Partition, μ::Partition)
2626
m, n = length(λ), length(μ)
2727
if n>m error("Cannot construct skew diagram") end
2828
(λ, μ)
2929
end
3030

31-
#Checks if skew diagram is a rim hook
31+
"Checks if skew diagram is a rim hook"
3232
isrimhook::Partition, μ::Partition)=isrimhook\ μ)
3333
function isrimhook::SkewDiagram)
3434
λ, μ = ξ
@@ -37,7 +37,7 @@ function isrimhook(ξ::SkewDiagram)
3737
#Construct matrix representation of diagram
3838
#XXX This is a horribly inefficient way of checking condition 1!
3939
l = maximum(λ)
40-
youngdiagram=zeros(Int64, m, l)
40+
youngdiagram=zeros(Int, m, l)
4141
for i=1:n
4242
youngdiagram[i, μ[i]+1:λ[i]]=1
4343
end
@@ -73,14 +73,14 @@ function isrimhook(ξ::SkewDiagram)
7373
end
7474

7575

76-
#Strictly speaking, defined for rim hook only, but here we define it for all skew diagrams
76+
"Strictly speaking, defined for rim hook only, but here we define it for all skew diagrams"
7777
leglength::Partition, μ::Partition)=leglength((λ \ μ))
7878
function leglength::SkewDiagram)
7979
λ, μ = ξ
8080
m, n = length(λ), length(μ)
8181
#Construct matrix representation of diagram
8282
l = maximum(λ)
83-
youngdiagram=zeros(Int64, m, l)
83+
youngdiagram=zeros(Int, m, l)
8484
for i=1:n
8585
youngdiagram[i, μ[i]+1:λ[i]]=1
8686
end
@@ -100,7 +100,7 @@ end
100100

101101
"Computes essential part of the partition sequence of lambda"
102102
function partitionsequence(lambda::Partition)
103-
Λ▔ = Int64[]
103+
Λ▔ = Int[]
104104
λ = [lambda; 0]
105105
m = length(lambda)
106106
for i=m:-1:1
@@ -112,16 +112,16 @@ function partitionsequence(lambda::Partition)
112112
Λ▔
113113
end
114114

115-
#This takes two elements of a partition sequence, with a to the left of b
116-
isrimhook(a::Int64, b::Int64) = (a==1) && (b==0)
115+
"Takes two elements of a partition sequence, with a to the left of b"
116+
isrimhook(a::Int, b::Int) = (a==1) && (b==0)
117117

118118

119119
#############################
120120
# Character of irreps of Sn #
121121
#############################
122122

123-
#Computes recursively using the Murnaghan-Nakayama rule.
124-
function MN1inner(R::Vector{Int64}, T::Dict, μ::Partition, t::Integer)
123+
"Computes recursively using the Murnaghan-Nakayama rule."
124+
function MN1inner(R::Vector{Int}, T::Dict, μ::Partition, t::Integer)
125125
s=length(R)
126126
χ::Integer=1
127127
if t<=length(μ)
@@ -145,7 +145,7 @@ function MN1inner(R::Vector{Int64}, T::Dict, μ::Partition, t::Integer)
145145
χ
146146
end
147147

148-
"""
148+
doc"""
149149
Computes character ^λ(μ)$ of the partition μ in the λth irrep of the
150150
symmetric group $S_n$
151151
@@ -156,7 +156,7 @@ Implements the Murnaghan-Nakayama algorithm as described in:
156156
doi:10.1016/j.jsc.2003.11.001
157157
"""
158158
function character::Partition, μ::Partition)
159-
T = Dict(()=>0) #Sparse array implemented as dict
159+
T = Dict{Any,Int}(()=>0) #Sparse array implemented as dict
160160
Λ▔ = partitionsequence(λ)
161161
MN1inner(Λ▔, T, μ, 1)
162162
end

test/partitions.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Combinatorics
22
using Base.Test
3+
import Combinatorics: partitions, prevprod
34

45
@test collect(partitions(4)) == Any[[4], [3,1], [2,2], [2,1,1], [1,1,1,1]]
56
@test collect(partitions(8,3)) == Any[[6,1,1], [5,2,1], [4,3,1], [4,2,2], [3,3,2]]

0 commit comments

Comments
 (0)