@hecto/la
v3.0.0
Published
Typed-array linear algebra with vectors, matrices, decompositions, and acceleration hooks.
Readme
@hecto/la
Linear algebra. Vectors and matrices.
pnpm add @hecto/laimport { Vec, Mat } from '@hecto/la'
const v = Vec.from([1, 2, 3])
Vec.dot(v, Vec.from([4, 5, 6])) // 32
Vec.normalize(v)
Vec.cross(Vec.from([1, 0, 0]), Vec.from([0, 1, 0])) // [0, 0, 1]
const m = Mat.identity(3)
Mat.multiply(
m,
Mat.from([
[1, 2],
[3, 4],
[5, 6],
]),
)
Mat.transpose(m)
Mat.determinant(m)Vec and Mat namespaces cover creation, arithmetic, and decomposition.
Matrix dimensions always describe the exact Float64Array storage. Mat.multiplyInto validates
both inputs and the destination before writing, and supports exact or partially overlapping input
and output views by preserving the input values first.
The low-level Fast.mul2x2, Fast.mul3x3, and Fast.mul4x4 kernels also support exact and partial
overlap between either input and the output. They remain unchecked fixed-size operations, so each
view must contain the documented number of elements.
accelerate registers a caller-supplied backend; this package does not bundle a WASM backend.
Backend conformance therefore belongs to the provider and must be established for the registered
implementation rather than inferred from the registration hook.
