% Matlab diary from cs111, Oct 17 2007. % % This is what I typed in class. % % Type it into Matlab yourself to % reproduce the output I showed. diary on load temperature size(A100) prod(ans) 8*ans spy(A100) nnz(A100) whos [L,U,P] = lu(A100); whos nnz(P) nnz(L) nnz(U) whos [L,U,P] = lu(A4); whos B = sparse(A4); C = full(B); whos A4 P clc clear whos [U,G] = surfer('http://cs.ucsb.edu',50); %% Note: you can also get U and G by %% putting "ucsbmat2007.mat" from the course web page in your directory %% and saying "load ucsbmat2007" to Matlab whos U U(25) G(25,25) G(25,26) U(3) x = zeros(50,1) x(3)=1 nnz(x) x(3) size(G) G*x sparse(G*x) G(:,3) y = sparse(G*x) y = y / sum(y) z = G * y z = z / sum(z) sum(z) clc size(G) c = sum(G); size(c) c nnz(c) find(c == 0) G(:,13) x = zeros(50,1); x(13)=1; sparse(x) sparse(G*x) G = G | speye(50); help speye help eye spy(G) E = ones(5) x = rand(5,1) y = E*x y = y / sum(y) clc e = ones(50,1) size( e * e') clc c = sum(G); c size(c) c = sparse( 1 ./ c); size(c) D = diag(c); size(D) nnz(D) figure, spy(D) GD = G*D; s = sum(GD); s diary off