Skip to content

builtins: add transpose matmul dot for matrix work#193

Merged
danieljohnmorris merged 1 commit into
mainfrom
fix/linalg-basic
May 12, 2026
Merged

builtins: add transpose matmul dot for matrix work#193
danieljohnmorris merged 1 commit into
mainfrom
fix/linalg-basic

Conversation

@danieljohnmorris
Copy link
Copy Markdown
Collaborator

The token-minimal pitch only holds if numeric workloads are first class. Basic linear algebra was missing.

Implementation:

  • transpose flips a 2D list of lists
  • matmul: standard matrix product with shape check
  • dot: 1D vector inner product
  • all operate on existing list shapes, no new matrix type
  • opcodes allocated: transpose, matmul, dot

Tests: cross-engine regression tests + examples/linalg-basic.ilo with -- run: directives.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 12, 2026

Codecov Report

❌ Patch coverage is 71.28548% with 172 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/interpreter/mod.rs 60.43% 72 Missing ⚠️
src/vm/mod.rs 85.12% 43 Missing ⚠️
src/verify.rs 41.81% 32 Missing ⚠️
src/vm/compile_cranelift.rs 16.66% 25 Missing ⚠️

📢 Thoughts on this report? Let us know!

The token-minimal pitch only holds if numeric workloads are first
class. transpose flips a 2D list of lists, matmul does standard
matrix product with shape check, dot does the 1D vector inner
product. All operate on list-of-list / list shapes already in use
elsewhere - no new matrix type.

Opcodes allocated: transpose, matmul, dot. Shape mismatches error
with a clear message at runtime.
@danieljohnmorris danieljohnmorris merged commit e7628ab into main May 12, 2026
4 of 5 checks passed
@danieljohnmorris danieljohnmorris deleted the fix/linalg-basic branch May 12, 2026 22:56
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