Skip to content

Commit

Permalink
Only return multiplicities from blockdiag
Browse files Browse the repository at this point in the history
  • Loading branch information
dlfivefifty committed Oct 8, 2024
1 parent b129d05 commit 27abdc4
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "NumericalRepresentationTheory"
uuid = "6b7c1d51-ecee-4149-97a8-50646b514dce"
authors = ["Sheehan Olver <[email protected]>"]
version = "0.3.0"
version = "0.4.0"

[deps]
BlockArrays = "8e7c35d0-a365-5155-bbbb-fb81a777f24e"
Expand Down
42 changes: 34 additions & 8 deletions src/NumericalRepresentationTheory.jl
Original file line number Diff line number Diff line change
Expand Up @@ -278,15 +278,46 @@ end
irrepgenerators::Partition) = [irrepgenerator(σ, i) for i=1:Int(σ)-1]


"""
Representation([τ₁,…,τₙ])
is a representation of the symmetric group generated by τ₁,…,τₙ.
"""
struct Representation{MT}
generators::Vector{MT}
end


"""
Representation(λ₁::Int, …, λₙ::Int)
Representation(Partition(λ₁, …, λₙ))
both generate the irreducible representation associated with the given partition.
"""
Representation::Int...) = Representation(Partition...))
Representation::Partition) = Representation(irrepgenerators(σ))
Representation{MT}::Representation) where MT = Representation(convert.(MT, ρ.generators))


"""
Representation(::Dict{Partition,Int})
makes a representation corresponding to a direct sum of the irreducible representations encoded in
by the partitions. The partitions are sorted for a consistent ordering.
"""
function Representation(d::Dict{Partition,Int})
kys = sort(collect(keys(d)))

reps = Representation{SparseMatrixCSC{Float64,Int}}[]
for k in kys
irrep = Representation(k)
for j in 1:d[k]
push!(reps, irrep)
end
end
blockdiag(reps...)
end

kron(A::Representation, B::Representation) = Representation(kron.(A.generators, B.generators))

_blockdiag(A::AbstractSparseMatrixCSC...) = blockdiag(A...)
Expand Down Expand Up @@ -513,9 +544,7 @@ function blockdiagonalize(ρ::Representation)
n = length.generators)+1

= similar(Q)
# diagonalised generators
ρd = float.(zero.(ρ.generators))

# diagonalised generators
c = contents2partition(Λ)

k = 0
Expand All @@ -526,13 +555,10 @@ function blockdiagonalize(ρ::Representation)
Q̃ⱼ = singlemultreduce_blockdiag(ρⱼ, Representation(pⱼ))
m = length(j)
Q̃[:,k+1:k+m] = Qⱼ * Q̃ⱼ
irrep = Representation(pⱼ)
for= 1:n-1
ρd[ℓ][k+1:k+m,k+1:k+m] = blockdiag(fill(irrep.generators[ℓ], m÷size(irrep,1))...)
end
k += m
end
Representation(ρd), Q̃

multiplicities(c), Q̃
end

function contents2partition(part::Vector)
Expand Down
6 changes: 3 additions & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import NumericalRepresentationTheory: gelfandbasis, canonicalprojection, singlem

ρ = Representation(Partition([3,2])) Representation(Partition([2,2,1])) Representation(Partition([3,1,1]))
λ,Q = blockdiagonalize(ρ)

for k = 1:length(λ.generators)
@test Q' * ρ.generators[k] * Q λ.generators[k]
irreps = Representation(λ)
for k = 1:length(ρ.generators)
@test Q' * ρ.generators[k] * Q irreps.generators[k]
end

@testset "Rotate irrep" begin
Expand Down

0 comments on commit 27abdc4

Please sign in to comment.