Skip to content

Finishing touches to a working MultiTensorKit code #2

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

Draft
wants to merge 92 commits into
base: main
Choose a base branch
from

Conversation

borisdevos
Copy link
Collaborator

@borisdevos borisdevos commented Jun 13, 2025

This PR essentially adds everything that is required to be able to consistently consider a BimoduleSector, and in particular BimoduleSector{A4} as a valid Sector within TensorKit.

Aqua tests will fail because the dependencies are not tidied up. I need to add a valid TensorKit dependency, and I think that will automatically enforce a TupleTools dependency as well. If not, that needs to be added as well. For this, my PR (still need to do) in TensorKit will first need to be merged.

Documentation is a WIP on a separate branch.

@borisdevos borisdevos changed the title format Finishing touches to a working MultiTensorKit code Jun 13, 2025
Copy link
Member

@lkdvos lkdvos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you need a TupleTools method, you have to take a dependency on that too, does that answer that question?

@@ -2,6 +2,11 @@ struct BimoduleSector{Name} <: Sector
i::Int
j::Int
label::Int
function BimoduleSector{:A4}(i::Int, j::Int, label::Int)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels a bit strange to have this as an inner constructor, dedicated to the A4 type. Would it not be equally sensible to have this outside of the struct definition?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want BimoduleSector{:A4} to be its own struct then? I need the new function to actually create the objects, no?

end
return Is, allduals
end

function Base.one(a::BimoduleSector)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the long term, I would still really prefer to have one always correspond to the label=1, either by relabeling the data when we read them in, or (better), storing the data in that form.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. At the level of the data seems better so it's a one-time thing. I will think of a way to do this for another time.

Comment on lines 301 to 302
#possible change to rightone of correct space for N = 0
u = N > 0 ? oneunit(P[1]) : error("no unit object in $P")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks a bit fishy, I think the whole point of insertrightunit is to have the ability to construct a space through rightone, ie avoiding oneunit altogether since this might not be defined. In some sense, I would almost expect a rightoneunit or something like that to appear here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defining a rightoneunit at the level of the GradedSpace is easy enough. I have the following in mind:

function rightoneunit(S::GradedSpace{<:BimoduleSector})
    allequal(a.j for a in sectors(S)) ||
        throw(ArgumentError("sectors of $S do not have the same rightone"))

    sector = rightone(first(sectors(S)))
    return spacetype(S)(sector => 1)
end

This works perfectly fine for a space like rsp = Vect[A4Object](A4Object(1,1,1)=>1, A4Object(2,1,1)=>1), returning Vect[A4Object](A4Object(1,1,4)=>1) (again, unfortunately the label=1 isn't the unit, but 4 in this particular case). Replacing oneunit with rightoneunit within insertrightunit for P = rsp ← rsp then returns rsp ← (rsp ⊗ Vect[A4Object](A4Object(1, 1, 4)=>1)) as expected.

However, at the level of a TensorMap, this errors at Nsymbol because it wants to build a fusion tree with a=A4Object(1,1,1), b=A4Object(1,1,4), c = A4Object(2,1,1). Since I don't see any purpose for something like rightoneunit other than precisely cases like this where there are fusion and module sectors mixed in the GradedSpace, I'm wondering if such a definition is useful. Of course, definitions like this and leftoneunit could be used within oneunit to check extremely rigorously that you're considering a fusion sector.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, your initial rsp is already ill-defined right, you want to always have i and j be the same throughout a single ElementarySpace anyways to have something that makes sense. (Otherwise you'd have a direct sum of things with different colorings, which I don't think we want to support).

In that sense, if rsp = Vect[A4Object]((2, 1, 1) => 1, (2, 1, 2) => 1), you'd get the space you say, and I think the Nsymbols now have to work out. The idea being that inserting a unit boils down to inserting a trivial leg in the region of a given color, which doesn't alter the color, so should work?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, I misunderstood what you precisely wanted to accomplish with a rightoneunit. It does seem somewhat redundant though, since for i=j the right unit and the unit coincide (a check that's done within oneunit). The only upside I see is that it is more informative in terms of errors.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont mean i and j have to be equal to eachother, I mean that all i have to be the same, and separately all j have to be the same

@borisdevos
Copy link
Collaborator Author

Another thing I forgot to mention is that the tests aren't verbose, even though I tried to make them so. Since in particular the pentagon equation check takes forever, by the time your REPL shows that test_A4.jl is done, close to an hour has passed without showing anything.

Related to this, maybe we should install an "on-off" switch for this pentagon check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants