Scalar, vector, and matrix helpers, including transcendental functions, interpolation, vector products, transposition, and determinant-based matrix operations.
Vector (itemSchema itemCount -- vectorSchema): builds one vector schema as one unnamed fixed-size combined value.Matrix (itemSchema columnCount rowCount -- matrixSchema): builds one matrix schema as a fixed-size vector of fixed-size row vectors.vector?, matrix?, getColCount, and getRowCount: vector and matrix shape queries.E, E64, PI, and PI64: scalar constants.acos, asin, atan, atan2, exp, tan, and cosSin: scalar trigonometric and exponential helpers.+, -, multiply, divide, and vector equality require vectors of the same size.dot requires two vectors of the same size.cross requires two 3-item vectors.* supports scalar-vector, vector-scalar, vector-matrix, and matrix-matrix multiplication.* is invalid. The corresponding operations are dot, cross, and multiply.trans converts one vector to a one-column matrix and swaps matrix rows and columns.| concatenates matrices vertically when their column counts match, and one overload appends a same-width vector as one additional row.& concatenates vectors directly or concatenates matrices row-wise when their row counts match.det, adj, and inv require square matrices. The module provides determinant and adjugate formulas for sizes 1 through 4.=: compares equal-size vectors item by item. One additional overload compares one vector with one one-row matrix of equal width.lerp: linear interpolation between two same-shaped numeric values with one blend factor.+ and -: elementwise vector addition and subtraction for equal-size vectors.*: scalar-vector multiplication, vector-scalar multiplication, vector-matrix multiplication, and matrix-matrix multiplication./: divides every vector item by one scalar.multiply: Hadamard product of equal-size vectors.divide: elementwise division of equal-size vectors.neg: negates every vector item.cast: casts every vector item to the target vector item schema.|: concatenates matrices vertically or appends one vector as one additional row.&: concatenates vectors or concatenates matrix rows horizontally.trans: transposes a matrix or converts a vector to a one-column matrix.angle: polar angle of a 2-item vector.toColumn: converts one vector to a one-column matrix.dot: scalar dot product of equal-size vectors.cross: cross product of two 3-item vectors.squaredLength: squared Euclidean length.length: Euclidean length.unit: normalized vector.unitChecked: normalized vector with a short-length fallback to the first basis vector.rotationMatrix: builds a 2×2 rotation matrix from one Real32 angle.det: determinant for square matrices of sizes 1, 2, 3, and 4.adj: adjugate for square matrices of sizes 1, 2, 3, and 4.inv: inverse of a square matrix through adj / det."algebra" use
"control" use
{} () {} [
v: (1i32 2i32 3i32);
w: (4i32 5i32 6i32);
v w + printStack _:;
v w dot printStack _:;
] "main" exportFunction
(5 7 9)
32
"algebra" use
"control" use
{} () {} [
m: ((1i32 2i32) (3i32 4i32));
m det printStack _:;
] "main" exportFunction
-2
"algebra" use
"String" use
"control" use
{} Int32 {} [
v: (1i32 2i32 3i32);
w: (4i32 5i32 6i32);
sum: v w +;
expected: (5i32 7i32 9i32);
sum expected = print
LF print
v w dot 32 same print
LF print
0
] "main" exportFunction
TRUE
TRUE