SystemSolver constructor

SystemSolver({
  1. required int size,
  2. required List<List<double>> A,
  3. required List<double> b,
  4. double precision = 1.0e-10,
})

Given an equation in the form Ax = b, A is a square matrix containing n equations in n unknowns and b is the vector of the known values.

  • size is the total number of equations
  • A is the matrix containing the equations
  • b is the vector with the known values

Implementation

SystemSolver({
  required int size,
  required List<List<double>> A,
  required List<double> b,
  this.precision = 1.0e-10,
}) {
  // Building the matrix
  equations = RealMatrix.fromData(
    rows: size,
    columns: size,
    data: A,
  );

  // The vector of known values must match the size of the matrix
  if (equations.rowCount != b.length) {
    throw const SystemSolverException('The known values vector must have the '
        'same size as the matrix.');
  }

  // Copying and storing internally the list of known values
  _knownValues = b.map((value) => value).toList();
}