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.
matrix
is the matrix containing the equations;knownValues
is the vector with the known values;x0
is the initial guess (which is a vector);precision
tells how accurate the algorithm has to be;maxSteps
the maximum number of iterations the algorithm.
The matrix
A
must be strictly diagonally dominant.
Implementation
factory JacobiSolver({
required RealMatrix matrix,
required List<double> knownValues,
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 != knownValues.length) {
throw const SystemSolverException(
'The length of the guesses vector '
'must match the size of the square matrix.',
);
}
return JacobiSolver._(
matrix: matrix,
knownValues: knownValues,
x0: x0,
maxSteps: maxSteps,
precision: precision,
);
}