diff --git a/TensorKitSectors/src/TensorKitSectors.jl b/TensorKitSectors/src/TensorKitSectors.jl index de4fcee3..34bedb9f 100644 --- a/TensorKitSectors/src/TensorKitSectors.jl +++ b/TensorKitSectors/src/TensorKitSectors.jl @@ -10,7 +10,7 @@ export Sector, Group, AbstractIrrep export Irrep export Nsymbol, Fsymbol, Rsymbol, Asymbol, Bsymbol -export Feltype, Reltype +export Fscalartype, Rscalartype export dim, sqrtdim, invsqrtdim, frobeniusschur, twist, fusiontensor, dual export otimes, deligneproduct, times export FusionStyle, UniqueFusion, MultipleFusion, SimpleFusion, GenericFusion, diff --git a/TensorKitSectors/src/irreps.jl b/TensorKitSectors/src/irreps.jl index a679877e..29450be9 100644 --- a/TensorKitSectors/src/irreps.jl +++ b/TensorKitSectors/src/irreps.jl @@ -201,23 +201,23 @@ Base.isreal(::Type{SU2Irrep}) = true Nsymbol(sa::SU2Irrep, sb::SU2Irrep, sc::SU2Irrep) = WignerSymbols.δ(sa.j, sb.j, sc.j) -Feltype(::Type{SU2Irrep}) = Float64 +Fscalartype(::Type{SU2Irrep}) = Float64 function Fsymbol(s1::SU2Irrep, s2::SU2Irrep, s3::SU2Irrep, s4::SU2Irrep, s5::SU2Irrep, s6::SU2Irrep) if all(==(_su2one), (s1, s2, s3, s4, s5, s6)) return 1.0 else return sqrtdim(s5) * sqrtdim(s6) * - WignerSymbols.racahW(Feltype(SU2Irrep), s1.j, s2.j, + WignerSymbols.racahW(Fscalartype(SU2Irrep), s1.j, s2.j, s4.j, s3.j, s5.j, s6.j) end end -Reltype(::Type{SU2Irrep}) = Feltype(SU2Irrep) +Rscalartype(::Type{SU2Irrep}) = Fscalartype(SU2Irrep) function Rsymbol(sa::SU2Irrep, sb::SU2Irrep, sc::SU2Irrep) - Nsymbol(sa, sb, sc) || return zero(Reltype(SU2Irrep)) - return iseven(convert(Int, sa.j + sb.j - sc.j)) ? one(Reltype(SU2Irrep)) : - -one(Reltype(SU2Irrep)) + Nsymbol(sa, sb, sc) || return zero(Rscalartype(SU2Irrep)) + return iseven(convert(Int, sa.j + sb.j - sc.j)) ? one(Rscalartype(SU2Irrep)) : + -one(Rscalartype(SU2Irrep)) end function fusiontensor(a::SU2Irrep, b::SU2Irrep, c::SU2Irrep) @@ -354,7 +354,7 @@ function Nsymbol(a::CU1Irrep, b::CU1Irrep, c::CU1Irrep) (c.j == a.j + b.j) | (c.j == abs(a.j - b.j)))) end -Feltype(::Type{CU1Irrep}) = Float64 +Fscalartype(::Type{CU1Irrep}) = Float64 function Fsymbol(a::CU1Irrep, b::CU1Irrep, c::CU1Irrep, d::CU1Irrep, e::CU1Irrep, f::CU1Irrep) Nabe = convert(Int, Nsymbol(a, b, e)) @@ -362,7 +362,7 @@ function Fsymbol(a::CU1Irrep, b::CU1Irrep, c::CU1Irrep, Nbcf = convert(Int, Nsymbol(b, c, f)) Nafd = convert(Int, Nsymbol(a, f, d)) - T = Feltype(CU1Irrep) + T = Fscalartype(CU1Irrep) Nabe * Necd * Nbcf * Nafd == 0 && return zero(T) op = CU1Irrep(0, 0) @@ -393,7 +393,7 @@ function Fsymbol(a::CU1Irrep, b::CU1Irrep, c::CU1Irrep, if d == a if e.j == 0 if f.j == 0 - return f.s == 1 ? T(-0.5) : T(0.5) + return f.s == 1 ? T(-1 // 2) : T(1 // 2) else return e.s == 1 ? -s : s end @@ -443,9 +443,9 @@ function Fsymbol(a::CU1Irrep, b::CU1Irrep, c::CU1Irrep, return one(T) end -Reltype(::Type{CU1Irrep}) = Feltype(CU1Irrep) +Rscalartype(::Type{CU1Irrep}) = Fscalartype(CU1Irrep) function Rsymbol(a::CU1Irrep, b::CU1Irrep, c::CU1Irrep) - R = convert(Reltype(CU1Irrep), Nsymbol(a, b, c)) + R = convert(Rscalartype(CU1Irrep), Nsymbol(a, b, c)) return c.s == 1 && a.j > 0 ? -R : R end diff --git a/TensorKitSectors/src/sectors.jl b/TensorKitSectors/src/sectors.jl index 46027c12..203c330e 100644 --- a/TensorKitSectors/src/sectors.jl +++ b/TensorKitSectors/src/sectors.jl @@ -81,9 +81,9 @@ which case it is complex). """ function Base.isreal(I::Type{<:Sector}) if BraidingStyle(I) isa HasBraiding - return Feltype(I) <: Real && Reltype(I) <: Real + return Fscalartype(I) <: Real && Rscalartype(I) <: Real else - return Feltype(I) <: Real + return Fscalartype(I) <: Real end end @@ -183,7 +183,7 @@ it is a rank 4 array of size function Fsymbol end # scalar type of the F symbols -Feltype(I::Type{<:Sector}) = eltype(Core.Compiler.return_type(Fsymbol, NTuple{6,I})) +Fscalartype(I::Type{<:Sector}) = eltype(Core.Compiler.return_type(Fsymbol, NTuple{6,I})) # If a I::Sector with `fusion(I) == GenericFusion` fusion wants to have custom vertex # labels, a specialized method for `vertindex2label` should be added @@ -330,7 +330,7 @@ number. Otherwise it is a square matrix with row and column size """ function Rsymbol end -Reltype(I::Type{<:Sector}) = eltype(Core.Compiler.return_type(Rsymbol, NTuple{3,I})) +Rscalartype(I::Type{<:Sector}) = eltype(Core.Compiler.return_type(Rsymbol, NTuple{3,I})) # properties that can be determined in terms of the R symbol diff --git a/src/fusiontrees/manipulations.jl b/src/fusiontrees/manipulations.jl index 95d9778a..07238257 100644 --- a/src/fusiontrees/manipulations.jl +++ b/src/fusiontrees/manipulations.jl @@ -17,7 +17,7 @@ function insertat(f₁::FusionTree{I}, i::Int, f₂::FusionTree{I,0}) where {I} # this actually removes uncoupled line i, which should be trivial (f₁.uncoupled[i] == f₂.coupled && !f₁.isdual[i]) || throw(SectorMismatch("cannot connect $(f₂.uncoupled) to $(f₁.uncoupled[i])")) - coeff = one(Feltype(I)) + coeff = one(Fscalartype(I)) uncoupled = TupleTools.deleteat(f₁.uncoupled, i) coupled = f₁.coupled @@ -39,7 +39,7 @@ function insertat(f₁::FusionTree{I}, i, f₂::FusionTree{I,1}) where {I} # identity operation (f₁.uncoupled[i] == f₂.coupled && !f₁.isdual[i]) || throw(SectorMismatch("cannot connect $(f₂.uncoupled) to $(f₁.uncoupled[i])")) - coeff = one(Feltype(I)) + coeff = one(Fscalartype(I)) isdual′ = TupleTools.setindex(f₁.isdual, f₂.isdual[1], i) f = FusionTree{I}(f₁.uncoupled, f₁.coupled, isdual′, f₁.innerlines, f₁.vertices) return fusiontreedict(I)(f => coeff) @@ -59,7 +59,7 @@ function insertat(f₁::FusionTree{I}, i, f₂::FusionTree{I,2}) where {I} isdual′ = (isdualb, isdualc, tail(isdual)...) inner′ = (uncoupled[1], inner...) vertices′ = (f₂.vertices..., f₁.vertices...) - coeff = one(Feltype(I)) + coeff = one(Fscalartype(I)) f′ = FusionTree(uncoupled′, coupled, isdual′, inner′, vertices′) return fusiontreedict(I)(f′ => coeff) end @@ -110,7 +110,7 @@ function insertat(f₁::FusionTree{I,N₁}, i, f₂::FusionTree{I,N₂}) where { F = fusiontreetype(I, N₁ + N₂ - 1) (f₁.uncoupled[i] == f₂.coupled && !f₁.isdual[i]) || throw(SectorMismatch("cannot connect $(f₂.uncoupled) to $(f₁.uncoupled[i])")) - coeff = one(Feltype(I)) + coeff = one(Fscalartype(I)) T = typeof(coeff) if length(f₁) == 1 return fusiontreedict(I){F,T}(f₂ => coeff) @@ -457,7 +457,7 @@ function _recursive_repartition(f₁::FusionTree{I,N₁}, # precompute the parameters of the return type F₁ = fusiontreetype(I, N) F₂ = fusiontreetype(I, N₁ + N₂ - N) - coeff = one(Feltype(I)) + coeff = one(Fscalartype(I)) T = typeof(coeff) if N == N₁ return fusiontreedict(I){Tuple{F₁,F₂},T}((f₁, f₂) => coeff) @@ -500,7 +500,7 @@ function Base.transpose(f₁::FusionTree{I}, f₂::FusionTree{I}, p = linearizepermutation(p1, p2, length(f₁), length(f₂)) @assert iscyclicpermutation(p) if usetransposecache[] - T = Feltype(I) + T = Fscalartype(I) F₁ = fusiontreetype(I, N₁) F₂ = fusiontreetype(I, N₂) D = fusiontreedict(I){Tuple{F₁,F₂},T} @@ -586,7 +586,7 @@ function planar_trace(f₁::FusionTree{I}, f₂::FusionTree{I}, map(l -> l - count(l .> q′), TupleTools.getindices(linearindex, p2))) end - T = Feltype(I) + T = Fscalartype(I) F₁ = fusiontreetype(I, N₁) F₂ = fusiontreetype(I, N₂) newtrees = FusionTreeDict{Tuple{F₁,F₂},T}() @@ -613,7 +613,7 @@ of output trees and corresponding coefficients. """ function planar_trace(f::FusionTree{I,N}, q1::IndexTuple{N₃}, q2::IndexTuple{N₃}) where {I<:Sector,N,N₃} - T = Feltype(I) + T = Fscalartype(I) F = fusiontreetype(I, N - 2 * N₃) newtrees = FusionTreeDict{F,T}() N₃ === 0 && return push!(newtrees, f => one(T)) @@ -670,7 +670,7 @@ function elementary_trace(f::FusionTree{I,N}, i) where {I<:Sector,N} i < N || f.coupled == one(I) || throw(ArgumentError("Cannot trace outputs i=$N and 1 of fusion tree that couples to non-trivial sector")) - T = Feltype(I) + T = Fscalartype(I) F = fusiontreetype(I, N - 2) newtrees = FusionTreeDict{F,T}() @@ -784,9 +784,9 @@ function artin_braid(f::FusionTree{I,N}, i; inv::Bool=false) where {I<:Sector,N} u = one(I) if BraidingStyle(I) isa NoBraiding - oneT = one(Feltype(I)) + oneT = one(Fscalartype(I)) else - oneT = one(Feltype(I)) * one(Reltype(I)) + oneT = one(Fscalartype(I)) * one(Rscalartype(I)) end if u in (uncoupled[i], uncoupled[i + 1]) @@ -921,7 +921,7 @@ function braid(f::FusionTree{I,N}, p::NTuple{N,Int}) where {I<:Sector,N} TupleTools.isperm(p) || throw(ArgumentError("not a valid permutation: $p")) if FusionStyle(I) isa UniqueFusion && BraidingStyle(I) isa SymmetricBraiding - coeff = Rsymbol(one(I), one(I), one(I)) # one(Reltype(I)) ? + coeff = one(Rscalartype(I)) for i in 1:N for j in 1:(i - 1) if p[j] > p[i] @@ -936,8 +936,8 @@ function braid(f::FusionTree{I,N}, f′ = FusionTree{I}(uncoupled′, coupled′, isdual′) return fusiontreedict(I)(f′ => coeff) else - T = BraidingStyle(I) isa NoBraiding ? Feltype(I) : - typeof(one(Feltype(I)) * one(Reltype(I))) + T = BraidingStyle(I) isa NoBraiding ? Fscalartype(I) : + typeof(one(Fscalartype(I)) * one(Rscalartype(I))) coeff = one(T) trees = FusionTreeDict(f => coeff) newtrees = empty(trees) @@ -1014,8 +1014,7 @@ function braid(f₁::FusionTree{I}, f₂::FusionTree{I}, else if usebraidcache_nonabelian[] T = BraidingStyle(I) isa NoBraiding ? - Feltype(I) : - typeof(one(Feltype(I)) * one(Reltype(I)) * sqrtdim(one(I))) # do we need sqrtdim here ? + Fscalartype(I) : typeof(one(Fscalartype(I)) * one(Rscalartype(I))) F₁ = fusiontreetype(I, N₁) F₂ = fusiontreetype(I, N₂) D = FusionTreeDict{Tuple{F₁,F₂},T}