⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vsblockc.m

📁 Sparse Signal Representation using Overlapping Frames (matlab toolbox)
💻 M
字号:
function W=VSblockC(X,F,S,VSalg,B,el,Bf)% VSblockC  Vector Selection for block-oriented frame, (special version)%           which use a compiled C++ program to do the actual work.
% The interface of this variant is much simpler than the VSblock function in FrameTools% with fewer possibilities to specify how vector selection is to be done.
% If this function does not work as needed, or if it gives any errors,% you should use VSblock in FrameTools or for overlapping frames the% function VSolap1. %
% W=VSblockC(X,F,S,VSalg);       
% W=VSblockC(X,F,S,'VSps',M);       % algorithm may be gived as a string%--------------------------------------------------------------------------------
% arguments:
%  W     - The weight matrix, W is a sparse matrix of size KxL
%  X     - The signal reshaped into blocks of length N, size NxL
%  F     - The frame of synthesis vectors (dictionary), size NxKx1  (P==1)
%          the vectors of F must be normalized, F(:,k)'*F(:,k)==1 for all k
%  S     - the third input argument is here DIFFERENT from in the FrameTools function%          S is number of vectors to select for each coulmn vector in X%  M     - number of combinations to search in VSps
%  VSalg - A number (or string) indicating which vector selection algorithm to use in VSblock.exe%          1 - Basic Matching Pursuit%          2 - Matching Pursuit (main loop is done more times)%          3 - Matching Pursuit (main loop is done even more times)%          4 - Orthogonal Matching Pursuit%          5 - Order Recursive Matching Pursuit%          6 - Partial Search %          7 - Always Better.  The previous weights must be written%          to file filW before this function is called.%--------------------------------------------------------------------------------

%--------------------------------------------------------------------------------
% Copyright (c) 2000.  Karl Skretting.  All rights reserved.
% Hogskolen in Stavanger (Stavanger University), Signal Processing Group
% Mail:  karl.skretting@tn.his.no   Homepage:  http://www.ux.his.no/~karlsk/
% 
% HISTORY:  dd.mm.yyyy
% Ver. 1.0  15.05.2003  KS: VSblockC.m based on ..\FrameTools\VSblock% Ver. 1.1  06.06.2003  KS: also VSps works!% Ver. 1.2  11.06.2003  KS: added VSab%--------------------------------------------------------------------------------

Mfile='VSblockC';
Display=0;        % decide if function display information
Pathst=which(Mfile);   % use catalog where this m-file is stored in, VSblockC.exe should also be herei=find(Pathst=='\');i=i(length(i));Pathst=Pathst(1:i);% but these files should be in work directoryfilF='filF.dat';    filX='filX.dat';filW='filW.dat';filUt=[Mfile,'.log'];if (nargin>5)    disp('Perhaps you intended to use VSblock in FrameTools?');     warning([Mfile,' should have 4 or 5 arguments, see help.']);endif (nargin==5)    M=B;else    M=20;endif (nargin<4)    error([Mfile,' should have 4 arguments, see help.']);end% disp(VSalg);if isnumeric(VSalg)     Alg=floor(VSalg);     if ((Alg<0) | (Alg>7)); Alg=0; end;else    switch lower(VSalg)        case {'vsmp','mp'}; Alg=1;        case {'vsmp2','mp2'}; Alg=2;        case {'vsmp3','mp3'}; Alg=3;        case {'vsomp2','omp2','vsomp','omp'}; Alg=4;        case {'vsfomp2','fomp2','vsfomp','fomp','vsormp','ormp'}; Alg=5;        case {'vsps','ps'}; Alg=6;        case {'vsab','ab'}; Alg=7;        otherwise Alg=0;    endendif (Alg==0)    warning([Mfile,' unknown Vector Selection Algorithm, use Basic Matching Pursuit.']);    Alg=1;endS=S(1);[n,L]=size(X);
[N,K,P]=size(F);           if P>1   error([Mfile,': P>1, VSolap1 or VSolap2 should be used for overlapping frame.']);endif n~=N   error([Mfile,': size of X and F do not correspond, see help.']);end   % write variables to filesfid = fopen(filF,'wb');fwrite(fid,N,'int');    % 32 bitfwrite(fid,K,'int');  fwrite(fid,P,'int');  fwrite(fid,F,'float');fclose(fid);fid = fopen(filX,'wb');fwrite(fid,X,'float');fclose(fid);%arguments=[' A',int2str(Alg),' S',int2str(S),' M',int2str(M),' F',filF,' X',filX,' W',filW];if (Display == 0) arguments=[arguments,' >>',filUt]; end;system([Pathst,Mfile,arguments]);   % do the work!%if exist(filW,'file')    fid = fopen(filW,'rb');    W=fread(fid,[K,L],'float');    fclose(fid);else    W=zeros(K,L);endW=sparse(W);
return

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -