solve_linear_system

Function solve_linear_system 

Source
pub fn solve_linear_system(
    a: &Matrix<f64>,
    b: &Vec<f64>,
) -> Result<LinearSolution, String>
Expand description

Solves a system of linear equations Ax = b.

This function constructs an augmented matrix [A | b], computes its Reduced Row Echelon Form (RREF), and then analyzes the RREF to determine the nature of the solution:

  • Unique Solution: Returns a unique solution vector.
  • Parametric Solution: Returns a particular solution and a basis for the null space.
  • No Solution: Indicates an inconsistent system.

§Arguments

  • a - The coefficient matrix A.
  • b - The constant vector b.

§Returns

A Result containing a LinearSolution enum, or an error string.