src/solvers/eigen3.c file

Functions

static auto mat3_sing_tol(const matrix3* m) -> vm_float_t
Scale-aware singularity cutoff for a 3×3.
auto mat3_inverse_ok(matrix3* res, const matrix3* m) -> bool
Inverse of a 3×3 with an ok flag.
static void sort3_asc(vm_float_t* a, vm_float_t* b, vm_float_t* c)
static void null_vec(vector3* v, const matrix3* s)
Null-space vector of a near-singular 3×3 via largest cross product of two columns.
void mat3_sym_eigen_ptr(vector3* eigenvalues, matrix3* axes, const matrix3* m)
Analytical eigensolve of a symmetric 3x3 matrix.

Function documentation

bool mat3_inverse_ok(matrix3* res, const matrix3* m)

Inverse of a 3×3 with an ok flag.

Parameters
res Output inverse.
m Input matrix.
Returns true if invertible.

Returns false and leaves *res unchanged if the matrix is singular (scale-aware cutoff). Otherwise writes the inverse and returns true.

static void null_vec(vector3* v, const matrix3* s)

Null-space vector of a near-singular 3×3 via largest cross product of two columns.

Writes a unit vector into v (column-major layout).

void mat3_sym_eigen_ptr(vector3* eigenvalues, matrix3* axes, const matrix3* m)

Analytical eigensolve of a symmetric 3x3 matrix.

Parameters
eigenvalues Output eigenvalues (sorted ascending).
axes Output eigenvector columns, or NULL.
m Input matrix (copied and symmetrized).

m is first replaced by (m + m^T) / 2. Eigenvalues are sorted ascending. Eigenvector i is column i of axes when axes is non-NULL. Analytical closed form.