Starting diary file "diary-2016-01-06.txt" on Wed Jan 06 2016 12:24 PM. 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 A4 A4 = Columns 1 through 9 4 -1 0 0 -1 0 0 0 0 -1 4 -1 0 0 -1 0 0 0 0 -1 4 -1 0 0 -1 0 0 0 0 -1 4 0 0 0 -1 0 -1 0 0 0 4 -1 0 0 -1 0 -1 0 0 -1 4 -1 0 0 0 0 -1 0 0 -1 4 -1 0 0 0 0 -1 0 0 -1 4 0 0 0 0 0 -1 0 0 0 4 0 0 0 0 0 -1 0 0 -1 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 10 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 -1 0 0 0 0 -1 0 0 -1 0 0 0 4 -1 0 0 -1 0 0 -1 4 -1 0 0 -1 0 0 -1 4 0 0 0 -1 0 0 0 4 -1 0 0 -1 0 0 -1 4 -1 0 0 -1 0 0 -1 4 -1 0 0 -1 0 0 -1 4 size(b100) ans = 10000 1 nnz(b100) ans = 41 find(b100) ans = 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 t = A100 \ b100; T = reshape(t,100,100); surfc(T); shg k = 100 k = 100 n = k^2 n = 10000 nnz(b100) ans = 41 b = b100; b(n - 3*k/4 : n - k/4) = 50; nnz(b) ans = 92 t = A100 \ b; T=reshape(t,k,k); surfc(T); shg edit makeb.m rad = [zeros(1,25) 100*ones(1,50) zeros(1,25)] cold = zeros(1,100); b = makeb(rad,cold,cold,cold); t = A100 \ b; T=reshape(t,k,k); surfc(T); shg b = makeb(rad,rad,rad,rad); t = A100 \ b; T=reshape(t,k,k); surfc(T); shg wave = sin((0:99)/100 * 2*pi); size(wave) ans = 1 100 plot(wave),shg b = makeb(wave,wave,wave,wave); t = A100 \ b; T=reshape(t,k,k); surfc(T); shg b = zeros(n,1); b(5678) = 25; nnz(b) ans = 1 find(b) ans = 5678 t = A100 \ b; T=reshape(t,k,k); surfc(T); shg clc whos Name Size Bytes Class Attributes A100 10000x10000 873608 double sparse A4 16x16 2048 double T 100x100 80000 double ans 1x2 16 double b 10000x1 80000 double b100 10000x1 80000 double b4 16x1 128 double cold 1x100 800 double k 1x1 8 double n 1x1 8 double rad 1x100 800 double t 10000x1 80000 double wave 1x100 800 double clear whos 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 save myfile clear whos load myfile whos Name Size Bytes Class Attributes A100 10000x10000 873608 double sparse A4 16x16 2048 double b100 10000x1 80000 double b4 16x1 128 double clear clc A = rand(4) A = 0.8147 0.6324 0.9575 0.9572 0.9058 0.0975 0.9649 0.4854 0.1270 0.2785 0.1576 0.8003 0.9134 0.5469 0.9706 0.1419 A = reshape(1:16,4,4) A = 1 5 9 13 2 6 10 14 3 7 11 15 4 8 12 16 A = A' A = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 x = rand(4,1) x = 0.4218 0.9157 0.7922 0.9595 A*x ans = 8.4678 20.8246 33.1814 45.5382 x * A {??? Error using ==> mtimes Inner matrix dimensions must agree. } x' * A ans = 24.6037 27.6929 30.7821 33.8713 x' ans = 0.4218 0.9157 0.7922 0.9595 A*x ans = 8.4678 20.8246 33.1814 45.5382 A A = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 x = [ 2 0 0 1]' x = 2 0 0 1 A*x ans = 6 18 30 42 y = [ 0 1 0 0]' y = 0 1 0 0 A A = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 A * y ans = 2 6 10 14 xy = [x y] xy = 2 0 0 1 0 0 1 0 A*xy ans = 6 2 18 6 30 10 42 14 A * A ans = 90 100 110 120 202 228 254 280 314 356 398 440 426 484 542 600 I = eye(4) I = 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 x x = 2 0 0 1 I*x ans = 2 0 0 1 A A = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 A*I ans = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 S = diag([.5 .3 .25 .20]) S = 0.5000 0 0 0 0 0.3000 0 0 0 0 0.2500 0 0 0 0 0.2000 A A = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 A*S ans = 0.5000 0.6000 0.7500 0.8000 2.5000 1.8000 1.7500 1.6000 4.5000 3.0000 2.7500 2.4000 6.5000 4.2000 3.7500 3.2000 P = [ 0 1 0 0 ; 0 0 1 0; 0 0 0 1; 1 0 0 0] P = 0 1 0 0 0 0 1 0 0 0 0 1 1 0 0 0 A A = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 A*P ans = 4 1 2 3 8 5 6 7 12 9 10 11 16 13 14 15 P * A ans = 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 clc A = reshape(1:64,8,8) A = 1 9 17 25 33 41 49 57 2 10 18 26 34 42 50 58 3 11 19 27 35 43 51 59 4 12 20 28 36 44 52 60 5 13 21 29 37 45 53 61 6 14 22 30 38 46 54 62 7 15 23 31 39 47 55 63 8 16 24 32 40 48 56 64 p = randperm(8) p = 2 8 1 5 7 6 3 4 A(:, p) ans = 9 57 1 33 49 41 17 25 10 58 2 34 50 42 18 26 11 59 3 35 51 43 19 27 12 60 4 36 52 44 20 28 13 61 5 37 53 45 21 29 14 62 6 38 54 46 22 30 15 63 7 39 55 47 23 31 16 64 8 40 56 48 24 32 I = eye(8) I = 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 Pnew = I(:,p) Pnew = 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 A*Pnew ans = 9 57 1 33 49 41 17 25 10 58 2 34 50 42 18 26 11 59 3 35 51 43 19 27 12 60 4 36 52 44 20 28 13 61 5 37 53 45 21 29 14 62 6 38 54 46 22 30 15 63 7 39 55 47 23 31 16 64 8 40 56 48 24 32 A(:,p) ans = 9 57 1 33 49 41 17 25 10 58 2 34 50 42 18 26 11 59 3 35 51 43 19 27 12 60 4 36 52 44 20 28 13 61 5 37 53 45 21 29 14 62 6 38 54 46 22 30 15 63 7 39 55 47 23 31 16 64 8 40 56 48 24 32