Skip to content

Commit ed09f13

Browse files
authored
Allow twisting of trivial sectors (#240)
* `twist`ing a trivial sector is simple and always allowed * Restrict formatter to v1
1 parent ec7ee9d commit ed09f13

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

.github/workflows/FormatCheck.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
#
3030
# julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter", version="0.13.0"))'
3131
run: |
32-
julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter"))'
32+
julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter", version="1"))'
3333
julia -e 'using JuliaFormatter; format(".", verbose=true)'
3434
- name: Format check
3535
run: |

src/tensors/indexmanipulations.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,13 @@ function twist!(t::AbstractTensorMap, is; inv::Bool=false)
272272
throw(ArgumentError(msg))
273273
end
274274
(BraidingStyle(sectortype(t)) == Bosonic() || isempty(is)) && return t
275+
if BraidingStyle(sectortype(t)) == NoBraiding()
276+
for i in is
277+
cs = sectors(space(t, i))
278+
all(isone, cs) || throw(SectorMismatch(lazy"Cannot twist sectors $cs"))
279+
end
280+
return t
281+
end
275282
N₁ = numout(t)
276283
for (f₁, f₂) in fusiontrees(t)
277284
θ = prod(i -> i <= N₁ ? twist(f₁.uncoupled[i]) : twist(f₂.uncoupled[i - N₁]), is)

0 commit comments

Comments
 (0)