Repository navigation
Deprecate the public matrix index helpers - #70
Merged
ctreffs merged 1 commit intoOct 17, 2026
Merged
Conversation
ctreffs
force-pushed
the
perf/allocation-free-construction
branch
from
October 17, 2026 11:31
8f4cf0e to
fad8f8c
Compare
ctreffs
force-pushed
the
api/deprecate-index-helpers
branch
from
October 17, 2026 11:31
7780fc2 to
d7264c4
Compare
ctreffs
force-pushed
the
perf/allocation-free-construction
branch
from
October 17, 2026 12:18
fad8f8c to
5538593
Compare
ctreffs
force-pushed
the
api/deprecate-index-helpers
branch
from
October 17, 2026 12:18
d7264c4 to
b61ef39
Compare
ctreffs
force-pushed
the
perf/allocation-free-construction
branch
from
October 17, 2026 12:48
5538593 to
1d23f99
Compare
ctreffs
force-pushed
the
api/deprecate-index-helpers
branch
from
October 17, 2026 12:48
b61ef39 to
165a108
Compare
ctreffs
force-pushed
the
perf/allocation-free-construction
branch
from
October 17, 2026 13:11
1d23f99 to
29586ba
Compare
ctreffs
force-pushed
the
api/deprecate-index-helpers
branch
from
October 17, 2026 13:11
165a108 to
e8162aa
Compare
ctreffs
force-pushed
the
perf/allocation-free-construction
branch
from
October 17, 2026 13:23
29586ba to
6010506
Compare
ctreffs
force-pushed
the
api/deprecate-index-helpers
branch
from
October 17, 2026 13:23
e8162aa to
bdbfa67
Compare
ctreffs
force-pushed
the
perf/allocation-free-construction
branch
from
October 17, 2026 13:54
6010506 to
d5eefff
Compare
ctreffs
force-pushed
the
api/deprecate-index-helpers
branch
from
October 17, 2026 13:54
bdbfa67 to
d4e325f
Compare
index(column:row:width:) computes a row-major index ((row * width) + column), while columnRow(index:width:) and every matrix storage use column-major order, so the two did not round-trip. Neither is needed by consumers (matrices have subscript(column:row:) and subscript(index:)), and both put very generic names into every consumer's namespace. - Deprecate both, with messages pointing at the matrix subscripts. Behavior is unchanged to avoid silent breakage. - Matrix storages use a new internal @inlinable columnMajorPosition(of:rows:) instead. Tests: MatrixIndexingTests checks that the flat subscript (get and set) is column-major for all matrix types, and pins the behavior of the deprecated helpers, including the documented row-major mismatch. Claude-Session: https://claude.ai/code/session_011WSUtoLptjea3s3iC5wTNC
ctreffs
force-pushed
the
perf/allocation-free-construction
branch
from
October 17, 2026 14:05
d5eefff to
2ce7789
Compare
ctreffs
force-pushed
the
api/deprecate-index-helpers
branch
from
October 17, 2026 14:05
d4e325f to
090da5a
Compare
ctreffs
added a commit
that referenced
this pull request
Oct 17, 2026
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.
Stack 5/5 — base:
master(#65, #66, #68, #69 merged)Problem
The two public free functions disagree:
index(column:row:width:)returnsrow * width + column, which is row-major.columnRow(index:width:)and every matrix storage use column-major order.So
columnRow(index: index(column: 1, row: 2, width: 4), width: 4)returns(column: 2, row: 1). Nothing in the package callsindex(column:…). Consumers already havesubscript(column:row:)andsubscript(index:)on every matrix, and both helpers put very generic names (index,columnRow) into every consumer's namespace.Change
@inlinablehelper,columnMajorPosition(of:rows:).Tests
MatrixIndexingTests:Both
check-inlinableconfigurations pass, and DocC--analyze --warnings-as-errorsis clean.Left out on purpose
In the analysis I suggested also making the public
SIMD.makeIterator()/elementsextension internal. That was wrong.SIMD2/3/4get a deliberate retroactiveSequenceconformance inSIMD{2,3,4}+Extensions.swift, andmakeIterator()implements it (Array(v)andfor x in vdepend on it). It stays as is.https://claude.ai/code/session_011WSUtoLptjea3s3iC5wTNC