% Matlab transcript from CS 240A, 20 April 2011 % % You also need file CGmats.mat from the course web site % % "lugui" is part of the ncm package at % http://www.mathworks.com/moler/ncmfilelist.html A = randn(8) lugui(A) clc clear load CGmats whos Name Size Bytes Class Attributes Airfoil 4253x4253 563376 double sparse Airfoil2 4720x4720 552392 double sparse Airfoil2info 1x51 102 char Axy 4253x2 68048 double Axy2 4720x2 75520 double BCSSTK08 1074x1074 215976 double sparse BCSSTK08info 1x1 216670 struct Eppstein 547x547 63248 double sparse Exy 547x2 8752 double Grid 225x225 18848 double sparse Gxy 225x2 3600 double Smallmesh 136x136 14600 double sparse Sxy 136x2 2176 double Tapir 1024x1024 115656 double sparse Txy 1024x2 16384 double [n,n] = size(Airfoil2) n = 4720 nnz(Airfoil2) ans = 32164 n^2 ans = 22278400 spy(Airfoil2), shg gplotg(Airfoil2,Axy2),shg clc b = rand(n,1); size(b) ans = 4720 1 x = Airfoil2 \ b; norm(Airfoil2 * x - b) ans = 2.4711e-12 clc R = chol(Airfoil2); size(R) ans = 4720 4720 spy(R),shg spy(R'),shg nnz(Airfoil2) ans = 32164 nnz(R) ans = 385926 p = randperm(n); p clc A = Airfoil2(p,p); spy(A),shg analyze(A); Nonzeros: 2508518 Flops: 3.305289e+09 Height: 2361 Front size: 1820 R = chol(A); spy(R),shg p = amd(Airfoil2); size(p) ans = 1 4720 A = Airfoil2(p,p); spy(A),shg R = chol(A); spy(R'),shg clc A = Smallmesh; spy(A),shg gplotg(A,Sxy),shg spy(chol(A)) p = amd(A); spy(A(p,p)),shg etreeplot(A),shg etreeplot(A(p,p)),shg p = amd(Airfoil2); etreeplot(Airfoil2(p,p)),shg