use-linear
Install
[]
= "0.0.1"
Foundation
use-linear provides a deliberately small numeric linear-algebra surface for 2D vectors and 2×2 matrices. The first slice includes a Vector2 type, a Matrix2 type, dot products, matrix-vector and matrix-matrix products, and explicit solving of small linear systems through LinearError. The crate stays close to ordinary f64 math instead of introducing a large generic tensor framework.
| Helper group | Primary items | Best fit |
|---|---|---|
| Vector operations | Vector2, dot |
Small numeric code that needs explicit 2D linear operations |
| Matrix operations | Matrix2 |
Call sites that need compact 2×2 products, determinants, and trace values |
| Solves and error handling | solve_2x2, LinearError |
Small systems where singular behavior should stay explicit |
When to use directly
Choose use-linear directly when vector and matrix utilities are the only surface you need and you want to keep that concern narrower than the umbrella facade.
| Scenario | Use use-linear directly? |
Why |
|---|---|---|
| You need 2D numeric vectors and 2×2 matrices | Yes | The current surface already covers the common small linear-algebra cases directly |
| You need explicit handling of singular 2×2 solves | Yes | The API keeps failure visible through LinearError |
| You also need geometry, calculus, or other math domains | Usually no | use-math can compose the concrete surfaces behind features |
Scope
- The current surface is intentionally small and concrete.
- Helpers stay focused on
f64-based 2D vectors and 2×2 matrices instead of a broader generic tensor framework. - Geometry-specific spatial types and broader algebraic traits belong in adjacent focused crates.
Examples
Vector and matrix products
use ;
let vector = new;
let other = new;
let matrix = new;
assert!;
assert!;
assert_eq!;
assert_eq!;
Solving a 2×2 system
use ;
let matrix = new;
let rhs = new;
assert_eq!;
# Ok::
Status
use-linear is a concrete pre-1.0 crate in the RustUse docs surface. The API remains intentionally small while adjacent geometry and algebra crates continue to grow around it.