Skip to content

Conversation

@borisdevos
Copy link
Member

@borisdevos borisdevos commented Sep 30, 2025

This PR redoes parts of #263, but now with UnitStyle to more cleanly deal with multifusion categories.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 3, 2025

Your PR no longer requires formatting changes. Thank you for your contribution!

@codecov
Copy link

codecov bot commented Nov 3, 2025

Codecov Report

❌ Patch coverage is 95.31250% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/spaces/productspace.jl 94.11% 1 Missing ⚠️
src/tensors/diagonal.jl 0.00% 1 Missing ⚠️
src/tensors/indexmanipulations.jl 0.00% 1 Missing ⚠️
Files with missing lines Coverage Δ
src/TensorKit.jl 20.83% <ø> (+6.54%) ⬆️
src/auxiliary/auxiliary.jl 94.64% <100.00%> (+94.64%) ⬆️
src/fusiontrees/fusiontrees.jl 90.32% <ø> (+90.32%) ⬆️
src/fusiontrees/iterator.jl 97.66% <100.00%> (+97.66%) ⬆️
src/spaces/gradedspace.jl 92.12% <100.00%> (+88.41%) ⬆️
src/spaces/homspace.jl 93.36% <100.00%> (+93.36%) ⬆️
src/spaces/vectorspaces.jl 81.48% <100.00%> (+79.10%) ⬆️
src/tensors/linalg.jl 82.69% <100.00%> (+82.69%) ⬆️
src/tensors/tensoroperations.jl 97.46% <100.00%> (+97.46%) ⬆️
src/spaces/productspace.jl 87.91% <94.11%> (+87.91%) ⬆️
... and 2 more

... and 35 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

lkdvos
lkdvos previously approved these changes Dec 2, 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.

I think I would be happy to merge this as-is. Thanks for the great effort @borisdevos, another large PR in the books!

Let's wait for @Jutho's approval and get this merged.

while isempty((out1...))
out1 = random_fusion(I, Val(N))
out1 = Base.setindex(out1, in2, i)
end
Copy link
Member

Choose a reason for hiding this comment

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

This is another while loop that could potentially become long-lived (maybe not, I really don't have any intuition about multi-fusion categories). I am definitely fine leaving it as is for the time being, as clearly the tests work.

But maybe it could be helpful to add a small # TODO comment here as a reminder to think about whether there is a better strategy in the future. Maybe we can implement some helpful tools to generate random fusion trees with given constraints, like a fixed sector at position i, or a fixed coupled sector, or ...

Copy link
Member Author

Choose a reason for hiding this comment

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

Since random_fusion now manually cuts off after 20 loops, the tests shouldn't get stuck here too long at any point, especially with the relatively small Ns we consider in the tests. But a TODO is added for potential future improvements :)

Copy link
Member

Choose a reason for hiding this comment

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

I don't see how the cutoff in random_fusion would prevent this while loop from running an infinite number of times? But that's not important right now; it is good to have the TODO present.

Copy link
Member Author

Choose a reason for hiding this comment

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

No you're right, I confused myself.

@Jutho
Copy link
Member

Jutho commented Dec 2, 2025

I am still confused by the behavior of the tests on nightly; something I have been ignoring for the last few PRs.

Both the "other" group and the "autodiff" group print the following error from loading Zygote:

ERROR: LoadError: ParseError:
# Error @ /home/runner/.julia/packages/Zygote/55SqB/src/lib/array.jl:609:19
  # to create a Diagonal
  tr(x), function (Δ::Number)
#                 └─────────┘ ── Invalid signature in function definition

Nonetheless, the "autodiff" tests run and succeed, whereas the "other" tests fail because of not being able to precompile Zygote. Do you have any idea @lkdvos or @kshyatt ?

@lkdvos
Copy link
Member

lkdvos commented Dec 2, 2025

Looking at the quoted source code here: https://github.com/FluxML/Zygote.jl/blob/35acbf3ef2b3ab7fbc5ba41cac04eab26ffe1759/src/lib/array.jl#L609

I wonder if nightly changed parsing rules such that this syntax is no longer valid, but it seems like the entire Zygote ecosystem is somewhat dead since even 1.12 doesn't really work with it.
It's a bit annoying that this fails our tests though, so it does seem like at some point in the not so distant future we will be forced to make the decision to drop Zygote support...

The autodiff seems to still fail for the CompatHelper runs, although that looks to me like its just a badly conditioned matrix due to RNG in the rrule(inv, ...) test

@Jutho
Copy link
Member

Jutho commented Dec 3, 2025

It seems TensorKitSectors doesn't export HasBraiding so the tests are failing on this. Maybe you can manually import this here? And we might consider explicitly exporting this in the future. So for now, you will have to add this to the relevant test files

using TensorKitSectors: HasBraiding

@Jutho
Copy link
Member

Jutho commented Dec 3, 2025

Well spotted that HasBraiding is exported from TensorKitSectors but needed to be reexported from TensorKit. I think this is now fully ready so it can be merged after the tests have completed.

@borisdevos borisdevos merged commit 7c68aec into main Dec 3, 2025
39 of 42 checks passed
@borisdevos borisdevos deleted the bd/multifusion branch December 3, 2025 13:32
@borisdevos
Copy link
Member Author

Jutho referenced this pull request Dec 9, 2025
* initial basic design SectorVector

* some additional functionality

* relax `foreachblock` signature

* replace `SectorDict` with `SectorVector` for eig/svdvals

* export `svd_vals`

* clean up SectorVector design

* small fix

* add finitedifferences support

* update changelog

* some simplifications and extensions

* some further fixes

* some more fixes

* update dates

---------

Co-authored-by: Jutho Haegeman <[email protected]>
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.

4 participants