13 lines
312 B
Mathematica
13 lines
312 B
Mathematica
|
function [x, lambda] = uzawa(G, c, A, b, x, lambda, tol, max_itr)
|
||
|
w = 1;
|
||
|
old_x = ones(size(G, 1)) * 124000000;
|
||
|
i = 0;
|
||
|
|
||
|
while i < max_itr && norm(x - old_x) > tol
|
||
|
old_x = x;
|
||
|
x = G \ (c - (A' * lambda));
|
||
|
lambda = lambda + w * (A * x - b);
|
||
|
i = i + 1;
|
||
|
end
|
||
|
end
|