Skip to content
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

fuse inconsistent in handling dual spaces #110

Closed
lkdvos opened this issue Mar 29, 2024 · 2 comments · Fixed by #111
Closed

fuse inconsistent in handling dual spaces #110

lkdvos opened this issue Mar 29, 2024 · 2 comments · Fixed by #111

Comments

@lkdvos
Copy link
Collaborator

lkdvos commented Mar 29, 2024

Encountered the folowing inconsistent/inconvenient behaviour for fusing vector spaces: fuse(a, b...) automatically results in a non-dual vectorspace, while fuse(a) simply returns a. I think it might be more convenient to ensure that fuse either always returns a non-dual space, or has a keyword to switch between the outputs.

julia> using TensorKit

julia> a = U1Space(1 => 1)
Rep[U₁](1=>1)

julia> fuse(a * a)
Rep[U₁](2=>1)

julia> fuse(a)
Rep[U₁](1=>1)

julia> fuse(a')
Rep[U₁](1=>1)'

julia> fuse(a' * a)
Rep[U₁](0=>1)

In my particular case, I am iteratively fusing more and more spaces together to determine the maximal virtual spaces of an MPS, and now have to insert a weird special case to catch when a single dual space is being entered.

@Jutho
Copy link
Owner

Jutho commented Mar 29, 2024

replacing
fuse(V::ElementarySpace) = V
on line 155 in vectorspaces.jl with
fuse(V::ElementarySpace) = isdual(V) ? flip(V) : V
will fix this, I believe. Should I add this?

@lkdvos
Copy link
Collaborator Author

lkdvos commented Mar 29, 2024

I would like this, yes please ☺️

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 a pull request may close this issue.

2 participants