-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_aux_CUR_problem_size.m
225 lines (218 loc) · 7.11 KB
/
main_aux_CUR_problem_size.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
clear; close;
addpath('C:\\Users\\yijundong\\Documents\\MATLAB\\lapack')
addpath('/h2/yijun/Documents/MATLAB/lapack')
%%
algos = {'DetCPQR',...
'CPQR',...
'CSCPQR',...
'CPQRstream',...
'CPQRstreamCUR',...
...
'DetLUPP',...
'LUPP',...
'CSLUPP',...
'LUPPstream',...
...
'SVDDEIM',...
'RSVDDEIM',...
'CSSVDDEIM',...
'RSVDDEIMstream',...
...
'LUCP',...
'ACA',...(stream)
'CSLUCP',...(stream)
...
'SVDLS',...
'RSVDLS',...
'CSSVDLS',...
'RSVDLSstream'};
%% Dense matrix scaling
% Target: dense Gaussian PSD matrix
rank = 20;
m_max = 10000;
prob_sizes = (1:10)*1000;
amp = 2;
len = 10;
sig = 1./(1:m_max);
sig(1:len) = sig(1:len)*amp;
test_CUR_problem_size(rank, [], [], 'gpsd', prob_sizes, sig);
%% Sparse matrix scaling
% Target: sparse Laplacian of random weighted graph
rank = 20;
nvertex = (1:10)*floor(2e3);
test_CUR_problem_size(rank, [], [], 'lap', nvertex);
%% load dense scaling data
clear; close;
tag = 'k20_dense-gspd_n20000';
para = load(sprintf('probsizes_%s.mat',tag));
time = load(sprintf('time_%s.mat',tag));
prob_sizes = para.problem_sizes;
% ns = para.num_V;
k = para.rank;
%% dense scaling plot
subplot(1,2,1)
% plot(prob_sizes, time.RSVDDEIM, 'o-', 'LineWidth', 1.5)
hold on
% plot(prob_sizes, time.CSSVDDEIM, 'o-', 'LineWidth', 1.5)
plot(prob_sizes, time.CSSVDDEIMstream, 'o-', 'LineWidth', 1.5)
plot(prob_sizes, time.LUCP, 's-', 'LineWidth', 1.5)
plot(prob_sizes, time.ACA, 's-', 'LineWidth', 1.5)
plot(prob_sizes, time.CSLUCP, 's-', 'LineWidth', 1.5)
plot(prob_sizes, time.CPQR, '^-', 'LineWidth', 1.5)
% plot(prob_sizes, time.CSCPQR, '^-', 'LineWidth', 1.5)
plot(prob_sizes, time.CSCPQRstream, '^-', 'LineWidth', 1.5)
% plot(prob_sizes, time.RSVDLS, 'd-', 'LineWidth', 1.5)
% plot(prob_sizes, time.CSSVDLS, 'd-', 'LineWidth', 1.5)
plot(prob_sizes, time.CSSVDLSstream, 'd-', 'LineWidth', 1.5)
hold off
xlim([prob_sizes(1) prob_sizes(end)])
xlabel('$m$','interpreter','latex')
ylabel('time / sec','interpreter','latex')
legend(...'RSVD-DEIM',...
...'CSSVD-DEIM',...
'Stream-SVD-DEIM',...
'Det-LUCP',...
'LGS-ACA',...
'CS-LUCP',...
'Rand-CPQR',...
...'CS-CPQR',...
'Stream-CPQR',...
...'RSVD-LS',...
...'CSSVD-LS',...
'Stream-SVD-LS',...
'interpreter','latex')
title(sprintf('$m \\times m$ Gaussian SPD matrix with rank $k=%d$ runtime overview',k),...
'interpreter','latex')
set(gca,'FontSize',12)
subplot(1,2,2)
plot(prob_sizes, time.RSVDDEIM, 'o-', 'LineWidth', 1.5)
hold on
plot(prob_sizes, time.CSSVDDEIM, 'o-', 'LineWidth', 1.5)
% plot(prob_sizes, time.LUCP, 's-', 'LineWidth', 1.5)
% plot(prob_sizes, time.ACA, 's-', 'LineWidth', 1.5)
plot(prob_sizes, time.CSLUCP, 's-', 'LineWidth', 1.5)
plot(prob_sizes, time.CPQR, '^-', 'LineWidth', 1.5)
plot(prob_sizes, time.CSCPQR, '^-', 'LineWidth', 1.5)
% plot(prob_sizes, time.CSCPQRstream, '^-', 'LineWidth', 1.5)
plot(prob_sizes, time.RSVDLS, 'd-', 'LineWidth', 1.5)
plot(prob_sizes, time.CSSVDLS, 'd-', 'LineWidth', 1.5)
hold off
xlim([prob_sizes(1) prob_sizes(end)])
xlabel('$n$','interpreter','latex')
ylabel('time / sec','interpreter','latex')
legend('RSVD-DEIM',...
'CSSVD-DEIM',...
...'Det-LUCP',...
...'LGS-ACA',...
'CS-LUCP',...
'Rand-CPQR',...
'CS-CPQR',...
...'Stream-CPQR',...
'RSVD-LS',...
'CSSVD-LS',...
'interpreter','latex')
title(sprintf('$n \\times n$ Gaussian SPD matrix with rank $k=%d$ selected runtime',k),...
'interpreter','latex')
set(gca,'FontSize',12)
%% dense scaling plot: stream
% subplot(1,2,1)
plot(prob_sizes, time.CSSVDDEIMstream, 'o-', 'LineWidth', 1.5)
hold on
plot(prob_sizes, time.CSCPQRstream, '^-', 'LineWidth', 1.5)
plot(prob_sizes, time.CSSVDLSstream, 'd-', 'LineWidth', 1.5)
hold off
xlim([prob_sizes(1) prob_sizes(end)])
xlabel('$m$','interpreter','latex')
ylabel('time / sec','interpreter','latex')
legend('Stream-SVD-DEIM',...
'Stream-CPQR',...
'Stream-SVD-LS',...
'interpreter','latex')
title(sprintf('$m \\times m$ Gaussian SPD matrix with rank $k=%d$ runtime overview',k),...
'interpreter','latex')
set(gca,'FontSize',12)
%% load sparse scaling data
clear; close;
% tag = 'k100_sparse-laplacian_n100000';
tag = 'k200_sparse-laplacian_n200000';
para = load(sprintf('probsizes_%s.mat',tag));
time = load(sprintf('time_%s.mat',tag));
k = para.rank;
ns = para.num_V;
ms = para.num_E;
%% sparse scaling plot
subplot(1,2,1)
plot(ns, time.RSVDDEIM, 'o-', 'LineWidth', 1.5)
hold on
plot(ns, time.CSSVDDEIM, 'o-', 'LineWidth', 1.5)
plot(ns, time.LUCP, 's-', 'LineWidth', 1.5)
plot(ns, time.ACA, 's-', 'LineWidth', 1.5)
plot(ns, time.CSLUCP, 's-', 'LineWidth', 1.5)
plot(ns, time.CPQR, '^-', 'LineWidth', 1.5)
plot(ns, time.CSCPQR, '^-', 'LineWidth', 1.5)
% plot(ns, time.CSCPQRstream, '^-', 'LineWidth', 1.5)
plot(ns, time.RSVDLS, 'd-', 'LineWidth', 1.5)
plot(ns, time.CSSVDLS, 'd-', 'LineWidth', 1.5)
hold off
xlabel('$n$ with $m=5n$','interpreter','latex')
ylabel('time / sec','interpreter','latex')
legend('RSVD-DEIM',...
'CSSVD-DEIM',...
'Det-LUCP',...
'LGS-ACA',...
'CS-LUCP',...
'Rand-CPQR',...
'CS-CPQR',...
...'Stream-CPQR',...
'RSVD-LS',...
'CSSVD-LS',...
'interpreter','latex')
title(sprintf('Random weighted Laplacian $|V|=n,|E|=m$,$k=%d$ runtime overview',k),...
'interpreter','latex')
set(gca,'FontSize',12)
subplot(1,2,2)
plot(ns, time.RSVDDEIM, 'o-', 'LineWidth', 1.5)
hold on
plot(ns, time.CSSVDDEIM, 'o-', 'LineWidth', 1.5)
% plot(ns, time.LUCP, 's-', 'LineWidth', 1.5)
plot(ns, time.ACA, 's-', 'LineWidth', 1.5)
% plot(ns, time.CSLUCP, 's-', 'LineWidth', 1.5)
plot(ns, time.CPQR, '^-', 'LineWidth', 1.5)
plot(ns, time.CSCPQR, '^-', 'LineWidth', 1.5)
% plot(ns, time.CSCPQRstream, '^-', 'LineWidth', 1.5)
plot(ns, time.RSVDLS, 'd-', 'LineWidth', 1.5)
plot(ns, time.CSSVDLS, 'd-', 'LineWidth', 1.5)
hold off
xlabel('$n$ with $m=5n$','interpreter','latex')
ylabel('time / sec','interpreter','latex')
legend('RSVD-DEIM',...
'CSSVD-DEIM',...
...'Det-LUCP',...
'LGS-ACA',...
...'CS-LUCP',...
'Rand-CPQR',...
'CS-CPQR',...
...'Stream-CPQR',...
'RSVD-LS',...
'CSSVD-LS',...
'interpreter','latex')
title(sprintf('Random weighted Laplacian $|V|=n,|E|=m$,$k=%d$ selected runtime',k),...
'interpreter','latex')
set(gca,'FontSize',12)
%% sparse scaling plot: stream
% subplot(1,2,1)
rng=2:length(ns);
plot(ns(rng), time.CSSVDDEIMstream(rng), 'o-', 'LineWidth', 1.5)
hold on
plot(ns(rng), time.CSCPQRstream(rng), '^-', 'LineWidth', 1.5)
plot(ns(rng), time.CSSVDLSstream(rng), 'd-', 'LineWidth', 1.5)
hold off
xlabel('$n$ with $m=5n$','interpreter','latex')
ylabel('time / sec','interpreter','latex')
legend('Stream-SVD-DEIM',...
'Stream-CPQR',...
'Stream-SVD-LS',...
'interpreter','latex')
title(sprintf('Random weighted Laplacian $|V|=n,|E|=m$,$k=%d$ runtime overview',k),...
'interpreter','latex')
set(gca,'FontSize',12)