if (nargout > 2)
[x, iterations, residual_norms] = ...
- successive_over_relaxation(A, b, omega, x0, tolerance, max_iterations);
+ successive_over_relaxation(omega, A, b, x0, tolerance, max_iterations);
else
[x, iterations] = ...
- successive_over_relaxation(A, b, omega, x0, tolerance, max_iterations);
+ successive_over_relaxation(omega, A, b, x0, tolerance, max_iterations);
end
end
function [x, iterations, residual_norms] = ...
- successive_over_relaxation(A, b, omega, x0, ...
+ successive_over_relaxation(omega, A, b, x0, ...
tolerance, max_iterations)
%
% Solve the system,
%
% INPUT:
%
+ % ``omega`` -- The relaxation factor.
+ %
% ``A`` -- The n-by-n coefficient matrix of the system.
%
% ``b`` -- An n-by-1 vector; the right-hand side of the system.
%
% ``x0`` -- An n-by-1 vector; an initial guess to the solution.
%
- % ``omega`` -- The relaxation factor.
- %
% ``tolerance`` -- (optional; default: 1e-10) the stopping tolerance.
% we stop when the relative error (the infinity norm
% of the residual divided by the infinity norm of