Skip to content

Remove the MatricizeStyle trait - #238

Merged
mtfishman merged 5 commits into
mainfrom
mf/remove-matricizestyle
Sep 28, 2026
Merged

mtfishman merged 5 commits into
mainfrom
mf/remove-matricizestyle

Conversation

@mtfishman

@mtfishman mtfishman commented Sep 27, 2026 •

Copy link
Copy Markdown
Member

Summary

Removes MatricizeStyle: every style was a function of the array type, so the matricize hooks dispatch on the array, and a family needing more than the fold owns its own ContractAlgorithm. Kernels validate their own inputs. Lands together with ITensor/GradedArrays.jl#284.

Every matricize style was a function of the array type, so the hooks dispatch on the array, `unmatricize` on the matrix, and `MatricizeContract` becomes a plain algorithm token. The fermionic twist of the right contraction factor moves to a `matricize_inputs` hook that sees both operands. Only a `DenseArray` declares the reshape a view.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@codecov

codecov Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.50000% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.29%. Comparing base (5188026) to head (8b7110e).

Files with missing lines Patch % Lines
src/factorizations.jl 64.28% 15 Missing ⚠️
src/matricize.jl 84.21% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #238      +/-   ##
==========================================
+ Coverage   82.00%   83.29%   +1.29%     
==========================================
  Files          29       29              
  Lines        1006      946      -60     
==========================================
- Hits          825      788      -37     
+ Misses        181      158      -23     
Flag Coverage Δ
docs 23.84% <34.21%> (-0.10%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

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

mtfishman and others added 4 commits September 27, 2026 19:47
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The kernel's non-view destination path is `a1_mat * a2_mat` followed by one accumulating scatter, so `α` and `β` are folded into the permuted pass and the destination is never gathered. `unmatricize!` is its `(1, 0)` case. Also states the `DenseArray` view rule as a contract in the comment.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
An array family whose contraction needs more than the matricize fold now owns its own
`ContractAlgorithm` and `contractpermopadd!` method instead of hooking into the dense kernel, so
the hook has no caller. Input validation moves from the algorithm-less entry into each algorithm's
kernel, which is a public rung callable directly.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@mtfishman mtfishman changed the title [WIP] Remove the MatricizeStyle trait Remove the MatricizeStyle trait Sep 28, 2026
@mtfishman
mtfishman marked this pull request as ready for review September 28, 2026 20:30
@mtfishman
mtfishman enabled auto-merge (squash) September 28, 2026 20:30
@mtfishman
mtfishman merged commit f6043ad into main Sep 28, 2026
30 of 31 checks passed
@mtfishman
mtfishman deleted the mf/remove-matricizestyle branch September 28, 2026 20:51
mtfishman added a commit to ITensor/GradedArrays.jl that referenced this pull request Sep 28, 2026
## Summary

Follows TensorAlgebra 0.22
(ITensor/TensorAlgebra.jl#238), which removes
`MatricizeStyle`: the matricize hooks dispatch on the array type, and
graded contraction becomes its own algorithm, `GradedContract`, carrying
the fermionic twist.

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
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.

1 participant