Skip to content

Compare BiTuple by its flat contents - #220

Merged
mtfishman merged 5 commits into
mainfrom
mf/bituple-accessors
Aug 6, 2026
Merged

Compare BiTuple by its flat contents#220
mtfishman merged 5 commits into
mainfrom
mf/bituple-accessors

Conversation

@mtfishman

@mtfishman mtfishman commented Aug 5, 2026

Copy link
Copy Markdown
Member

Summary

Equality and hashing now ignore a BiTuple's bipartitioning, comparing it by its flat contents, alongside a few more BiTuple operations like split-preserving map and bipartition.

Lets an `AbstractArray` whose `axes` return a `BiTuple` flow through generic array machinery. `BiTuple` already acts like its flat tuple for iteration and indexing, so this bridges the remaining Base entry points (index sets, shape and broadcast checks, reshape/permute tuple helpers, `show`) and TensorAlgebra's `matricize` helpers to flatten it. Single-argument `map` preserves the split.
@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.40%. Comparing base (cd3e7f5) to head (11509c3).

Files with missing lines Patch % Lines
src/bituple.jl 55.55% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #220      +/-   ##
==========================================
- Coverage   81.47%   81.40%   -0.07%     
==========================================
  Files          28       28              
  Lines        1015     1022       +7     
==========================================
+ Hits          827      832       +5     
- Misses        188      190       +2     
Flag Coverage Δ
docs 21.45% <0.00%> (-0.16%) ⬇️

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 August 5, 2026 15:21
Equality and hash now ignore the codomain/domain split, matching how array equality ignores block partitioning. Broadcast and array-arithmetic shape combining is owned by the consumer instead, so the `broadcast_shape`, `check_broadcast_shape`, and `promote_shape` bridges are no longer needed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
`safe_tail`, `tail`, `front`, `lastindex`, and the broadcast `_axes` existed only to flatten a `BiTuple` for Base's index and in-place-broadcast machinery. Their consumers are now handled in the consuming package (block-structure `isdiag`, block-data slicing, dense-into-block writes), so these are no longer reached.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Note that Base dispatches bounds-checking on the axes tuple, so a `BiTuple` never competes with Base's index-type specializations.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
A BiTuple is a bipartition value for matricize, not an array's axes, so it should not stand in as one.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mtfishman mtfishman changed the title Flatten BiTuple through generic array machinery Give BiTuple plain value semantics Aug 6, 2026
@mtfishman mtfishman changed the title Give BiTuple plain value semantics Compare BiTuple by its flat contents Aug 6, 2026
@mtfishman
mtfishman merged commit f4354a6 into main Aug 6, 2026
19 of 21 checks passed
@mtfishman
mtfishman deleted the mf/bituple-accessors branch August 6, 2026 15:21
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