Fallbacks for product sectors involving fusion tensors#80
Fallbacks for product sectors involving fusion tensors#80borisdevos wants to merge 2 commits intomainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
lkdvos
left a comment
There was a problem hiding this comment.
Looks good, makes sense to me!
Minor suggestion: I think it might be possible to avoid some code repetition by factoring out some of the shared logic, although it is not entirely trivial because of the sizes right now.
Perhaps replacing kron with kron!, implemented through tensorproduct!, you can simply allocate the destination and go from there?
If I'm not making sense, let me know, I might find some time to give a better example of what I mean.
|
I can get to the sizes through the data themselves. They'll be either numbers, matrices or 4-dimensional arrays. So I can definitely refactor the matrix vs number or 4d array vs number cases easily, but I'm guessing that's not what you have in mind? |
|
Would it be useful if |
|
What I meant is that it would be nice if something like this would work: _kron(A::Number, B::Number) = A * B
_kron(A::AbstractArray, B::Number) = A * B
_kron(A::Number, B::AbstractArray) = A * B
_kron(A::AbstractArray, B::AbstractArray) = ...But somehow I'm assuming this will lead to issues, given that you explicitly turn the numbers into matrices first? |
This already happens, no?
This does work, with the last method being the current TensorKitSectors.jl/test/runtests.jl Line 141 in 6c008fe |
No: julia> TensorKitSectors.Rsymbol_from_fusiontensor(U1Irrep(0), U1Irrep(0), U1Irrep(0))
1
julia> TensorKitSectors.Rsymbol_from_fusiontensor(U1Irrep(0), U1Irrep(0), U1Irrep(1))
0What I mean is that these would respectively return julia> TensorKitSectors.Rsymbol_from_fusiontensor(U1Irrep(0), U1Irrep(0), U1Irrep(0))
1×1 Matrix{Int}:
1
julia> TensorKitSectors.Rsymbol_from_fusiontensor(U1Irrep(0), U1Irrep(0), U1Irrep(1))
0×0 Matrix{Int} |
|
So the output any of the |
|
However, that might make it harder to use these functions for what they were intended, namely comparing the exactly programmed result with the generically determined result from the fusion tensors. I thought there were also fallbacks, that did and these could then do the conversion from |
|
You're right, I would also like to reserve the |
|
I'm not sure about keeping these function for only testing purposes. They should also be available to |
This is necessary when
..._from_fusiontensorhas its own method within downstream packages to circumventview. I encountered this specifically when testingSU3Irrep ⊠ SU3Irrep, but it's probably relevant within CategoryData as well.