-
Notifications
You must be signed in to change notification settings - Fork 5
Simple multifusion example for testing #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 18 commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
611fcde
add bimodule sector
borisdevos cb2e94f
clean up
borisdevos ef32b2a
remove abstract type `Bimodule` + remove `vertex_labeltype` and `scal…
borisdevos b9ab369
add `SectorValues` properties for `IsingBimod`
borisdevos 73ed396
define `getindex` for `CatType` for parsability
borisdevos 00bfc7f
change Nsymbol to check whether fusions at categorical level are allowed
borisdevos 9222c88
add tests for `IsingBimod`
borisdevos acd63c9
comments on parsability and `CatType`
borisdevos d85294b
export stuff
borisdevos 345e318
fix tests because i'm a silly goose
borisdevos e55230c
some cleanup
borisdevos 8199072
fix test error
borisdevos e20f9a8
potential format fix
borisdevos a54ed80
other potential format fix
borisdevos f484f34
replace `isModule` with `ismodulecategory`
borisdevos cfe287e
change `IteratorSize` of custom iterator and remove its `Base.length`…
borisdevos 036ea10
get rid of braiding properties
borisdevos e362094
use `ismodulecategory` in `Nsymbol`
borisdevos 92530ba
use lazy construction + change `show` to 3-argument
borisdevos 17038ad
remove explicit conversion in `dim`
borisdevos 73acc95
move tests + add pentagon and unitarity check
borisdevos fa1e407
update pentagon check
borisdevos 53fa0c6
include new test file
borisdevos afae67f
refactor `IsingBimod` to get rid of `CatType`
borisdevos 708f2d7
shorten `Base.iterate` and `Nsymbol`
borisdevos 208e254
update pentagon check
borisdevos be8b265
increase patch coverage via printing and error tests
borisdevos f8a311c
use `repr` for 3-arg `show` tests
borisdevos 569392e
get rid of `isC` and friends
borisdevos 7b6a56e
Improve checks
lkdvos 2f937d0
Format
lkdvos 56ac007
Update formatter action
lkdvos b1ce6ef
More formatting updates
lkdvos 8a748c6
Simplify `isless`
lkdvos dc37053
remove custom `show` and update related tests
borisdevos 2fd7df4
apply suggestions
borisdevos 5d9f14e
remove +0
borisdevos d45c819
Last small fixes
lkdvos ccf3067
fix small fixes
lkdvos adc70f5
Bump v0.1.6
lkdvos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,186 @@ | ||
| # Rep Z2 ⊕ Rep Z2 ≅ Ising is worked out here | ||
| # 𝒞 = 𝒟 = RepZ2 ≅ {1, ψ}, while ℳ = Vec ≅ {σ} | ||
| # this is mainly meant for testing within TensorKit without relying on MultiTensorKit | ||
| #------------------------------------------------------------------------------# | ||
|
|
||
| @enum CatType 𝒞 = 1 ℳ = 3 ℳᵒᵖ = 2 𝒟 = 4 | ||
| # possible TODO: get rid of CatType and use Int instead -> prevents the need to export 𝒞 etc | ||
| function Base.getindex(a::CatType, label::Int) | ||
| return IsingBimod(a, label) | ||
| end | ||
|
|
||
| struct IsingBimod <: Sector | ||
| type::CatType | ||
| label::Int | ||
| function IsingBimod(type::CatType, label::Int) | ||
|
borisdevos marked this conversation as resolved.
Outdated
|
||
| if type == 𝒞 | ||
| 0 ≤ label ≤ 1 || | ||
| throw(ArgumentError("Invalid 𝒞 label for Ising bimodule: $(label)")) | ||
| elseif type == ℳ | ||
| label == 0 || | ||
| throw(ArgumentError("Invalid ℳ label for Ising bimodule: $(label)")) | ||
| elseif type == ℳᵒᵖ | ||
| label == 0 || | ||
| throw(ArgumentError("Invalid ℳᵒᵖ label for Ising bimodule: $(label)")) | ||
| elseif type == 𝒟 | ||
| 0 ≤ label ≤ 1 || | ||
| throw(ArgumentError("Invalid 𝒟 label for Ising bimodule: $(label)")) | ||
| end | ||
|
borisdevos marked this conversation as resolved.
Outdated
|
||
| return new(type, label) | ||
| end | ||
| end | ||
|
|
||
| isC(x::IsingBimod) = x.type == 𝒞 | ||
| isM(x::IsingBimod) = x.type == ℳ | ||
| isMop(x::IsingBimod) = x.type == ℳᵒᵖ | ||
| isD(x::IsingBimod) = x.type == 𝒟 | ||
|
|
||
| function ismodulecategory(a::IsingBimod) | ||
| return a.type in (ℳ, ℳᵒᵖ) | ||
| end | ||
|
|
||
| const all_isingbimod_objects = (IsingBimod(𝒞, 0), IsingBimod(𝒞, 1), IsingBimod(ℳᵒᵖ, 0), | ||
| IsingBimod(ℳ, 0), IsingBimod(𝒟, 0), IsingBimod(𝒟, 1)) | ||
|
|
||
| Base.IteratorSize(::Type{<:SectorValues{IsingBimod}}) = Base.SizeUnknown() | ||
|
lkdvos marked this conversation as resolved.
Outdated
|
||
| Base.iterate(::SectorValues{IsingBimod}, i=1) = iterate(all_isingbimod_objects, i) | ||
| Base.length(::SectorValues{IsingBimod}) = length(all_isingbimod_objects) | ||
|
borisdevos marked this conversation as resolved.
Outdated
|
||
|
|
||
| ⊗(a::IsingBimod, b::IsingBimod) = IsingBimodIterator(a, b) | ||
|
|
||
| struct IsingBimodIterator | ||
| a::IsingBimod | ||
| b::IsingBimod | ||
| end | ||
|
|
||
| Base.IteratorSize(::Type{IsingBimodIterator}) = Base.SizeUnknown() | ||
| Base.IteratorEltype(::Type{IsingBimodIterator}) = Base.HasEltype() | ||
| Base.eltype(::Type{IsingBimodIterator}) = IsingBimod | ||
|
|
||
| function Base.iterate(iter::IsingBimodIterator, state=0) | ||
| if isC(iter.a) && isC(iter.b) # 𝒞 × 𝒞 -> 𝒞 | ||
| return state == 0 ? (IsingBimod(𝒞, mod(iter.a.label + iter.b.label, 2)), 1) : | ||
| nothing | ||
| end | ||
|
|
||
| if isD(iter.a) && isD(iter.b) # 𝒟 × 𝒟 -> 𝒟 | ||
| return state == 0 ? (IsingBimod(𝒟, mod(iter.a.label + iter.b.label, 2)), 1) : | ||
| nothing | ||
| end | ||
|
|
||
| if isM(iter.a) && isMop(iter.b) # ℳ × ℳop -> 𝒞 | ||
| return state < 2 ? (IsingBimod(𝒞, state), state + 1) : nothing | ||
| end | ||
|
|
||
| if isMop(iter.a) && isM(iter.b) # ℳop × ℳ -> 𝒟 | ||
| return state < 2 ? (IsingBimod(𝒟, state), state + 1) : nothing | ||
| end | ||
|
|
||
| if isC(iter.a) && isM(iter.b) # 𝒞 × ℳ -> ℳ | ||
| return state == 0 ? (iter.b, 1) : nothing | ||
| end | ||
|
|
||
| if isMop(iter.a) && isC(iter.b) # ℳop x 𝒞 -> ℳop | ||
| return state == 0 ? (iter.a, 1) : nothing | ||
| end | ||
|
|
||
| if isM(iter.a) && isD(iter.b) # ℳ x 𝒟 -> ℳ | ||
| return state == 0 ? (iter.a, 1) : nothing | ||
| end | ||
|
|
||
| if isD(iter.a) && isMop(iter.b) # 𝒟 x ℳop -> ℳop | ||
| return state == 0 ? (iter.b, 1) : nothing | ||
| end | ||
|
|
||
| return nothing | ||
| end | ||
|
|
||
| function Base.convert(::Type{IsingAnyon}, a::IsingBimod) # identify RepZ2 ⊕ RepZ2 ≅ Ising | ||
| ismodulecategory(a) && return IsingAnyon(:σ) | ||
| return IsingAnyon(a.label == 0 ? :I : :ψ) | ||
| end | ||
|
|
||
| FusionStyle(::Type{IsingBimod}) = SimpleFusion() # no multiplicities | ||
| BraidingStyle(::Type{IsingBimod}) = NoBraiding() # because of module categories | ||
|
|
||
| function Nsymbol(a::IsingBimod, b::IsingBimod, c::IsingBimod) | ||
| # if a and b can fuse, then so can dual(a) and c, and c and dual(b) | ||
| # only needs to be explicitly checked when CatTypes differ or when there's a module category involved | ||
| if a.type != b.type || a.type != c.type || b.type != c.type || | ||
| any(ismodulecategory, (a, b, c)) | ||
| c ∈ a ⊗ b && dual(b) ∈ dual(c) ⊗ a && dual(a) ∈ b ⊗ dual(c) || | ||
| throw(ArgumentError("invalid fusion channel")) | ||
|
lkdvos marked this conversation as resolved.
Outdated
|
||
| end | ||
|
borisdevos marked this conversation as resolved.
|
||
| return Nsymbol(convert(IsingAnyon, a), convert(IsingAnyon, b), convert(IsingAnyon, c)) | ||
| end | ||
|
|
||
| function Fsymbol(a::I, b::I, c::I, d::I, e::I, f::I) where {I<:IsingBimod} | ||
| Nsymbol(a, b, e) && Nsymbol(e, c, d) && | ||
| Nsymbol(b, c, f) && Nsymbol(a, f, d) || return 0.0 | ||
|
borisdevos marked this conversation as resolved.
Outdated
|
||
| return Fsymbol(convert(IsingAnyon, a), convert(IsingAnyon, b), convert(IsingAnyon, c), | ||
| convert(IsingAnyon, d), convert(IsingAnyon, e), convert(IsingAnyon, f)) | ||
| end | ||
|
|
||
| function Base.conj(a::IsingBimod) # ℳ ↔ ℳop when conjugating elements within these | ||
| if isC(a) || isD(a) # self-conjugate within RepZ2 | ||
| return a | ||
| elseif isM(a) | ||
| return IsingBimod(ℳᵒᵖ, a.label) | ||
| else | ||
| return IsingBimod(ℳ, a.label) | ||
| end | ||
| end | ||
|
|
||
| function rightone(a::IsingBimod) | ||
| if isC(a) || isD(a) | ||
| return IsingBimod(a.type, 0) | ||
| elseif isM(a) # ℳ as right-𝒟 module category | ||
| return IsingBimod(𝒟, 0) | ||
| else | ||
| return IsingBimod(𝒞, 0) | ||
| end | ||
| end | ||
|
|
||
| function leftone(a::IsingBimod) | ||
| if isC(a) || isD(a) | ||
| return IsingBimod(a.type, 0) | ||
| elseif isM(a) # ℳ as left-𝒞 module category | ||
| return IsingBimod(𝒞, 0) | ||
| else | ||
| return IsingBimod(𝒟, 0) | ||
| end | ||
| end | ||
|
|
||
| function Base.one(a::IsingBimod) | ||
| if isC(a) || isD(a) | ||
| return IsingBimod(a.type, 0) | ||
| else | ||
| throw(DomainError("unit of module category $(a.type) doesn't exist")) | ||
| end | ||
| end | ||
|
|
||
| Base.one(::Type{IsingBimod}) = throw(ArgumentError("one of Type IsingBimod doesn't exist")) | ||
|
|
||
| Base.isreal(::Type{IsingBimod}) = false | ||
|
borisdevos marked this conversation as resolved.
Outdated
|
||
|
|
||
| function Base.show(io::IO, a::IsingBimod) | ||
| if isC(a) | ||
| print(io, "𝒞[$(a.label)]") | ||
| elseif isM(a) | ||
| print(io, "ℳ[$(a.label)]") | ||
| elseif isMop(a) | ||
| print(io, "ℳᵒᵖ[$(a.label)]") | ||
| elseif isD(a) | ||
| print(io, "𝒟[$(a.label)]") | ||
| end | ||
|
borisdevos marked this conversation as resolved.
Outdated
|
||
| end | ||
|
|
||
| function Base.isless(a::IsingBimod, b::IsingBimod) | ||
| return isless((a.type, a.label), (b.type, b.label)) # order 𝒞 < ℳᵒᵖ < ℳ < 𝒟, and then within each cat according to label | ||
| end | ||
|
|
||
| function Base.hash(a::IsingBimod, h::UInt) | ||
| return hash(a.label, hash(a.type, h)) | ||
| end | ||
|
|
||
| dim(a::IsingBimod) = dim(convert(IsingAnyon, a)) | ||
|
borisdevos marked this conversation as resolved.
Outdated
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.