linear-algebra
Luna-Flow/linear-algebra is the linear-algebra layer of Luna Flow. It
provides dense matrices and vectors in two execution models, value-oriented
(immut) and in-place (mutable), numerical routines for floating-point
matrices, exact algorithms for integer matrices, and small capability layers
(algebra, container) that let generic algorithms run on any matrix or
vector type that implements them. This manual describes release 0.5.0.
Packages
| Package | Purpose | Pages |
|---|---|---|
immut | immutable Matrix, Vector, lazy MatrixFn; exact determinants and powers | API · tutorial · design |
mutable | in-place Matrix, Vector, views; LU, Cholesky, eigenvalues, statistics | API · tutorial · design |
error | LinearAlgebraError for every checked API | API · tutorial · design |
arithmetic | scalar operation traits and re-exports | API · tutorial · design |
algebra | structure traits for whole vectors and matrices (experimental) | API · tutorial · design |
backends/default | dense wrappers implementing the algebra traits | API · tutorial · design |
container | storage-independent operation dictionaries and generic conversions (experimental) | API · tutorial · design |
container/adapters | dictionaries for every type of this repository | API · tutorial · design |
internal | shared shape guards (importable only inside this module) | API · tutorial · design |
consistency | cross-package agreement tests (no public items) | API · tutorial · design |
perf_support | benchmark cases, fixtures and execution | API · tutorial · design |
perf | moon bench entry package | API · tutorial · design |
perf_runner | single-case benchmark executable | API · tutorial · design |
The package src/doc_en_us is not documented separately: it links every page
of this manual as a .mbt.md file so that the examples compile and run as
tests. The architecture guide shows how the packages depend
on each other. The integration chapter explains how
external libraries join the algebra and container
layers.
Reading paths
Application developers. Start with the mutable tutorial
for numerical work on Double matrices, or the immut tutorial
for value semantics and exact integer results. Read the
error tutorial next, since every operation that can fail
returns a LinearAlgebraError.
Library and algorithm authors. Read the algebra tutorial and the backends/default tutorial to write generic code, then the container tutorial for moving data between representations, and the integration guides before publishing implementations for your own types.
Contributors. Read the architecture guide, the conventions, the design pages of the package you change, and the internal and consistency tutorials. Benchmarks are covered by the perf pages.
Install
moon add Luna-Flow/linear-algebra@0.5.0
Import the packages you use in moon.pkg:
///|
import {
"Luna-Flow/linear-algebra/immut",
"Luna-Flow/linear-algebra/mutable",
"Luna-Flow/linear-algebra/error" @la_error,
}
Generic code over scalar types also needs the upstream packages
Luna-Flow/luna-generic (0.3.3) and Luna-Flow/arithmetic (0.2.2).
Toolchain
The module requires MoonBit with moonc 0.10 or newer and builds without
warnings with moon check --target all. All packages support the wasm-gc,
js, wasm and native targets; mutable has a tuned kernel file per
target. The benchmark packages are run on native.
Status in 0.5.0
algebra,backends/default’s trait layer andcontainerare experimental; their signatures may change.- The native OpenBLAS backend is withdrawn in this release because its
upstream binding does not compile with MoonBit 0.10. Its source is preserved
outside the manual in
contrib/openblas_backend; users who need it can stay on0.4.7. - Release history is in the changelog.