Trait-oriented linear algebra foundations for MoonBit, with checked APIs, backend wrappers, and mutable/immutable dense matrix and vector types.
Dependencies
Experimental features: The algebra and container capability layers are available for integration experiments and ecosystem feedback, but their trait hierarchy, operation dictionaries, error contracts, and function signatures are not yet stable. Downstream libraries should not treat these packages as compatibility-stable public boundaries until they graduate from experimental status. The concrete immut, mutable, and backend APIs are not covered by this experimental designation solely because they implement or provide adapters for these layers.
moon add Luna-Flow/linear-algebra@0.4.7
moon add Luna-Flow/luna-generic@0.3.3
moon add Luna-Flow/arithmetic@0.2.2import {
"Luna-Flow/linear-algebra/algebra",
"Luna-Flow/linear-algebra/arithmetic" @la_arithmetic,
"Luna-Flow/luna-generic" @lf_alg,
"Luna-Flow/arithmetic" @lf_arith,
}///|
test "linear-algebra basic workflow" {
let imm = @immut.Matrix::from_2d_array([[1, 2], [3, 4]])
let imm_updated = imm.set(0, 1, 9)
inspect(imm_updated, content="|1, 9|\n|3, 4|")
let m = @mutable.Matrix::from_2d_array([[1.0, 2.0], [3.0, 4.0]])
m.set(0, 1, 9.0)
inspect(m.determinant().unwrap(), content="-23")
inspect(m.inverse() is Ok(_), content="true")
inspect(m.row_view(0)[1], content="9")
}moon fmt
moon info
moon check
moon test -p perf_support
moon test -p perf_runner
moon test --enable-coverage
./run_test.sh
LINEAR_ALGEBRA_TEST_BENCH=1 ./run_test.sh# This repository is primarily a library, so use an explicit package target.
moon run src/perf_runner mul_baseline_dense_64
# Optional: materialize benchmark fixtures ahead of time.
python3 bench/generate_fixtures.py
# Full benchmark flow.
just benchTrait-oriented linear algebra foundations for MoonBit, with checked APIs, backend wrappers, and mutable/immutable dense matrix and vector types.
Dependencies