@lakuna/umath
v1.3.8
Published
A lightweight math library.
Downloads
76
Readme
μMath
A lightweight math library.
Documentation is automatically generated and uploaded to the website.
The source code can be found on the GitHub repository.
Linear Algebra API
In addition to exporting convenience classes representing a variety of linear algebra-related data types, each such type also has its own module that exports individual functions. For example, a two-by-two matrix can be imported in two different ways:
import { Matrix2 } from "@lakuna/umath";
import Matrix2 from "@lakuna/umath/Matrix2";
Using the convenience class, multiplying two two-by-two matrices would look like this:
import { Matrix2 } from "@lakuna/umath";
const a = Matrix2.fromValues(0, 1, 2, 3);
const b = Matrix2.fromValues(4, 5, 6, 7);
const c = a.multiply(b);
Using the raw functions, it could instead look like this:
import { multiply } from "@lakuna/umath/Matrix2";
const a = [0, 1, 2, 3];
const b = [4, 5, 6, 7];
const c = multiply(a, b, [0, 0, 0, 0]);