Starting diary file "diary-2016-01-13.txt" on Wed Jan 13 2016 12:36 PM. A = round( 100 * rand(5)) A = 81 10 16 14 66 91 28 97 42 4 13 55 96 92 85 91 96 49 79 93 63 96 80 96 68 A * [3 ; 1 ; 4 ; 1 ; 5] ans = 661 751 995 1109 1041 b = ans b = 661 751 995 1109 1041 x = A \ b x = 3.0000 1.0000 4.0000 1.0000 5.0000 format long x x = 2.999999999999997 1.000000000000010 4.000000000000006 0.999999999999985 5.000000000000002 format short x x = 3.0000 1.0000 4.0000 1.0000 5.0000 residual = b - A * x residual = 1.0e-12 * 0.1137 0 0.2274 0 0 norm(residual) ans = 2.5421e-13 relative_residual_norm = norm(residual) / norm(b) relative_residual_norm = 1.2253e-16 lugui clc clear A = round( 100 * rand(5)) A = 40 18 58 35 12 26 26 55 51 18 80 15 14 40 24 43 14 85 8 42 91 87 62 24 5 [L, U, P ] = lu(A) L = 1.0000 0 0 0 0 0.8791 1.0000 0 0 0 0.4725 0.4409 1.0000 0 0 0.2857 -0.0186 0.4966 1.0000 0 0.4396 0.3292 0.5992 0.5015 1.0000 U = 91.0000 87.0000 62.0000 24.0000 5.0000 0 -61.4835 -40.5055 18.9011 19.6044 0 0 73.5634 -11.6747 30.9932 0 0 0 50.2920 1.5441 0 0 0 0 -15.9990 P = 0 0 0 0 1 0 0 1 0 0 0 0 0 1 0 0 1 0 0 0 1 0 0 0 0 L*U ans = 91.0000 87.0000 62.0000 24.0000 5.0000 80.0000 15.0000 14.0000 40.0000 24.0000 43.0000 14.0000 85.0000 8.0000 42.0000 26.0000 26.0000 55.0000 51.0000 18.0000 40.0000 18.0000 58.0000 35.0000 12.0000 P*A ans = 91 87 62 24 5 80 15 14 40 24 43 14 85 8 42 26 26 55 51 18 40 18 58 35 12 help lu LU LU factorization. ... help lutx LUTX Triangular factorization, textbook version [L,U,p] = lutx(A) produces a unit lower triangular matrix L, an upper triangular matrix U, and a permutation vector p, so that L*U = A(p,:) [L, U, p] = lutx(A) L = 1.0000 0 0 0 0 0.8791 1.0000 0 0 0 0.4725 0.4409 1.0000 0 0 0.2857 -0.0186 0.4966 1.0000 0 0.4396 0.3292 0.5992 0.5015 1.0000 U = 91.0000 87.0000 62.0000 24.0000 5.0000 0 -61.4835 -40.5055 18.9011 19.6044 0 0 73.5634 -11.6747 30.9932 0 0 0 50.2920 1.5441 0 0 0 0 -15.9990 p = 5 3 4 2 1 b = [3;1;4;1;5] b = 3 1 4 1 5 P*b ans = 5 4 1 1 3 b(p) ans = 5 4 1 1 3 P P = 0 0 0 0 1 0 0 1 0 0 0 0 0 1 0 0 1 0 0 0 1 0 0 0 0 p p = 5 3 4 2 1 lugui(A) edit bslashtx.m clc clear load temperature whos Name Size Bytes Class Attributes A100 10000x10000 873608 double sparse A4 16x16 2048 double b100 10000x1 80000 double b4 16x1 128 double A = A100; size(A) ans = 10000 10000 n = length(A) n = 10000 n^3 ans = 1.0000e+12 [L, U, p] = lutx(A) {??? Operation terminated by user during ==> lutx.m at 33} size(A) ans = 10000 10000 nnz(A) ans = 49600 spy(A),shg [L, U, P] = lu(A); size(L) ans = 10000 10000 nnz(L) ans = 1000099 spy(L),shg