aboutsummaryrefslogtreecommitdiff
path: root/l1decode_example.m
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2021-01-29 16:23:05 -0500
committerEugeniy E. Mikhailov <evgmik@gmail.com>2021-01-29 16:23:05 -0500
commit3983eb46023c1edd00617729ba929057fda8d0bd (patch)
tree816ad084f355000656c43da9160f1c257bbb1ddc /l1decode_example.m
downloadl1magic-3983eb46023c1edd00617729ba929057fda8d0bd.tar.gz
l1magic-3983eb46023c1edd00617729ba929057fda8d0bd.zip
Initial import from https://statweb.stanford.edu/~candes/software/l1magic/v1.11
Additional Clean up of Mac dirs and tex generated files
Diffstat (limited to 'l1decode_example.m')
-rw-r--r--l1decode_example.m42
1 files changed, 42 insertions, 0 deletions
diff --git a/l1decode_example.m b/l1decode_example.m
new file mode 100644
index 0000000..dd93302
--- /dev/null
+++ b/l1decode_example.m
@@ -0,0 +1,42 @@
+% l1decode_example.m
+%
+% Test out l1decode code.
+%
+% Written by: Justin Romberg, Caltech
+% Email: jrom@acm.caltech.edu
+% Created: October 2005
+%
+
+path(path, './Optimization');
+
+% source length
+N = 256;
+
+% codeword length
+M = 4*N;
+
+% number of perturbations
+T = round(.2*M);
+
+% coding matrix
+G = randn(M,N);
+
+% source word
+x = randn(N,1);
+
+% code word
+c = G*x;
+
+% channel: perturb T randomly chosen entries
+q = randperm(M);
+y = c;
+y(q(1:T)) = randn(T,1);
+
+% recover
+x0 = inv(G'*G)*G'*y;
+xp = l1decode_pd(x0, G, [], y, 1e-4, 30);
+
+% large scale
+% gfun = @(z) G*z;
+% gtfun = @(z) G'*z;
+% xp = l1decode_pd(x0, gfun, gtfun, y, 1e-3, 25, 1e-8, 200);