code wiki / (root) / nx_matrix.nx

nx_matrix.nx

buildroot/runtime/nx_matrix.nx

7388 B223 linesdepth 3pulls 3 transitivereach 2 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_matrix.nx -- general matrix algebra (i64, row-major). Closes the gap that nx_kalman / nx_cam / nx_pc currently bridge with inline matrix arithmetic. Provides: + alloc / set / get / copy + identity / zeros / fill + transpose + multiply (C = A * B) + 2x2 + 3x3 determinant + 2x2 + 3x3 inverse (in Q14) Entries are pure i64. For fractional operations (inverse), gains are emitted in Q14 fixed-point so subsequent multiplications can be divided by NX_MATRIX_Q. genealogy_id: classical_linear_algebra + cramer_1750_determinant lineage_id: row_major_matrix + cofactor_expansion

dependencies 1 imports · 2 importers

syscalls.nx nx_matrix.nx nx_matrix_test.nx nx_swcompare_bench.nx

imports: syscalls.nx

imported by: nx_matrix_test.nxnx_swcompare_bench.nx

structs

30struct Matrix

consts

28const NX_MATRIX_Q: i64 = 16384 // Q14

functions

38func nx_matrix_alloc(rows: i64, cols: i64) -> *Matrix
51func nx_matrix_set(m: *Matrix, r: i64, c: i64, v: i64) -> i64
56func nx_matrix_get(m: *Matrix, r: i64, c: i64) -> i64
60func nx_matrix_fill(m: *Matrix, v: i64) -> i64
called by 1: nx_matrix_identity
72func nx_matrix_identity(m: *Matrix, unit_value: i64) -> i64
called by 1: main calls 2: nx_matrix_fillnx_matrix_set
87func nx_matrix_transpose(a: *Matrix) -> *Matrix
106func nx_matrix_multiply(a: *Matrix, b: *Matrix, c: *Matrix) -> i64
called by 2: mainmain calls 2: nx_matrix_getnx_matrix_set
134func nx_matrix_det_2x2(m: *Matrix) -> i64
141func nx_matrix_det_3x3(m: *Matrix) -> i64
168func nx_matrix_inv_2x2(m: *Matrix, out: *Matrix) -> i64
187func nx_matrix_inv_3x3(m: *Matrix, out: *Matrix) -> i64