-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcircle.m
67 lines (54 loc) · 1.33 KB
/
circle.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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
% Sec 8.1 (p. 46) of the paper
clear all
close all
clc
use_self_loop = true;
if use_self_loop,
load T_circle_selfloop_256
fn = 'circle_tree_sl';
else
load T_circle_256 % Created by make_T_circle.py
fn = 'circle_tree';
end
%D = diag(sum(W,1));
%T = D^-0.5 * W * D^-0.5;
load_file = false;
if load_file,
load(fn)
fprintf('Loaded %s\n', fn)
else
GSOptions = struct('StopDensity',1,'Threshold',1e-2);
opts = struct('Wavelets', true, 'OpThreshold', 1e-2, 'GSOptions', GSOptions);
tic
Tree = DWPTree(T, 15, 1e-10, GSOptions);
toc
save(fn, 'Tree')
fprintf('Tree saved in %s\n', fn)
end
% Make function as linear combination of two wavelet functions
j1 = 7;
j2 = 9;
f = 0.5*Tree{j1,2}.ExtBasis(:,1) + Tree{j2,2}.ExtBasis(:,end-3);
%% Take DW transform of f
wc_tree = DWCoeffs(Tree, f);
wc_ = DWWavelet(wc_tree); % These are the N coefficients: 7 scaling + 505 wavelets
wc = DWUnpack(wc_);
wc = full(wc);
%f_hat = best_k_approx(Tree, wc, 2);
%% Plot eigenvalues of T
figure
evals = eig(T);
figure(1)
plot(sort(evals,'descend'))
grid
xlim([1,size(T,1)])
%ylim([0,1])
%% Plot scaling functions
figure
for j = 1:9, %size(Tree,1),
subplot(3,3,j);
plot(Tree{j,1}.ExtBasis(:,1))
hold on
plot(Tree{j,1}.ExtBasis(:,end/2), 'r')
title(sprintf('Diffusion scaling function at scale %d',j));
end