Skip to content

Remove lazy named dims array types#199

Merged
mtfishman merged 3 commits intomainfrom
mf/linear-broadcasted
Mar 26, 2026
Merged

Remove lazy named dims array types#199
mtfishman merged 3 commits intomainfrom
mf/linear-broadcasted

Conversation

@mtfishman
Copy link
Copy Markdown
Member

Summary

Companion PR to ITensor/TensorAlgebra.jl#156 — removes the macro-generated lazy types that are no longer needed with the new LinearBroadcasted design.

What changed

  • Delete ScaledNamedDimsArray, ConjNamedDimsArray, AddNamedDimsArray, MulNamedDimsArray and all associated overloads (dimnames, denamed, aligneddims, inds, similar, copy)
  • Delete TA.add! overload for named arrays (denaming happens before add! is reached)
  • Delete test/test_lazy.jl
  • Net -101 lines

Why this works

NamedDimsArrays broadcasting was already implemented correctly via broadcasted_denamed — it recursively denames the Broadcasted tree and delegates to the underlying arrays' broadcasting. The lazy types were only used by explicit *_l/+_l/conjed calls, which nothing depends on.

Contraction via * eagerly denames and contracts via mul_nameddims. mul! denames and calls contractadd!.

Deferred

  • Mul with named factors for fused contract+add (Mul(a, b) .+ c -> contractopadd!) — purely an optimization

Dependencies

Test plan

  • All basics tests pass (997 tests)
  • All TensorAlgebra tests pass (250 tests across 4 element types)
  • Full Pkg.test() in CI

Generated with Claude Code

mtfishman and others added 2 commits March 26, 2026 11:08
Delete ScaledNamedDimsArray, ConjNamedDimsArray, AddNamedDimsArray,
MulNamedDimsArray and all associated overloads. Broadcasting already
works via broadcasted_denamed without these types. Contraction works
via mul_nameddims which denames directly.

Also remove TA.add! overload for named arrays — denaming happens
before add! is reached in the broadcasting path.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mtfishman mtfishman changed the title [WIP] Remove lazy named dims array types Remove lazy named dims array types Mar 26, 2026
@mtfishman mtfishman marked this pull request as ready for review March 26, 2026 18:24
@mtfishman mtfishman closed this Mar 26, 2026
@mtfishman mtfishman reopened this Mar 26, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.88%. Comparing base (57ebba7) to head (6ef8891).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #199      +/-   ##
==========================================
- Coverage   72.10%   70.88%   -1.22%     
==========================================
  Files          21       20       -1     
  Lines        1000      965      -35     
==========================================
- Hits          721      684      -37     
- Misses        279      281       +2     
Flag Coverage Δ
docs 17.77% <ø> (+0.64%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 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 mtfishman merged commit 5010880 into main Mar 26, 2026
37 of 50 checks passed
@mtfishman mtfishman deleted the mf/linear-broadcasted branch March 26, 2026 18:42
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