-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtiming_all.m
64 lines (55 loc) · 1.98 KB
/
timing_all.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
function [ data ] = timing_all(G, k, fast)
%TIMING_ALL Function which compute timing for different methods
% Copyright (C) 2016 Johan Paratte, Lionel Martin.
% This file is part of the Reproducible Research code base for the Fast
% Eigenspace Approximation using Random Signals (FEARS) method.
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.
% If you use this code please kindly cite
% Paratte, Johan, and Lionel Martin.
% "Fast Eigenspace Approximation using Random Signals."
% arXiv preprint arXiv:1611.00938 (2016).
% https://arxiv.org/abs/1611.00938
%Eigs
t1 = tic;
[V, D] = eigs(G.L, k, 'sm');
tim = toc(t1);
data.eigs = tim;
%FEARS
clear params_filt;
params_filt.is_exact = 0; % use exact lowpass filtering or polynomial approximation
params_filt.order = 50; % order of the polynomial approx
t1 = tic;
[Bk, approx_U, ~] = gsp_eigenspace_estimation(G, k, params_filt);
tim = toc(t1);
data.our = tim;
%Power method
if ~fast
t1 = tic;
Wk = (speye(G.N) - G.L);
approx_U = (Wk^k)*randn(G.N, k);
[Bk, ~, ~] = svd(approx_U, 'econ');
tim = toc(t1);
data.power = tim;
end
% CSC
param_CSC.poly_order = params_filt.order;
param_CSC.only_features = 1;
param_CSC.lap_type = 'normalized';
G.k = k;
t1 = tic;
CSC(G,param_CSC);
tim = toc(t1);
data.csc = tim;
end