Skip to content

Remove "atom specific" functions from matrix classes - PR 1 - #120

Merged
dance858 merged 4 commits into
mainfrom
row-gather
Sep 12, 2026
Merged

Remove "atom specific" functions from matrix classes - PR 1#120
dance858 merged 4 commits into
mainfrom
row-gather

Conversation

@dance858

@dance858 dance858 commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

First PR in a sequence of 3 or 4 where we remove many of the "atom specific" functions from the matrix classes. It is wrong abstraction to let matrix classes keep track of atom specific functions.

Claude below:

Summary

First milestone of lesson 3 (collapse the atom-shaped vtable slots into row-gather and row-reduce; roadmap in notes/lesson3_roadmap.md).

  • row_gather_alloc(A, map, m_out) / row_gather_fill_values(A, C) replace index_alloc / index_fill_values. Contract: map[i] in [0, A->m), repeats allowed, map bound to the result at alloc time so the fill takes no map. (-1 = empty output row is deferred to M2, where diag_vec is its first caller.)
  • Bound state lives on the result: sparse_matrix.bound_iwork (renamed from transpose_iwork, shared with transpose) and a new permuted_dense.bound_iwork holding the source dense row per output dense row. stacked_pd needs no new field.
  • index and transpose atoms migrated; transpose no longer keeps its commutation map after init.
  • new_permuted_dense exits on m0 * n0 overflow unconditionally.

…, M1)

row_gather_alloc(A, map, m_out) / row_gather_fill_values(A, C) replace the
atom-named index slots. map[i] in [-1, A->m), -1 = empty output row,
repeats allowed; the map is bound to the result at alloc time (bound_iwork
on sparse_matrix, generalizing transpose_iwork, and new on permuted_dense).
index and transpose atoms migrated; new_permuted_dense checks m0*n0
overflow unconditionally.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012QaXUu4VhNvNyBc2dCzpkp
@dance858 dance858 changed the title Replace index_alloc/fill_values with a row_gather primitive (lesson 3, M1) [WIP] Replace index_alloc/fill_values with a row_gather primitive (lesson 3, M1) Sep 11, 2026
dance858 and others added 3 commits September 12, 2026 13:19
map[i] must be a valid source row in [0, A->m); the structurally-empty-row
case (-1) has no caller until diag_vec migrates in M2 and is deferred there.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Azb8o1AgiFRU4t9aAY7oDr
@dance858 dance858 changed the title [WIP] Replace index_alloc/fill_values with a row_gather primitive (lesson 3, M1) Remove "atom specific" functions from matrix classes - PR 1 Sep 12, 2026
@dance858
dance858 merged commit ea7c428 into main Sep 12, 2026
12 checks passed
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