% Copyright (C) 2016 by Deanna Needell, Rayan Saab, and Tina Woolf

% This file is part of ''Weighted L1-Minimization for Sparse Recovery under
%                        Arbitrary Prior Information''

% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.

% This program 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 General Public License for more details.

% You should have received a copy of the GNU General Public License
% along with this program.  If not, see <http://www.gnu.org/licenses/>.

% defineMeasurementOperator.m

function [ PHI, R, D ] = defineMeasurementOperator( N, m, vp, hp, sparsityBasis )
% Inputs:
% N  = total number of pixels in frame
% m  = number of measurements
% vp = number of pixels in vertical direction
% hp = number of pixels in horizontal direction
% sparsityBasis.name = name of sparsity basis
%
% Outputs:
% PHI = measurement matrix (i.e., R*D')
% R   = restriction operator
% D   = sparsity basis

switch sparsityBasis.name
    
    case 'DCT'
        % Restricted DCT operator
        rI = randperm(N);
        R = opRestriction(N, rI(1:m)); 
        D = opDCT2(vp, hp);             
        PHI = opFoG(R,D'); 
        
    otherwise
        error('Invalid sparsityBasis.name');
    
end

end

