Make testsuite compatible with multifusion categories#71
Make testsuite compatible with multifusion categories#71borisdevos wants to merge 20 commits intomainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 4 files with indirect coverage changes 🚀 New features to boost your workflow:
|
lkdvos
left a comment
There was a problem hiding this comment.
There was a check where for a non-braided sector, the F-symbols should simply as type the sectorscalartype,
I actually think this means there is an error in the implementation of sectorscalartype, since that should really hold. (which does make sense, I should have realized that this is not just the product of the sectorscalartypes of each of the factors)
I turned the unitarity of F-symbols check into a function that's exported by the testsuite as well.
Can you elaborate a bit on this?
While I am not entirely opposed to this, I don't like it too much that this is not consistent between the tests, with some of them being functions and others not.
I also changed the smallset function to take random sectors where possible, something I found to be necessary in a different context.
In principle it is also possible/recommended to overload this function specifically in these cases. Do you think we should just take a higher number by default?
I'm pretty sure the current tests don't actually take that long, so I have no issue with simply increasing the number either
I fixed this to check the braiding first.
Quoting this both because the answer's the same. I want to make sure enough (and currently all) sector values are tested for unitarity and valid F-symbols, meaning I need to either overload the Edit: it's flown completely over my head that the pentagon test is just passing. Turns out |
|
So I added some checks related to the colorings of multifusion sectors, but I only put these in the most important tests. In principle I could put these at every test that fuses at least two random objects pulled from |
lkdvos
left a comment
There was a problem hiding this comment.
I'm not sure I am still following what you are saying, it seems like this PR is now doing quite a few very different things so it is a bit hard to keep track of what is going on.
Is this correct:
- You want to be able to check unitarity in testsuites of downstream packages, so you refactored that into a function.
- You fixed sectorscalartype for productsectors and added tests for this
- You did some things for time reversed values (because it made something fail, but that is not being tested? or is it?)
- You made some changes to improve the multifusion support of the testsuite?
Just for my sanity, it would be nice to split this all up in separate PRs, but if this is what is going on I did put some more comments here.
| throw(ArgumentError("Cannot take random sample of infinite sector values.")) | ||
| return rand(collect(values(I)), size) | ||
| end | ||
| function smallset(::Type{I}, size::Int = 5) where {I <: Sector} |
There was a problem hiding this comment.
This still looks a bit off to me to be honest, I think in general this is still type-unstable (reshapedarray vs regular array), and now you have random elements that might have repeats (which is something I missed, apologies for that)
Given all of this, is it not simpler to keep the smallset function as it was before, and then only overload it for A4Object?
There was a problem hiding this comment.
I can just overload if needed for A4Object. But there was actually an issue at the level of the TKS sectors. The thing I wanted to avoid was take always taking the first size sectors in SectorValues, which messed me up when working with irreps of the Heisenberg group whose first sectors (in my implementation) were all trivial characters, and the latter were non-trivial and actually failing tests. But this wasn't being captured with smallset only taking the trivial sectors. This is why I wanted to sample randomly from all available sectors in values(I).
At least with @test_inferred and @code_warntype the current smallset is type-stable, forcing it to be a vector instead of a potential matrix when values is finite in size.
|
All your bullet points are true.
|
…ors.jl into bd/multitestcompat
|
Put it temporarily to draft since I need to get the parse-show tests working in MultiTensorKit. |
|
Your PR no longer requires formatting changes. Thank you for your contribution! |
With the aid of
random_fusion(which was already made in the TensorKit tests), the current testsuite can be straightforwardly extended to be compatible with multifusion categories.PlanarTrivial ⊠ ..., so I added such one to the sector list.smallsetfunction to take random sectors where possible, something I found to be necessary in a different context. I added thesizeargument, but I'm actually not sure if I'm able to access that if I load this test suite in a different package. I was just thinking of this because a generic multifusion category has a lot of sectors, and testing just 5 at a time which don't necessarily fuse to one another seemed like a recipe for testing absolutely nothing. This is part of why the tests I have currently in Finishing touches to a working MultiTensorKit code MultiTensorKit.jl#2 (as of now) look so custom compared to this test suite.