水水水水水水

function [ x , k , err , time ]= mjacobi ( A,b,x,tol ,max_it )
if nargin <5
   max_it =1000; 
end 
 if nargin <4
   tol=1.e-5;
 end 
 if nargin <3
  x = zeros ( length ( b ));
 end
 tic;
bnrm2= norm ( b );
r= b - A *x;
 err = norm ( r )/bnrm2;
 if ( err < tol )
 return ;
 end
 D = diag(diag ( A )); 
 for k =1:max_it
 x = D \(( D - A )*x+ b );
 r = b -A *x ;
 err = norm ( r )/bnrm2; 
 if ( err <= tol ) 
     break ; 
 end 
 end 
 time = toc ;
end

上一篇:SwiftUI macOS 如何新建一个Windows窗口并显示


下一篇:安卓:标题栏右上角添加按钮