JacobiSolver constructor
JacobiSolver({})
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.
equations
is the matrix containing the equationsconstants
is the vector with the known valuesx0
is the initial guess (which is a vector)precision
tells how accurate the algorithm has to bemaxSteps
the maximum number of iterations the algorithm
A
must be strictly diagonally dominant.
Implementation
factory JacobiSolver({
required List<List<double>> equations,
required List<double> constants,
required List<double> x0,
int maxSteps = 30,
double precision = 1.0e-10,
}) {
// The initial vector with the guesses MUST have the same size as the matrix
// of course
if (x0.length != constants.length) {
throw const SystemSolverException('The length of the guesses vector '
'must match the size of the square matrix.');
}
return JacobiSolver._(
equations: equations,
constants: constants,
x0: x0,
maxSteps: maxSteps,
precision: precision,
);
}