what
M-files in the current directory /Users/gilbert/Documents/CS219spring2013/Matlab
clustereg jacobi misseq
gploth misluby startup
MAT-files in the current directory /Users/gilbert/Documents/CS219spring2013/Matlab
clusters meshes
heatproblem
load heatproblem
whos
Name Size Bytes Class Attributes
A 10000x10000 873608 double sparse
b 10000x1 80000 double
d 1x25 50 char
dfile 1x21 42 char
A
A =
(1,1) 4
...
(10000,10000) 4
whos
spy(A)
plot(b)
x = A \ b;
size(x)
ans =
10000 1
X = reshape(x,100,100);
size(X)
ans =
100 100
surfc(X),shg
clc
clear
whos
what
M-files in the current directory /Users/gilbert/Documents/CS219spring2013/Matlab
clustereg jacobi misseq
gploth misluby startup
MAT-files in the current directory /Users/gilbert/Documents/CS219spring2013/Matlab
clusters meshes
heatproblem
load clusters
whos
Name Size Bytes Class Attributes
A 50x50 9400 double sparse
S 4x4 72 double sparse
ans 100x1 800 double
ignore 50x1 400 double
lambda 2x1 16 double
p 1x50 400 double
pp 50x1 400 double
uv 50x2 800 double
xy 50x2 800 double
spy(A)
gploth(A,xy,1:length(A))
A
sum(A)
ans =
All zero sparse: 1-by-50
min(diag(A))
ans =
(1,1) 5
max(diag(A))
ans =
(1,1) 14
help eigs
[V,D] = eigs(A,[],3,'SM');
{??? Error using ==>
eigs>checkInputs/LUfactorAminusSigmaB at 1136
(A-sigma*I)is singular. The shift is an eigenvalue.
Try to use some other shift please.
help fiedler
FIEDLER : Fiedler vector of a graph.
x = fiedler(G) returns the eigenvector corresponding to
the second-smallest eigenvalue of the laplacian matrix
of the graph whose adjacency matrix is G|G'.
(If G is connected this is the smallest positive eval.)
[x,lambda] = fiedler(G) also returns the eigenvalue.
[x,lambda] = fiedler(G,k) returns the k smallest nonzero eigenvalues
and their eigenvectors.
[x,lambda] = fiedler(G,k,verbose) prints some trace information:
verbose = 0 for none, 1 for some, 2 for more.
If G is full or smaller than 100 vertices we use Matlab's full "eig";
if G is sparse we use an iterative method.
This is *not* an efficient implementation, it's just for playing with
small examples.
See also laplacian, specpart.
[uv,lambda] = fiedler(A,2);
size(uv)
ans =
50 2
uv
uv =
-0.1861 0.0589
0.0537 -0.1840
0.1924 0.2106
-0.1894 0.0508
...
0.0738 -0.2267
-0.1515 0.0652
-0.1781 0.0492
lambda
lambda =
0.8595
0.9956
plot(eig(full(A)),'.');
[uv,lambda] = fiedler(A,2); gploth(A,uv,1:length(A));
shg
diary off