linsolve with symmetric property set is slower than without
조회 수: 2 (최근 30일)
이전 댓글 표시
Hello,
I want to improve the performance of solving a system of linear equations Ax=b. I have a symmetric A matrix. This matrix and the corresponding b-Vector are changing each iteration.
for it=1:600
% just to demonstrate, that A and b are changing every iteration
A = funA(x);
b = funb(x);
t1 = tic();
sol = A\b;
tmldivide(it) = toc(t1);
LSopts.POSDEF = false;
LSopts.SYM = true;
t1 = tic();
sol1 = linsolve(A, b, LSopts);
tlinsolve1(it) = toc(t1);
LSopts.POSDEF = false;
LSopts.SYM = false;
t1 = tic();
sol2 = linsolve(A, b, LSopts);
tlinsolve2(it) = toc(t1);
end
The sum and mean elapsed times are as follows
sum(tmldivide): 0.715083
sum(tlinsolve1): 0.616885
sum(tlinsolve2): 0.35114
mean(tmldivide): 0.001135052380952
mean(tlinsolve1): 9.791825396825392e-04
mean(tlinsolve2): 5.573650793650793e-04
The solutions sol and sol1 are identical. The error between sol and sol2 are very small (in the range of 1e-14). My question is now, why is linsolve faster if I say, that the matrix is not symmetric even though it is a symmetric matrix. Shouldn't it be more efficient if I spcify the properties correctly? Another question would be, if there is a way to speed the solving of the Ax=b up even further?
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Particle & Nuclear Physics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!