Skip to content

Conversation

@lkdvos
Copy link
Member

@lkdvos lkdvos commented Jan 30, 2026

This is an attempt at being more principled about dealing with complex sectorscalartypes with tensors that don't necessarily have complex entries.
In the context of #356 I bumped into a couple of these, so I figure might as well look a bit more carefully at the various occurrences.

My general strategy here is to use TO.tensoralloc_add as much as possible, since we already fixed this issue in that function.
However, I also had to modify compose_dest, since there are no recouplings required there, and therefore there is no need to update the scalartype.

I also added the utility check_spacetype function that does exactly what you suspect it does, and just centralizes various places in the code where this was in use.

@lkdvos lkdvos requested review from Jutho and borisdevos January 30, 2026 20:42
@lkdvos lkdvos mentioned this pull request Jan 30, 2026
5 tasks
@Jutho
Copy link
Member

Jutho commented Jan 30, 2026

Haven't managed to go through this in detail, but I wonder if before trying to fix this and make it consistent, it might be useful to first settle the question if we want to separate between fusionscalartype and braidingscalartype? I think it is a valid request to use e.g. FibonacciAnyon in a context where there will be no braiding (e.g. golden chain), and therefore to only use real numbers.

@lkdvos
Copy link
Member Author

lkdvos commented Jan 30, 2026

I think in general I completely agree to introduce these functions and make that distinction.
I'll get started on that, but I don't think it hurts to already merge this since it does fix the problem, albeit not in the most efficient way.
I would in any case much rather have something that too eagerly becomes complex instead of errors out.

@lkdvos
Copy link
Member Author

lkdvos commented Jan 31, 2026

@codecov
Copy link

codecov bot commented Jan 31, 2026

Codecov Report

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

Files with missing lines Patch % Lines
src/spaces/vectorspaces.jl 80.00% 1 Missing ⚠️
src/tensors/indexmanipulations.jl 95.45% 1 Missing ⚠️
src/tensors/tensor.jl 0.00% 1 Missing ⚠️
Files with missing lines Coverage Δ
src/planar/planaroperations.jl 72.79% <100.00%> (ø)
src/tensors/abstracttensor.jl 59.41% <100.00%> (+0.51%) ⬆️
src/tensors/diagonal.jl 91.54% <100.00%> (+0.30%) ⬆️
src/tensors/linalg.jl 82.64% <100.00%> (ø)
src/tensors/tensoroperations.jl 97.46% <100.00%> (-0.03%) ⬇️
src/spaces/vectorspaces.jl 84.68% <80.00%> (+1.35%) ⬆️
src/tensors/indexmanipulations.jl 73.04% <95.45%> (+0.01%) ⬆️
src/tensors/tensor.jl 85.47% <0.00%> (-0.49%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@borisdevos
Copy link
Member

fusionscalartype and braidingscalartype can also be used in many more places than the one time here in the twist! change, so I agree with Lukas.

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