From cd4c36a426fb5a9105e0b834e69cfd78960337ce Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Tue, 7 May 2013 13:56:20 -0400 Subject: [PATCH] Place the 'omega' parameter to successive_over_relaxation() first -- a more natural position. --- iterative/gauss_seidel.m | 4 ++-- iterative/successive_over_relaxation.m | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/iterative/gauss_seidel.m b/iterative/gauss_seidel.m index a844142..62826fb 100644 --- a/iterative/gauss_seidel.m +++ b/iterative/gauss_seidel.m @@ -13,9 +13,9 @@ function [x, iterations, residual_norms] = ... 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 diff --git a/iterative/successive_over_relaxation.m b/iterative/successive_over_relaxation.m index 2bb96f8..71b702d 100644 --- a/iterative/successive_over_relaxation.m +++ b/iterative/successive_over_relaxation.m @@ -1,5 +1,5 @@ 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, @@ -26,14 +26,14 @@ function [x, iterations, residual_norms] = ... % % 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 -- 2.44.2