资源简介
基于线性Bregman迭代的矩阵补全MATLAB代码实现,其中包含固定步长和变步长的线性Bregman。

代码片段和文件信息
% Comparison of different linearized Bregman approaches on recovering a sparse solution x from Ax = b
% The nonzero entries of x have iid Gaussian random values
% The entries of A are +/- 1 randomly
clear
%% Generate problem data
rand(‘seed‘ 0); randn(‘seed‘ 0);
m = 250; n = 500; % matrix dimension m-by-n
k = 25; % sparsity
A = sign(randn(mn)); % random matrix
x_ref = zeros(n1); % true vector
x_ref(randsample(nk)) = randn(k1); % Gaussian random values
b = A*x_ref; % finish generating equations Ax = b
%% set parameters
alpha = 5*norm(x_refinf); % don‘t need to be exact roughly 1 - 10 times norm(x_refinf) is fine
opts.tol = 1e-6; % stop once norm(Ax-b) opts.maxit = 2000; % run maximally 1000 iterations
opts.x_ref = x_ref;
%% LBreg: fixed stepsize ---
opts.stepsize = 2/alpha/normest(A*A.‘1e-2); % roughly 2/alpha/norm(A)^2
t0 = tic;
[xout] = lbreg_fixedstep(Abalphaopts);
time = toc(t0);
fprintf(‘iter = %d time = %4.2e ‘ out.iter time);
fprintf(‘solution relative error = %4.2e\n‘ norm(x - x_ref)/norm(x_ref));
opts = rmfield(opts ‘stepsize‘);
%% LBreg: Barzilai-Borwein and non-montone line search ---
opts.stepsize = 2/alpha/normest(A*A.‘1e-2); % roughly 2/alpha/norm(A)^2
t0 = tic;
[x1out1] = lbreg_bbls(Abalphaopts);
time = toc(t0);
fprintf(‘iter = %d time = %4.2e ‘ out1.iter time);
fprintf(‘solution relative error = %4.2e\n‘ norm(x1 - x_ref)/norm(x_ref));
opts = rmfield(opts ‘stepsize‘);
%% LBreg: accelerated no restart ---
t0 = tic;
[x2out2] = lbreg_accelerated(Abalphaopts);
time = toc(t0);
fprintf(‘iter = %d time = %4.2e ‘ out2.iter time);
fprintf(‘solution relative error = %4.2e\n‘ norm(x2 - x_ref)/norm(x_ref));
%% LBreg: skip: monotonic gradient scheme ---
opts.reset = 6;
t0 = tic;
[x3out3] = lbreg_accel_w_reset(Abalphaopts); % no restart
time = toc(t0);
fprintf(‘iter = %d time = %4.2e ‘ out3.iter time);
fprintf(‘solution relative error = %4.2e\n‘ norm(x3 - x_ref)/norm(x_ref));
opts = rmfield(opts ‘reset‘);
%% Reporting
figure;
plot(1:out.iter out.hist_obj ‘k-‘ ...
1:out1.iter out1.hist_obj ‘b--‘ ...
1:out2.iter out2.hist_obj ‘g--‘ ...
1:out3.iter out3.hist_obj ‘r--‘ ...
‘LineWidth‘ 2);
legend(‘fixed stepsize‘ ‘BB+line search‘ ‘Nesterov accel‘ ‘Nesterov+skip‘‘Location‘‘SouthEast‘);
title(‘Dual objective‘)
xlabel(‘iteration‘); ylabel(‘dual objective‘);
figure;
semilogy(1:out.iter out.hist_err/norm(x_ref) ‘k-‘ ...
1:out1.iter out1.hist_err/norm(x_ref) ‘b--‘ ...
1:out2.iter out2.hist_err/norm(x_ref) ‘g--‘ ...
1:out3.iter out3.hist_err/norm(x_ref) ‘r--‘ ...
‘LineWidth‘ 2);
legend(‘fixed stepsize‘ ‘BB+line search‘ ‘Nesterov accel‘ ‘Nesterov+skip‘‘Location‘‘NorthEast‘);
title(‘Primal solution relative error‘)
xlabel(‘iteration‘); ylabel(‘||x - x_{ref}||_2/||x_{ref}||_2‘);
%%
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3090 2018-03-30 21:36 MC_ibreg\comparison_bernoulli_A_test1.m
文件 3096 2018-03-30 21:35 MC_ibreg\comparison_bernoulli_A_test2.m
文件 2986 2018-03-30 21:28 MC_ibreg\comparison_binary_sol_test1.m
文件 2992 2018-03-30 21:27 MC_ibreg\comparison_binary_sol_test2.m
文件 3578 2018-03-30 21:08 MC_ibreg\comparison_matrix_completion.m
文件 3582 2018-04-24 15:02 MC_ibreg\comparison_matrix_completion_3.m
文件 3148 2018-03-30 21:35 MC_ibreg\comparison_pdct_A_test1.m
文件 3154 2018-03-30 21:34 MC_ibreg\comparison_pdct_A_test2.m
文件 1345 2018-04-24 15:04 MC_ibreg\example_binary_sol.m
文件 1401 2018-04-24 15:04 MC_ibreg\example_randn_sol.m
文件 4658 2018-03-30 21:30 MC_ibreg\lbreg_accelerated.m
文件 7110 2018-03-30 21:31 MC_ibreg\lbreg_accel_w_reset.m
文件 5487 2018-03-30 21:02 MC_ibreg\lbreg_bbls.m
文件 3957 2018-03-30 21:00 MC_ibreg\lbreg_fixedstep.m
文件 7463 2018-03-30 21:35 MC_ibreg\lbreg_mtx_accel_w_reset.m
文件 5870 2018-03-30 21:35 MC_ibreg\lbreg_mtx_bbls.m
文件 4293 2018-03-30 21:36 MC_ibreg\lbreg_mtx_fixedstep.m
目录 0 2018-04-24 15:04 MC_ibreg
----------- --------- ---------- ----- ----
67210 18
相关资源
- 串行级联cpm系统MATLAB仿真
- matlab_OFDM调制解调(来自剑桥大学)
- Matlab路面裂缝识别69319
- 高灵敏度GPS接收机MATLAB仿真,附捕获
- 基于MATLAB的质点弹道计算与外弹道优
- 阵列天线的matlab仿真
- MATLAB 经典程序源代码大全
- MATLAB小波软阈值去噪代码33473
- 天线阵的波束形成在MATLAB仿真程序及
- 非线性SVM算法-matlab实现
- 《MATLAB 智能算法超级学习手册》-程序
- 组合导航matlab程序
- 读取txt文件内容matlab代码实现
- Matlab实现基于相关的模板匹配程序
- matlab优化工具箱讲解
- 基于MATLAB的快速傅里叶变换
- 光纤传输中的分布傅立叶算法matlab实
- 基于matlab的图像处理源程序
- matlab 椭圆拟合程序
- 算术编码解码matlab源代码
- optical_flow 光流法 matlab 实现程序
- 引导图像滤波器 Matlab实现
- 分形几何中一些经典图形的Matlab画法
- OFDM系统MATLAB仿真代码
- SVM工具箱(matlab中运行)
- 图像小波变换MatLab源代码
- LU分解的MATLAB实现
- 冈萨雷斯数字图像处理matlab版(第三
- 替代数据法的matlab程序
- 用matlab实现的多站定位系统性能仿真
评论
共有 条评论