code wiki / (root) / nx_linalg.nx

nx_linalg.nx

buildroot/runtime/nx_linalg.nx

12378 B315 linesdepth 6pulls 9 transitivereach 46 importersview sourcekind librarytopic linalg
docsdependenciesstructsconstsfunctions

about

nx_linalg.nx -- vector + matrix engine. Native NishiLang linear algebra over integer (Q-format) and real elements. Vectors and matrices stored as flat arrays for tight memory + cache behaviour. Engine-style: dimensions are runtime parameters, not types -- one set of functions handles any size.

dependencies 2 imports · 6 importers

nx_kernel_v2.nx nx_fixq30_lib.nx nx_linalg.nx nx_capabilities_test.nx nx_identity_space_lib.nx nx_linalg_affine_domain_candidate_ nx_linalg_affine_factor_candidate_ nx_linalg_affine_t34.nx nx_linalg_chol_gate.nx

imports: nx_kernel_v2.nxnx_fixq30_lib.nx

imported by: nx_capabilities_test.nxnx_identity_space_lib.nxnx_linalg_affine_domain_candidate_t342.nxnx_linalg_affine_factor_candidate_t361.nxnx_linalg_affine_t34.nxnx_linalg_chol_gate.nx

structs

20struct Vec
80struct Mat

consts

24const NX_VEC_BYTES: nx_int = 16
85const NX_MAT_BYTES: nx_int = 24
186const LA_CHOL_OK: nx_int = 0
187const LA_CHOL_NOT_SQUARE: nx_int = 1
188const LA_CHOL_NOT_SYMMETRIC: nx_int = 2
189const LA_CHOL_NOT_PD: nx_int = 3
190const LA_CHOL_BAD_DIM: nx_int = 4
191const LA_CHOL_N: nx_int = 5
193const LA_CHOL_MAX_N: nx_int = 32 // the largest dimension whose residual band has been measured here
200const LA_CHOL_BAND_Q30: nx_int = 64 // ratchet: worst |A - L L^T| entry the gate permits, in Q30 units

functions

26func nx_vec_new(n: nx_int) -> *Vec
33func nx_vec_set(v: *Vec, i: nx_int, x: nx_int) -> nx_int
39func nx_vec_get(v: *Vec, i: nx_int) -> nx_int
44func nx_vec_add(a: *Vec, b: *Vec) -> *Vec
55func nx_vec_scale(a: *Vec, k: nx_int) -> *Vec
65func nx_vec_dot(a: *Vec, b: *Vec) -> nx_int
called by 2: t7_vecnx_vec_norm_sq calls 1: nx_vec_get
75func nx_vec_norm_sq(a: *Vec) -> nx_int
calls 1: nx_vec_dot
87func nx_mat_new(rows: nx_int, cols: nx_int) -> *Mat
94func nx_mat_set(m: *Mat, r: nx_int, c: nx_int, x: nx_int) -> nx_int
100func nx_mat_get(m: *Mat, r: nx_int, c: nx_int) -> nx_int
106func nx_mat_mul(a: *Mat, b: *Mat) -> *Mat
127func nx_mat_det2(m: *Mat) -> nx_int
called by 1: t8_matmul calls 1: nx_mat_get
132func nx_mat_det3(m: *Mat) -> nx_int
calls 1: nx_mat_get
143func nx_mat_transpose(m: *Mat) -> *Mat
202func la_chol_status_name(s: nx_int) -> *u8
214func la_is_symmetric(a: *Mat) -> nx_int
called by 1: la_cholesky_q30 calls 1: nx_mat_get
231func la_cholesky_q30(a: *Mat, l: *Mat) -> nx_int
287func la_chol_max_resid_q30(a: *Mat, l: *Mat) -> nx_int
called by 1: main calls 2: fq_mulnx_mat_get