Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "SUNRepresentations"
uuid = "1a50b95c-7aac-476d-a9ce-2bfc675fc617"
authors = ["Maarten Van Damme <Maarten.VanDamme@UGent.be>, Jutho Haegeman <jutho.haegeman@ugent.be> and Lukas Devos <lukas.devos@UGent.be>"]
version = "0.3.4"
version = "0.3.5"

[deps]
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
Expand Down Expand Up @@ -35,7 +35,7 @@ RationalRoots = "0.1 - 0.2"
Scratch = "1"
SparseArrayKit = "0.4"
TensorKit = "0.15, 0.16"
TensorKitSectors = "0.3"
TensorKitSectors = "0.3.5"
TensorOperations = "5"
Test = "1"
TestExtras = "0.3"
Expand Down
2 changes: 1 addition & 1 deletion src/clebschgordan.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function weightmap(basis)
return weights
end

CGC(s1::I, s2::I, s3::I) where {I <: SUNIrrep} = CGC(Float64, s1, s2, s3)
CGC(s1::I, s2::I, s3::I) where {I <: SUNIrrep} = CGC(sectorscalartype(I), s1, s2, s3)
function CGC(::Type{T}, s1::SUNIrrep{N}, s2::SUNIrrep{N}, s3::SUNIrrep{N}) where {T, N}
return _get_CGC(T, (s1, s2, s3))
end
Expand Down
17 changes: 12 additions & 5 deletions src/sector.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,24 @@ function TensorKitSectors.Nsymbol(
return get(directproduct(s1, s2), s3, 0)
end

TensorKitSectors.sectorscalartype(::Type{<:SUNIrrep}) = Float64
function TensorKitSectors.fusiontensor(
s1::SUNIrrep{N}, s2::SUNIrrep{N}, s3::SUNIrrep{N}
) where {N}
return CGC(Float64, s1, s2, s3)
return CGC(s1, s2, s3)
end

const FCACHE = LRU{Int, Any}(; maxsize = 10)

TensorKitSectors.fusionscalartype(::Type{<:SUNIrrep}) = Float64

function TensorKitSectors.Fsymbol(
a::SUNIrrep{N}, b::SUNIrrep{N}, c::SUNIrrep{N},
d::SUNIrrep{N}, e::SUNIrrep{N}, f::SUNIrrep{N}
) where {N}
key = (a, b, c, d, e, f)
K = typeof(key)
V = Array{Float64, 4}
V = Array{fusionscalartype(typeof(a)), 4}
cache::LRU{K, V} = get!(FCACHE, N) do
return LRU{K, V}(; maxsize = 10^5)
end
Expand All @@ -76,7 +80,8 @@ function _Fsymbol(
N3 = Nsymbol(b, c, f)
N4 = Nsymbol(a, f, d)

(N1 == 0 || N2 == 0 || N3 == 0 || N4 == 0) && return fill(0.0, N1, N2, N3, N4)
(N1 == 0 || N2 == 0 || N3 == 0 || N4 == 0) &&
return fill(zero(fusionscalartype(typeof(a))), N1, N2, N3, N4)

# computing first diagonal element
A = fusiontensor(a, b, e)
Expand All @@ -90,10 +95,11 @@ function _Fsymbol(
end

const RCACHE = LRU{Int, Any}(; maxsize = 10)
TensorKitSectors.braidingscalartype(::Type{<:SUNIrrep}) = Float64
function TensorKitSectors.Rsymbol(a::SUNIrrep{N}, b::SUNIrrep{N}, c::SUNIrrep{N}) where {N}
key = (a, b, c)
K = typeof(key)
V = Array{Float64, 2}
V = Array{braidingscalartype(typeof(a)), 2}
cache::LRU{K, V} = get!(RCACHE, N) do
return LRU{K, V}(; maxsize = 10^5)
end
Expand All @@ -105,7 +111,8 @@ function _Rsymbol(a::SUNIrrep{N}, b::SUNIrrep{N}, c::SUNIrrep{N}) where {N}
N1 = Nsymbol(a, b, c)
N2 = Nsymbol(b, a, c)

(N1 == 0 || N2 == 0) && return fill(0.0, N1, N2)
(N1 == 0 || N2 == 0) &&
return fill(zero(braidingscalartype(typeof(a))), N1, N2)

A = fusiontensor(a, b, c)[:, :, 1, :]
B = fusiontensor(b, a, c)[:, :, 1, :]
Expand Down