1 Module N_LINALG
gullradriel edited this page 2026-10-29 20:54:40 +01:00

LINALG: small dense linear systems

Functions

Name
int n_linalg_solve(double * a, double * b, size_t n)
Solve a x = b for a small dense system, in place.

Functions Documentation

function n_linalg_solve

int n_linalg_solve(
    double * a,
    double * b,
    size_t n
)

Solve a x = b for a small dense system, in place.

Parameters:

  • a the n by n matrix, row major; destroyed
  • b the right side, n values; receives the solution x
  • n the unknowns, at least 1

Return: TRUE when solved, FALSE on a NULL argument, n of 0, or a pivot below 1e-12 times the matrix's largest entry (singular or nearly), b then left partly reduced

Gaussian elimination with partial pivoting, in doubles: for the normal equations of a least squares fit (a polynomial surface, a warp), a few to a few tens of unknowns. Cubic in n; not meant for large or sparse systems.