Skip to content

[WIP] Rework the matricize, contract, and factorization surfaces for v0.21 - #233

Draft
mtfishman wants to merge 17 commits into
mainfrom
develop
Draft

mtfishman wants to merge 17 commits into
mainfrom
develop

Conversation

@mtfishman

@mtfishman mtfishman commented Sep 15, 2026

Copy link
Copy Markdown
Member

Summary

Gives each operation one primitive that backends overload, with the convenience spellings derived on top, and trims the factorization surface.

TODO

  • Migrate the dependent packages
  • Strip -DEV before release

mtfishman and others added 5 commits September 15, 2026 18:30
Accumulates the contract and matricize interface redesign. The version
stays at 0.21.0-DEV until the release PR strips the suffix.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
It had no callers outside its own forwarding method, and its behaviour is
covered by the in-place form. Also raises the subproject compat bounds the
round-opening bump missed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The argument maps the destination's dimension order to the matrix's; it is
not intrinsically an inverse, so invperm_ described one caller's derivation
rather than the parameter.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The two shapes are disjoint at the trailing argument, a Val split spec
against a pair of permutation tuples, so one name carries both and the
perm marker stops earning its place.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The entry points collect trailing keywords and forward them to the
resolver, whose methods declared none, so any unrecognized keyword
surfaced as a MethodError on an internal function.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Sep 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 74.83871% with 39 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.44%. Comparing base (31e5602) to head (6100505).

Files with missing lines Patch % Lines
src/matricize.jl 70.90% 16 Missing ⚠️
src/contract/contract.jl 60.00% 14 Missing ⚠️
src/algorithm.jl 55.55% 4 Missing ⚠️
src/factorizations.jl 78.57% 3 Missing ⚠️
ext/TensorAlgebraTensorKitExt.jl 33.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #233      +/-   ##
==========================================
- Coverage   79.64%   78.44%   -1.20%     
==========================================
  Files          28       28              
  Lines        1056      993      -63     
==========================================
- Hits          841      779      -62     
+ Misses        215      214       -1     
Flag Coverage Δ
docs ?

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 8 commits September 15, 2026 19:28
Nothing passed `..`, and supporting it cost a dependency plus a
typed/untyped method tier whose only job was normalizing it. Names the
joint predicate `isbiperm` and routes the three duplicate validations
through `check_biperm`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A hook dispatches on the array or the style, never on the permutation, so
annotating it narrowed what a backend may pass without buying any dispatch.
Base leaves `permutedims`' perm untyped and validates at runtime.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Both callers had a bipermutation in hand and were splatting it to reach
`isidentityperm`, the same shape problem `isbiperm` fixed. Also drops the
Ellipsis spellings from the matricize tests, which the removed normalizing
tier supported.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A style now implements four bipermutation hooks, `allocate_output`,
`matricizeop!`, `matricizeopview` and `is_output_view`, and the copy and
maybe-alias forms are derived. Allocation is a hook because only the style
knows its fused axes, and because it is what makes the copy path terminate.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`identitybiperm` now matches `isidentitybiperm` and sits beside it. The
symmetry sense of `trivial` is a different concept, so the two never apply
to the same object.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Also migrates five Val-forwarding calls in the factorization wrappers that
a literal-only search had missed, and the second custom style in the
factorization tests.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Matricizing without permuting is worth a short spelling. Removing `Val` as
a dispatch tier was what mattered: a style implements the bipermutation
hooks and never these, so the copy path cannot recurse through the router.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The gram factorizations were only used by higher-level network code, so they belong in the package that needs them. `sqrth_invsqrth_safe` only saves an eigendecomposition over calling the two separately.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@mtfishman mtfishman changed the title [WIP] Redesign the contract and matricize interfaces for v0.21 [WIP] Rework the matricize, contract, and factorization surfaces for v0.21 Sep 16, 2026
mtfishman and others added 4 commits September 15, 2026 22:56
A graded array already gets owned storage out of `permutedimsop`, whose stored matrix is the answer, so decomposing the copy into an allocation plus an in-place write would copy that storage a second time.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The labels forms keep the plain names and the bipermutation forms take a `perm` marker, freeing `contract` to become variadic over operands. `allocate_contract_output` is gone in favor of overloading `allocate_output`, and a generic `select_algorithm` sits above the per-operation resolvers.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
It was the one rung of the labels ladder that was neither exported nor public, though it is as much a user-facing entry point as the rest.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A contraction algorithm does not choose how the output is allocated, so these two entry points were a second way to contract that bypassed `allocate_output`. The algorithm stays a keyword above the in-place primitive.

Co-Authored-By: Claude Opus 5 (1M context) <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