I implement the LU decomposition algorithm in Matlab for some large sparse Matrices to solve the linear system. When I got the L,U matrix, I used the backward substitution and forward substitution algorithm to solve the triangular linear system:
%x = U\y;
for i = n : -1 : 1
x(i,:) = (y(i,:)-U(i,:)*x)/U(i,i);
end
but I found this code is the bottleneck. Although I can use the A\b to get the solution, but I want to know how can I implement a efficient algorithm to solve this problem in Matlab, For example, Can I write the matrix product to simulate the following action without for loop?
(I got some reference books and paper, but all of the code is not in Matlab, just for C++ or C code)