This documentation tracks the v0.3.0 repository state. This release aligns linear algebra with the shared Luna Flow algebraic and arithmetic capability packages.
immut: Immutable, value-orientedMatrix,Vector, andMatrixFntypes for persistent data and explicit copy-on-update semantics.mutable: Execution-orientedMatrixandVectortypes with in-place updates,Transposeviews,RowView/ColView, and backend-specific implementations forjs,wasm,wasm-gc, andnative.- Shared Core, Different Execution Model: Constructors and core algebraic operators remain aligned across packages, but mutation and access semantics are intentionally different.
- Shared Square-Root Capability: Numerical matrix APIs now use
Luna-Flow/arithmetic.Sqrtinstead of a package-local trait.mutablere-exports the shared trait for source-level discoverability. - Target-Side Integral Embedding: Generic integer conversions use
IntegralHomomorphism::from_integral, matching the currentLuna-Flow/luna-genericalgebraic model. - Ecosystem-Oriented Constraints: Custom scalar types can implement the shared Luna Flow traits once and use them across compatible ecosystem packages.
- Backend Consistency: Native, JS, Wasm, and Wasm GC matrix implementations use the same arithmetic capability identity and explicit trait invocation.
- Compatibility Boundary:
Toleranceremains amutablepackage trait in this release; it has not yet moved toarithmetic.
- Core Algebraic API: Shared operations such as
make,transpose,+,-,*,trace, and matrix/vector conversions are intended to stay semantically aligned acrossimmutandmutable. - Random Access: In
mutable, for high-performance random access, prefer.get(i, j)and.set(i, j, val)directly. - Structured Views: For repeated row or column work in
mutable, preferrow_view()/col_view()instead of relying onmatrix[row]convenience syntax. - Strict Bounds: Public matrix, view, and transpose accessors consistently reject out-of-bounds indices, including
0xNandNx0edge cases. - MatrixFn Alignment:
immut.MatrixFnnow shares the same non-negative dimension and empty-matrix semantics as the concrete matrix implementations. - Public Surface: Internal decomposition helpers remain implementation details. Package users should rely on the documented public matrix methods instead.
- Mutable & Immutable Support: Full
MatrixandVectorsuites with distinct semantics for value-oriented and execution-oriented workloads. - Advanced Operations: Includes determinant, inverse, rank, Cholesky decomposition, eigen-related routines, row elimination, transpose views, and matrix/vector conversions.
- Shared Data Model, Backend-Tuned Kernels:
mutablestill ships backend-tuned execution paths for Native, Wasm, JS, and Wasm GC targets, but the core matrix storage model is now unified. - Benchmark Infrastructure:
bench/,src/perf_support, andsrc/perf_runnernow form a full steady-state benchmarking subsystem for backend comparison and diagnostic replay. - Correctness First: Coverage now includes immutable laws, cross-package consistency checks, determinant/rank/inverse alignment, and regression tests for numerical behavior.
- Auditable Public Contracts: Bounds behavior, swap semantics, benchmark fixtures, and documentation are now tracked more explicitly as part of the repository’s correctness story.
perf: Benchmark entry package used bymoon benchfor the steady-state matrix suite.perf_support: Public fixture metadata, case registry, runtime loaders, and checksum-oriented execution helpers for benchmark cases.perf_runner: Single-case diagnostic and sampling runner used for replay, local investigation, and richer benchmark artifact generation.
let imm = @immut.Matrix::from_2d_array([[1, 2], [3, 4]])
let imm_updated = imm.set(0, 1, 9)
let m = @mutable.Matrix::from_2d_array([[1.0, 2.0], [3.0, 4.0]])
m.set(0, 1, 9.0)
let det = m.determinant()
let maybe_inv = m.inverse()
let row0 = m.row_view(0).to_array()Comprehensive API documentation is available at mooncakes.io.
We provide documentation in multiple languages:
- 🇺🇸 English (
doc/en_US) - 🇨🇳 简体中文 (
doc/zh_CN) - 🇯🇵 日本語 (
doc/ja_JP)
Localized README files:
| Version | Date | Status | Notes |
|---|---|---|---|
0.3.0 |
2026-06-14 | current repository release | Adopted shared arithmetic.Sqrt, current luna-generic homomorphisms, and ecosystem-wide numeric capability identities |
0.2.12 |
2026-06-06 | published on mooncakes | Strict bounds unification, semantic correctness fixes, benchmark diagnostics expansion, and documentation/audit refresh |
0.2.11 |
2026-05-27 | previous release baseline | Performance-tuned mutable kernels, dedicated wasm-gc backend, benchmark/reporting expansion, and API/doc alignment |
0.2.10 |
2026-05-27 | previous release baseline | Unified flattened mutable storage, matrix views, consistency coverage, benchmark coverage, and release-process alignment |
0.2.9 |
2026-02-03 | published on mooncakes | Published from the earlier 3328195 release state |
0.2.8 |
2026-02-03 | historical baseline | Algorithms and stability milestone used as the comparison baseline for later work |
-
Current Release Narrative (0.3.0):
- Square-root-dependent matrix algorithms now require the shared
arithmetic.Sqrtcapability. mutable.Sqrtis a public re-export ofarithmetic.Sqrt; the old package-local trait and scalar implementations were removed.- Integral test fixtures and conversion helpers now use target-side
IntegralHomomorphism::from_integral. - Custom numeric types should implement capabilities in
luna-genericandarithmeticrather than package-specific linear-algebra traits.
- Square-root-dependent matrix algorithms now require the shared
-
Previous Release Narrative (0.2.12):
- Public matrix, view, and transpose accessors enforce explicit bounds contracts, including zero-row and zero-column edge shapes.
immut.Matrixandmutable.Matrixare aligned on shared correctness semantics while preserving their value-vs-mutation execution split.- Benchmark diagnostics and the tracked correctness audit reflect the exported
0.2.12surface.
-
Earlier Release Narrative (0.2.11):
mutable.Matrixnow combines the shared flat storage model from0.2.10with follow-up backend kernel optimizations and a dedicatedwasm-gcimplementation.- Public numerical signatures are aligned around
Field/Num/Tolerance, and immutable determinant documentation matches the simplified post-0.2.10constraint set. - The benchmark stack now includes runtime-loaded fixtures, expanded case metadata, richer summary reporting, a local dashboard, optional Rust comparison runs, and diagnostic replay via
perf_runner. - The release checklist, benchmark docs, package overview, and localized READMEs are aligned to the
0.2.11release story.
-
Algorithms & Stability (0.2.8):
- Added LU- and QR-related decomposition support used by determinant, inverse, rank, and eigen routines.
- Shifted determinant and rank behavior toward more stable elimination-based implementations.
-
Native Optimization (0.2.7):
- Implemented transposition + dot-product strategy for Native matrix multiplication, outperforming naive implementations by more than 2x.
- Optimized
make,new, andtransposeto remove expensive integer division in hot loops.
-
Performance Overhaul (0.2.4):
- Optimized secondary utilities such as
mapiandeach_row_col. - Improved hybrid matrix multiplication and vector linear-combination performance.
- Optimized secondary utilities such as
-
Other Fixes & Renames:
map_row()/map_col()->map_row_inplace()/map_col_inplace()eachij()->each_row_col()- Corrected determinant behavior for
0x0matrices. - Fixed copy-on-conversion behavior between vectors and matrices.
Useful local commands:
moon fmt
moon check
moon test --enable-coverage
./run_test.shrun_test.sh runs the repository test suite: immut, consistency, perf_support, and perf_runner, plus mutable on wasm-gc, js, native, and wasm.
Before triggering the publish workflow:
- Bump
moon.modto the intended next release version before publishing. - Update
README.mdso the release notes and version history match the package contents. - Run
moon checkand./run_test.sh; both are required before publishing. - Trigger
publish-package; it will publish the version currently declared inmoon.mod.
If the workflow reports a duplicate version, the package manager already contains that version and a new version bump is required.
Contribution guidance is available in CONTRIBUTING.md.