Skip to content

Instantly share code, notes, and snippets.

@jvlmdr
Last active August 29, 2015 14:19
Show Gist options
  • Save jvlmdr/01d85e3be14c4a60582e to your computer and use it in GitHub Desktop.
Save jvlmdr/01d85e3be14c4a60582e to your computer and use it in GitHub Desktop.
Estimate RIP constant of matrix
n = 100;
m = 50;
A = 1/sqrt(m) * randn(m, n);
K = 10;
rmin = ones(K, 1);
rmax = ones(K, 1);
trials = 1e4;
for k = 1:K
for i = 1:trials
s = randperm(n);
s = s(1:k);
sv = svd(A(:,s));
rmin(k) = min(rmin(k), min(sv));
rmax(k) = max(rmax(k), max(sv));
end
end
alpha = rmax ./ rmin;
eps = (alpha - 1) ./ (alpha + 1);
bar(1:K, eps);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment