function [x,r,g,info] = spgl1( A, b, tau, sigma, x, options )
%SPGL1 Solve basis pursuit, basis pursuit denoise, and LASSO
%
% [x, r, g, info] = spgl1(A, b, tau, sigma, x0, options)
%
% ---------------------------------------------------------------------
% Solve the basis pursuit denoise (BPDN) problem
%
% (BPDN) minimize ||x||_1 subj to ||Ax-b||_2 <= sigma,
%
% or the l1-regularized least-squares problem
%
% (LASSO) minimize ||Ax-b||_2 subj to ||x||_1 <= tau.
% ---------------------------------------------------------------------
%
% INPUTS
% ======
% A is an m-by-n matrix, explicit or an operator.
% If A is a function, then it must have the signature
%
% y = A(x,mode) if mode == 1 then y = A x (y is m-by-1);
% if mode == 2 then y = A'x (y is n-by-1).
%
% b is an m-vector.
% tau is a nonnegative scalar; see (LASSO).
% sigma if sigma != inf or != [], then spgl1 will launch into a
% root-finding mode to find the tau above that solves (BPDN).
% In this case, it's STRONGLY recommended that tau = 0.
% x0 is an n-vector estimate of the solution (possibly all
% zeros). If x0 = [], then SPGL1 determines the length n via
% n = length( A'b ) and sets x0 = zeros(n,1).
% options is a structure of options from spgSetParms. Any unset options
% are set to their default value; set options=[] to use all
% default values.
%
% OUTPUTS
% =======
% x is a solution of the problem
% r is the residual, r = b - Ax
% g is the gradient, g = -A'r
% info is a structure with the following information:
% .tau final value of tau (see sigma above)
% .rNorm two-norm of the optimal residual
% .rGap relative duality gap (an optimality measure)
% .gNorm Lagrange multiplier of (LASSO)
% .stat = 1 found a BPDN solution
% = 2 found a BP sol'n; exit based on small gradient
% = 3 found a BP sol'n; exit based on small residual
% = 4 found a LASSO solution
% = 5 error: too many iterations
% = 6 error: linesearch failed
% = 7 error: found suboptimal BP solution
% = 8 error: too many matrix-vector products
% .time total solution time (seconds)
% .nProdA number of multiplications with A
% .nProdAt number of multiplications with A'
%
% OPTIONS
% =======
% Use the options structure to control various aspects of the algorithm:
%
% options.fid File ID to direct log output
% .verbosity 0=quiet, 1=some output, 2=more output.
% .iterations Max. number of iterations (default if 10*m).
% .bpTol Tolerance for identifying a basis pursuit solution.
% .optTol Optimality tolerance (default is 1e-4).
% .decTol Larger decTol means more frequent Newton updates.
% .subspaceMin 0=no subspace minimization, 1=subspace minimization.
%
% EXAMPLE
% =======
% m = 120; n = 512; k = 20; % m rows, n cols, k nonzeros.
% p = randperm(n); x0 = zeros(n,1); x0(p(1:k)) = sign(randn(k,1));
% A = randn(m,n); [Q,R] = qr(A',0); A = Q';
% b = A*x0 + 0.005 * randn(m,1);
% opts = spgSetParms('optTol',1e-4);
% [x,r,g,info] = spgl1(A, b, 0, 1e-3, [], opts); % Find BP sol'n.
%
% AUTHORS
% =======
% Ewout van den Berg (ewout78@cs.ubc.ca)
% Michael P. Friedlander (mpf@cs.ubc.ca)
% Scientific Computing Laboratory (SCL)
% University of British Columbia, Canada.
%
% BUGS
% ====
% Please send bug reports or comments to
% Michael P. Friedlander (mpf@cs.ubc.ca)
% Ewout van den Berg (ewout78@cs.ubc.ca)
% 15 Apr 07: First version derived from spg.m.
% Michael P. Friedlander (mpf@cs.ubc.ca).
% Ewout van den Berg (ewout78@cs.ubc.ca).
% 17 Apr 07: Added root-finding code.
% 18 Apr 07: sigma was being compared to 1/2 r'r, rather than
% norm(r), as advertised. Now immediately change sigma to
% (1/2)sigma^2, and changed log output accordingly.
% 24 Apr 07: Added quadratic root-finding code as an option.
% 24 Apr 07: Exit conditions need to guard against small ||r||
% (ie, a BP solution). Added test1,test2,test3 below.
% 15 May 07: Trigger to update tau is now based on relative difference
% in objective between consecutive iterations.
% 15 Jul 07: Added code to allow a limited number of line-search
% errors.
% 23 Feb 08: Fixed bug in one-norm projection using weights. Thanks
% to Xiangrui Meng for reporting this bug.
% 26 May 08: The simple call spgl1(A,b) now solves (BPDN) with sigma=0.
% spgl1.m
% $Id: spgl1.m 1225 2009-01-30 20:36:31Z ewout78 $
%
% ----------------------------------------------------------------------
% This file is part of SPGL1 (Spectral Projected-Gradient for L1).
%
% Copyright (C) 2007 Ewout van den Berg and Michael P. Friedlander,
% Department of Computer Science, University of British Columbia, Canada.
% All rights reserved. E-mail: <{ewout78,mpf}@cs.ubc.ca>.
%
% SPGL1 is free software; you can redistribute it and/or modify it
% under the terms of the GNU Lesser General Public License as
% published by the Free Software Foundation; either version 2.1 of the
% License, or (at your option) any later version.
%
% SPGL1 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 Lesser General
% Public License for more details.
%
% You should have received a copy of the GNU Lesser General Public
% License along with SPGL1; if not, write to the Free Software
% Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
% USA
% ----------------------------------------------------------------------
REVISION = '$Revision: 1017 $';
DATE = '$Date: 2008-06-16 22:43:07 -0700 (Mon, 16 Jun 2008) $';
REVISION = REVISION(11:end-1);
DATE = DATE(35:50);
tic; % Start your watches!
m = length(b);
%----------------------------------------------------------------------
% Check arguments.
%----------------------------------------------------------------------
if ~exist('options','var'), options = []; end
if ~exist('x','var'), x = []; end
if ~exist('sigma','var'), sigma = []; end
if ~exist('tau','var'), tau = []; end
if nargin < 2 || isempty(b) || isempty(A)
error('At least two arguments are required');
elseif isempty(tau) && isempty(sigma)
tau = 0;
sigma = 0;
singleTau = false;
elseif isempty(sigma) % && ~isempty(tau) <-- implied
singleTau = true;
else
if isempty(tau)
tau = 0;
end
singleTau = false;
end
%----------------------------------------------------------------------
% Grab input options and set defaults where needed.
%----------------------------------------------------------------------
defaultopts = spgSetParms(...
'fid' , 1 , ... % File ID for output
'verbosity' , 2 , ... % Verbosity level
'iterations' , 10*m , ... % Max number of iterations
'nPrevVals' , 3 , ... % Number previous func values for linesearch
'bpTol' , 1e-06 , ... % Tolerance for basis pursuit solution
'optTol' , 1e-04 , ... % Optimality tolerance
'decTol' , 1e-04 , ... % Req'd rel. change in primal obj. for Newton
'stepMin' , 1e-16 , ... % Minimum spectral step
'stepMax' , 1e+05 , ... % Maximum spectral step
'rootMethod' , 2 , ... % Root finding method: 2=quad,1=linear (not used).
'activeSetIt', Inf , ... % Exit with EXIT_ACTIVE_SET if nnz same for # its.
'subspaceMin', 0 , ... % Use subspace minimization
'iscomplex' , NaN , ... % Flag set to indicate complex problem
'maxMatvec' , Inf , ... % Maximum matrix-vector multiplies allowed
'weights' , 1 , ... % Weights W in ||Wx||_1
'project'
没有合适的资源?快使用搜索试试~ 我知道了~
资源详情
资源评论
资源推荐
收起资源包目录
1维:logistic混沌.rar_chaos_matlab_压缩感知 混沌_混沌_混沌压缩感知 (111个子文件)
tt2.bmp 448KB
tt3.bmp 445KB
tt9.bmp 427KB
tt4.bmp 417KB
tt25.bmp 405KB
tt1.bmp 398KB
tt5.bmp 397KB
tt21.bmp 374KB
tt26.bmp 350KB
t46.bmp 347KB
tt12.bmp 335KB
tt24.bmp 331KB
t37.bmp 305KB
tt27.bmp 277KB
tt20.bmp 260KB
t50.bmp 254KB
t51.bmp 246KB
t49.bmp 237KB
tt17.bmp 233KB
t66.bmp 229KB
tt15.bmp 211KB
t59.bmp 209KB
t52.bmp 202KB
t42.bmp 198KB
t40.bmp 195KB
t38.bmp 195KB
t39.bmp 193KB
result.bmp 192KB
gnd.bmp 192KB
tt19.bmp 186KB
t43.bmp 153KB
tt14.bmp 150KB
t63.bmp 145KB
t47.bmp 140KB
tt7.bmp 140KB
t60.bmp 138KB
t48.bmp 132KB
t4.bmp 126KB
t27.bmp 123KB
t35.bmp 122KB
t25.bmp 122KB
t11.bmp 116KB
t62.bmp 115KB
t44.bmp 113KB
t36.bmp 111KB
t61.bmp 109KB
t1.bmp 102KB
t31.bmp 99KB
t13.bmp 99KB
t19.bmp 94KB
tt18.bmp 94KB
t28.bmp 90KB
t2.bmp 90KB
t6.bmp 88KB
t3.bmp 87KB
t32.bmp 85KB
t7.bmp 82KB
t16.bmp 82KB
t14.bmp 75KB
t5.bmp 69KB
t17.bmp 68KB
t34.bmp 65KB
t30.bmp 60KB
t22.bmp 58KB
t26.bmp 57KB
t18.bmp 54KB
input.bmp 48KB
t23.bmp 46KB
t21.bmp 40KB
t12.bmp 40KB
t24.bmp 36KB
t20.bmp 18KB
ChangeLog 4KB
COPYING 26KB
README.dat 1KB
spgl1.m 30KB
spgdemo.m 16KB
spgSetParms.m 5KB
Wavelet_OMP.m 3KB
spg_mmv.m 3KB
spg_group.m 2KB
Demo_SR.m 2KB
ScSR.m 2KB
spg_bpdn.m 2KB
spg_lasso.m 2KB
L1QP_FeatureSign_yang.m 2KB
spgsetup.m 2KB
spg_bp.m 2KB
sample_patches.m 2KB
Demo_Dictionary_Training.m 1KB
train_coupled_dict.m 1KB
DWT.m 1KB
rnd_smp_patch.m 756B
Contents.m 697B
Logisticfenchatu.m 634B
logistic1.m 473B
NormL12_project.m 463B
backprojection.m 460B
extr_lIm_fea.m 433B
NormGroupL2_project.m 375B
共 111 条
- 1
- 2
weixin_42651887
- 粉丝: 75
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- C语言基础-C语言编程基础之Leetcode编程题解之第30题串联所有单词的子串.zip
- C语言基础-C语言编程基础之Leetcode编程题解之第29题两数相除.zip
- C语言基础-C语言编程基础之Leetcode编程题解之第28题找出字符串中第一个匹配项的下标.zip
- 实验报告模板(1).docx
- C语言基础-C语言编程基础之Leetcode编程题解之第26题删除有序数组中的重复项.zip
- C语言基础-C语言编程基础之Leetcode编程题解之第25题K个一组翻转链表.zip
- hnu计算机系统作业-计算机系统基础课程大作业.zip
- 树莓派app.apk
- C++的基于同态加密技术的匿名电子投票系统源码.zip
- SW建模格式图.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0