nx_matrix.nx
buildroot/runtime/nx_matrix.nx
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
imports: syscalls.nx
imported by: nx_matrix_test.nxnx_swcompare_bench.nx
structs
| 30 | struct Matrix |
consts
| 28 | const NX_MATRIX_Q: i64 = 16384 // Q14 |
functions
| 38 | func nx_matrix_alloc(rows: i64, cols: i64) -> *Matrix |
| 51 | func nx_matrix_set(m: *Matrix, r: i64, c: i64, v: i64) -> i64 |
| 56 | func nx_matrix_get(m: *Matrix, r: i64, c: i64) -> i64 |
| 60 | func nx_matrix_fill(m: *Matrix, v: i64) -> i64 called by 1: nx_matrix_identity |
| 72 | func nx_matrix_identity(m: *Matrix, unit_value: i64) -> i64 |
| 87 | func nx_matrix_transpose(a: *Matrix) -> *Matrix |
| 106 | func nx_matrix_multiply(a: *Matrix, b: *Matrix, c: *Matrix) -> i64 |
| 134 | func nx_matrix_det_2x2(m: *Matrix) -> i64 |
| 141 | func nx_matrix_det_3x3(m: *Matrix) -> i64 |
| 168 | func nx_matrix_inv_2x2(m: *Matrix, out: *Matrix) -> i64 |
| 187 | func nx_matrix_inv_3x3(m: *Matrix, out: *Matrix) -> i64 |