Skip to main content

solve_linear_system

Function solve_linear_system 

Source
pub fn solve_linear_system<S: Scalar, const N: usize>(
    a: &Matrix<S, N, N>,
    b: &Vector<S, N>,
) -> GeopResult<Vector<S, N>>
Expand description

Solve the dense N x N system a * x = b by Gaussian elimination with partial pivoting, returning x.

Errors if the system is singular — which, with interval scalars, means the pivot could be zero, not merely that it is: a pivot straddling zero carries no usable information about the solution, and dividing by it would manufacture an arbitrarily wide answer rather than report that there isn’t one. Callers that can proceed without a solution (a rank-deficient configuration they have a fallback for) should handle the error rather than pre-screen the matrix.

Pivot selection compares the sharpened magnitudes of the candidates. That is a conditioning choice, not a correctness claim: any row with a nonzero pivot yields the same solution set, and picking the largest one only keeps the elimination numerically well-behaved — so resolving the comparison to a single value (rather than leaving it three-valued) costs nothing, exactly as in NurbSurface::project’s per-iteration sharpening.