-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdecomposeTest.m
59 lines (57 loc) · 1.38 KB
/
decomposeTest.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
%test decompose function:
para = struct();
para.SVDmethod = 'qr';
para.parity = 'n';
%% setup time arrays
tAQR = zeros(20,20);
tAQRave = tAQR;
tASVD = zeros(20,20);
tASVDave = tASVD;
%%
runs = 40;
for k = 1:1:runs
for j = 2:2:40 % d_opt
for i = 2:2:40 % D or d_k
A = randn(i,i,j);
tStart = tic;
[Q,V] = decompose(A,2,para);
tAQR(i/2,j/2) = toc(tStart);
clear('Q','V')
tStart = tic;
[Q,V,vNE,sv] = decompose(A,2,para);
tASVD(i/2,j/2) = toc(tStart);
clear('Q','V')
end
end
%
tAQRave = tAQRave+tAQR;
tASVDave = tASVDave+tASVD;
end
tAQRave = tAQRave./runs;
tASVDave = tASVDave./runs;
%%
tAQRave = medfilt2(tAQRave);
tASVDave = mediflt2(tASVDave);
%% Plot Data for V
saveto = '..\Presentations\20140206 - Summary\';
surf(tAQRave)
hold on
surf(tASVDave)
%shading interp
%set(gca,'View',[0 90]);
title('QR vs SVD of V comparison including reshape')
ylabel('$\frac{d_{k}}{2}$')
xlabel('$\frac{d_{opt}}{2}$')
%%
export_fig(sprintf('%sQR vs SVD for V',saveto),'-transparent','-png','-eps')
%% Plot Data for A
saveto = '..\Presentations\20140206 - Summary\';
surf(tAQRave)
hold on
surf(tASVDave)
set(gca,'View',[50 30]);
title('QR vs SVD of A comparison including reshape')
ylabel('$\frac{D}{2}$')
xlabel('$\frac{d_{opt}}{2}$')
%% print(gcf, [saveto,'VmatScaled',num2str(i),'.eps'],'-deps')
export_fig(sprintf('%sQR vs SVD for A',saveto),'-transparent','-png','-eps')