📄 test_lin_solve.m
字号:
function x=test_lin_solve(y)
s=0;n=0;
while(1)
A=randn(y);
x=randn(y,1);
n=n+1;
if (norm(A*(lin_solve(A,x))-x)<norm(A*(A\x)-x)) s=s+1;
% compares accuracy of lin_solve to matlabs \
end;
s/n
% s/n measures the percentage that lin_solve is more accurate than \
% for y < 50, s/n < 0.5
% for y > 50, s/n > 0.5
% particularly, s/n -> 1 for y>=100
% however lin_solve is much slower than \ for large y.
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -