Support TensorAlgebra 0.14 graded contraction and add!#198
Merged
Conversation
Fixes graded contraction and `add!` under TensorAlgebra 0.14's `StridedView`-based permute path (ITensor/TensorAlgebra.jl#194). `unmatricize(::SectorFusion, ::FusedGradedMatrix, …)` now returns a graded rank-0 array for the scalar case, matching the graded result it returns at every other rank, so the permute-add back into the destination dispatches to the graded `bipermutedimsopadd!` overload rather than the generic strided one. It also defines `StridedViews.StridedView(::AbelianSectorArray)` as a view of its data block, so adding an `AbelianSectorArray` into a plain dense array works.
The rank-0 `unmatricize` test still expected a plain `Array{Float64, 0}`. Assert an `AbelianGradedArray` instead, matching the graded rank-0 result that `unmatricize` now returns.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #198 +/- ##
=======================================
Coverage 81.72% 81.73%
=======================================
Files 23 23
Lines 1850 1851 +1
=======================================
+ Hits 1512 1513 +1
Misses 338 338
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
TensorAlgebra 0.14 and SparseArraysBase 0.10.4 are registered, so the `[compat]` bounds resolve against the releases and the branch pins are no longer needed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes graded contraction and
add!under TensorAlgebra 0.14'sStridedView-based permute path (ITensor/TensorAlgebra.jl#194).unmatricize(::SectorFusion, ::FusedGradedMatrix, …)now returns a graded rank-0 array for the scalar case, matching the graded result it returns at every other rank, so the permute-add back into the destination dispatches to the gradedbipermutedimsopadd!overload rather than the generic strided one. It also definesStridedViews.StridedView(::AbelianSectorArray)as a view of its data block, so adding anAbelianSectorArrayinto a plain dense array works.