ICode9

精准搜索请尝试: 精确搜索
首页 > 编程语言> 文章详细

Orthogonal Matching Pursuit(OMP)正交匹配追踪算法学习笔记

2019-06-12 10:53:27  阅读:962  来源: 互联网

标签:.% 迭代 Orthogonal residual indx OMP pos Pursuit


最近学习K-SVD算法的过程中,稀疏编码部分使用了OMP追踪算法,特作此总结。求解问题:其中D是过完备的字典,已经给定,Y是原始信号,X待求。OMP算法的本质思想是:以贪婪迭代的方法选择D的列,使得在每次迭代的过程中所选择的列与当前冗余向量最大程度的相关,从原始信号向量中减去相关部分并反复迭代,只到迭代次数达到稀疏度K,停止迭代。核心算法步骤如下:相关Matlab代码如下:function [A]=OMP(D,X,L); %=============================================% Sparse coding of a group of signals based on a given % dictionary and specified number of atoms to use. % ||X-DA||% input arguments: %       D - the dictionary (its columns MUST be normalized).%       X - the signals to represent%       L - the max. number of coefficients for each signal.% output arguments: %       A - sparse coefficient matrix.%=============================================[n,P]=size(X);[n,K]=size(D);for k=1:1:P,    a=[];    x=X(:,k);                            %the kth signal sample    residual=x;                        %initial the residual vector    indx=zeros(L,1);                %initial the index vector
     %the jth iter    for j=1:1:L,                %compute the inner product        proj=D'*residual;                            %find the max value and its index        [maxVal,pos]=max(abs(proj));
        %store the index        pos=pos(1);        indx(j)=pos;                                    %solve the Least squares problem.        a=pinv(D(:,indx(1:j)))*x;    
        %compute the residual in the new dictionary        residual=x-D(:,indx(1:j))*a;    
        %the precision is fill our demand.%         if sum(residual.^2) < 1e-6%             break;%         end    end;    temp=zeros(K,1);    temp(indx(1:j))=a;    A(:,k)=sparse(temp);end;return;

http://blog.sciencenet.cn/blog-810210-653094.html


下一篇:如何在64位Matlab中调用C/C++处理大容量数据(largeArrayDims)

标签:.%,迭代,Orthogonal,residual,indx,OMP,pos,Pursuit
来源: https://blog.csdn.net/zhipao6108/article/details/91491138

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有