我正在尝试分析 different iterative sub-solvers of the Newton equation system, using a Newton-Fischer reformulation of the LCP(linear complementarity problem) 的结果 . 到目前为止,我已经实现了精确求解器 - Gauss-Siedel和牛顿修改方法,该方法使用 bicg matlab 作为J * h = -p等式的子求解器(其中 J 是雅可比, p 是Fischer函数的值)和 h 是我的实现步骤) .
我实现bicg子解析器和精确求解器的部分代码:
if itt
% use iterative solver for newton eq
while ~all(fischer(x, A*x+b) == 0) & its < max_it
% compute the Jacobian
J = eval_jacobian(A, b, x);
% compute the value of the Fischer function
p = fischer(x, A*x + b);
% the natural merit function for convergence measure
residual(its) = .5*(p'*p);
% the newton eq, solve J*h = -p
h = bicg(J, -p, eps, s_its);
% update the solution vector
x = x + h;
% increment the iteration counter
its = its + 1;
end
else
% the exact solver for newton equation
while ~all(fischer(x, A*x+b) == 0) & its < max_it
% compute the Jacobian
J = eval_jacobian(A, b, x);
% compute the value of the Fischer function
p = fischer(x, A*x + b);
% the natural merit function for convergence measure
residual(its) = .5*(p'*p);
% the newton eq, solve J*h = -p
h = - J/p;
% update the solution vector
x = x + h;
% increment the iteration counter
its = its + 1;
end
那么,我的问题是你会使用其他迭代子解算器吗?如果在matlab中没有它们的功能,我不介意为它们实现代码 . 我意识到这更像是一个理论问题 . 谢谢 .
1 回答
除了
bicg
之外,还有许多其他迭代求解器用于一般非对称系统,有时可以提供更好的收敛,例如bicgstab
和gmres
. 这两种方法在精神上与bicg
类似,但在krylov子空间内涉及不同的更新策略 . MATLAB具有这两种方法的实现,因此您可以针对您的问题测试它们 .通常,在使用krylov迭代求解器时,通常可以通过合并预处理来实现更好的性能 . 这是一个非常复杂的主题 - 如果你还不熟悉,here就像开始一样好 . 我建议从一个简单的jacobi预处理器
diag(J)
开始,然后从那里开始 .迭代求解器有时也可以基于所谓的"matrix-free"方法获得额外的效率 - 求解器实际上只需要计算矩阵向量乘积
J*p
,它不需要全矩阵J
. 有可能编写一个有效的子例程来计算J*p
而不显式形成J
,但这取决于您特定问题的详细信息 .最后一个考虑因素是编程语言本身 - MATLAB为其直接求解器使用高度优化的库代码
J\p
,而krylov方法实现为m代码,这通常会导致性能损失 .希望这可以帮助 .