Skip to content

Instantly share code, notes, and snippets.

@asw456
Forked from dgleich/netflix_svd.m
Created October 20, 2013 11:27
Show Gist options
  • Save asw456/7068308 to your computer and use it in GitHub Desktop.
Save asw456/7068308 to your computer and use it in GitHub Desktop.
%% Read Netflix dataset
A = readSMAT('/scratch/dgleich/netflix/netflix.smat');
k = [10 25 50 100 150 200];
l = size(k,2);
%% Matlab's SVDS
for i= 1:l
tic;
[U,S,V] = svds(A,k(i));
toc
file = strcat('test1_',int2str(k(i)), '.mat');
d = diag(S);
save(file, 'd');
end
%% Using eigs() on A*A'
m = size(A,1);
Cx = @(x) A*(A'*x);
for i= 1:l
tic;
[V D]=eigs(Cx,m,k(i),'LA',struct('issym',1,'disp',0));
toc
file = strcat('test2_',int2str(k(i)), '.mat');
d = diag(D);
save(file, 'd');
end
%% Using Propack.
addpath('/homes/hou13/fall2013/MR_SVD_test/PROPACK/matlab');
m = size(A,1); n = size(A,2);
Ax=@(x) A*x;
Atx=@(x) A'*x;
for i= 1:l
tic;
[UD D VD]=lansvd(Ax,Atx,m,n,k(i),'L');
toc
file = strcat('test3_',int2str(k(i)), '.mat');
d = diag(D);
save(file, 'd');
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment