Jake: 3 pages? It can be done in about 23 lines of C or Fortran, including the forward/backsolve. It can be done in 1 line of MATLAB (x=A\b), or if you don't want to use backslash, in about 14 lines of (well-written) MATLAB, including proper partial pivoting. This code is double that if you graciously exclude the "please input your matrix" prompts. In addition, Rostami's code does NOT do partial pivoting; all it checks if the pivot is zero.
This code is absolute dreck. Here is the output for a trivial 2-by-2 matrix that breaks this code:
Solution of N-equation "[A][X]=[r]"
Enter number of Equations :2
Enter Matrix [A]:[1e-24 1 ; 1 1]
Enter Matrix [r]:[2 ; 3]
@----------------------------------------------------------@
Output [B][x]=[b]
Upper riangular Matrix [B] =
1.0e+24 *
0.0000 0.0000
0 -1.0000
Matrix [b] =
1.0e+24 *
0.0000
-2.0000
solution of linear equations :
0
2
solve with matlab functions(for checking):
1
2
The MATLAB solution (using x=inv(A)*b of all things!) is correct. Rostami's code gives a completely incorrect answer.
Please delete this file from the File Exchange; it leads unwary users (like Jake) down the wrong path with counterfeit algorithms that pretend to be robust.
Comment only