Skip to content

Commit 11c00d6

Browse files
lkdvosclaude
andcommitted
Use renamed fusiontreetranspose in Enzyme rules, unicode subscripts
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 340c0b9 commit 11c00d6

3 files changed

Lines changed: 17 additions & 18 deletions

File tree

‎ext/TensorKitEnzymeExt/utility.jl‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,7 @@ end
144144
@inline EnzymeRules.inactive(::typeof(TensorKit.fusiontrees), ::Any, ::Any, ::Any) = nothing
145145
@inline EnzymeRules.inactive(::typeof(TensorKit.fusiontreebraid), ::Any, ::Any, ::Any) = nothing
146146
@inline EnzymeRules.inactive(::typeof(TensorKit.artin_braid), ::Any, ::Any) = nothing
147-
@inline EnzymeRules.inactive(::typeof(TensorKit.fstranspose), ::Any) = nothing
148-
@inline EnzymeRules.inactive(::typeof(TensorKit.fstranspose), ::Any, ::Any) = nothing
147+
@inline EnzymeRules.inactive(::typeof(TensorKit.fusiontreetranspose), ::Any, ::Any) = nothing
149148
@inline EnzymeRules.inactive(::typeof(TensorKit.product_transform), ::Any...) = nothing
150149
@inline EnzymeRules.inactive(::typeof(TensorKit.treetransposer), ::Any...) = nothing
151150
@inline EnzymeRules.inactive(::typeof(TensorKit.treebraider), ::Any...) = nothing

‎src/fusiontrees/braiding_manipulations.jl‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -287,11 +287,11 @@ function braid(src::Union{FusionTreePair, FusionTreeBlock}, p::Index2Tuple, leve
287287
return fusiontreebraid(src, p, levels)
288288
end
289289
function braid(src::ProductSectorBlock, p::Index2Tuple, levels::Index2Tuple)
290-
isempty(src) && return fsbraid((src, p, levels))
290+
isempty(src) && return fusiontreebraid(src, p, levels)
291291
# the return type is asserted since inference gives up on the recursion on older Julia versions
292292
return product_transform(sectorscalartype(sectortype(src)), src) do x
293293
return braid(x, p, levels)
294-
end::_fsdicttype(typeof((src, p, levels)))
294+
end::fusiontreebraidtype(src, p)
295295
end
296296

297297
# Braiding can promote real fusion coefficients to complex values. Keep the result
@@ -312,19 +312,19 @@ end
312312
src::Union{FusionTreePair{I}, FusionTreeBlock{I}},
313313
p::Index2Tuple{N₁, N₂}, levels::Index2Tuple
314314
)::fusiontreebraidtype(src, p) where {I, N₁, N₂}
315-
p1, p2 = p
316-
l1, l2 = levels
315+
p₁, p₂ = p
316+
l₁, l₂ = levels
317317
if src isa FusionTreePair
318318
f₁, f₂ = src
319-
p′ = linearizepermutation(p1, p2, length(f₁), length(f₂))
320-
levels = (l1..., reverse(l2)...)
321-
(f, f0), coeff1 = repartition((f₁, f₂), N₁ + N₂)
322-
f′, coeff2 = braid(f, p′, levels)
323-
(f₁′, f₂′), coeff3 = repartition((f′, f0), N₁)
324-
return (f₁′, f₂′) => coeff1 * coeff2 * coeff3
319+
p′ = linearizepermutation(p₁, p₂, length(f₁), length(f₂))
320+
levels = (l₁..., reverse(l₂)...)
321+
(f, f₀), coeff₁ = repartition((f₁, f₂), N₁ + N₂)
322+
f′, coeff₂ = braid(f, p′, levels)
323+
(f₁′, f₂′), coeff₃ = repartition((f′, f₀), N₁)
324+
return (f₁′, f₂′) => coeff₁ * coeff₂ * coeff₃
325325
else
326-
p′ = linearizepermutation(p1, p2, numout(src), numin(src))
327-
levels = (l1..., reverse(l2)...)
326+
p′ = linearizepermutation(p₁, p₂, numout(src), numin(src))
327+
levels = (l₁..., reverse(l₂)...)
328328

329329
dst, U = repartition(src, numind(src))
330330

‎src/fusiontrees/duality_manipulations.jl‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -527,11 +527,11 @@ function Base.transpose(src::Union{FusionTreePair, FusionTreeBlock}, p::Index2Tu
527527
return fusiontreetranspose(src, p)
528528
end
529529
function Base.transpose(src::ProductSectorBlock, p::Index2Tuple)
530-
isempty(src) && return fstranspose((src, p))
530+
isempty(src) && return fusiontreetranspose(src, p)
531531
# the return type is asserted since inference gives up on the recursion on older Julia versions
532532
return product_transform(fusionscalartype(sectortype(src)), src) do x
533533
return transpose(x, p)
534-
end::_fsdicttype(typeof((src, p)))
534+
end::fusiontreetransposetype(src, p)
535535
end
536536

537537
Base.@assume_effects :foldable function fusiontreetransposetype(
@@ -549,10 +549,10 @@ end
549549
@cached function fusiontreetranspose(
550550
src::Union{FusionTreePair{I}, FusionTreeBlock{I}}, p::Index2Tuple{N₁, N₂}
551551
)::fusiontreetransposetype(src, p) where {I, N₁, N₂}
552-
p1, p2 = p
552+
p₁, p₂ = p
553553

554554
N = N₁ + N₂
555-
p = linearizepermutation(p1, p2, numout(src), numin(src))
555+
p = linearizepermutation(p₁, p₂, numout(src), numin(src))
556556

557557
dst, U = repartition(src, N₁)
558558
length(p) == 0 && return dst => U

0 commit comments

Comments
 (0)