


bpdq_quantize : Uniform scalar quantization xq = bpdq_quantize(x,alpha) Performs uniform quantization with bin width alpha aligned so that bin edges are ... -2*alpha, -alpha , 0 , alpha ,2*alpha ,... Scalar quantization is applied independently to each component of input vector. Quantized values take center of bin to which they belong e.g. so that Qd(0.1,1)=0.5 Input may be complex, in which case quantization is applied to real and imaginary parts independently Inputs : x - vector input alpha - scalar quantization bin width Outputs : xq - quantized output This file is part of BPDQ Toolbox (Basis Pursuit DeQuantizer) Copyright (C) 2009, the BPDQ Team (see the file AUTHORS distributed with this library) (See the notice at the end of the file.)


0001 % bpdq_quantize : Uniform scalar quantization 0002 % 0003 % xq = bpdq_quantize(x,alpha) 0004 % 0005 % Performs uniform quantization with bin width alpha 0006 % aligned so that bin edges are 0007 % ... -2*alpha, -alpha , 0 , alpha ,2*alpha ,... 0008 % 0009 % Scalar quantization is applied independently to each component of 0010 % input vector. 0011 % 0012 % Quantized values take center of bin to which they belong 0013 % e.g. so that Qd(0.1,1)=0.5 0014 % 0015 % Input may be complex, in which case quantization is applied to 0016 % real and imaginary parts independently 0017 % 0018 % Inputs : 0019 % x - vector input 0020 % alpha - scalar quantization bin width 0021 % 0022 % Outputs : 0023 % xq - quantized output 0024 % 0025 % This file is part of BPDQ Toolbox (Basis Pursuit DeQuantizer) 0026 % Copyright (C) 2009, the BPDQ Team (see the file AUTHORS distributed with 0027 % this library) (See the notice at the end of the file.) 0028 0029 function xq = bpdq_quantize(x,alpha) 0030 if isreal(x) 0031 xq=alpha*floor(x/alpha) + alpha/2; 0032 else 0033 xq=bpdq_quantize(real(x),alpha)+i*bpdq_quantize(imag(x),alpha); 0034 end 0035 0036 % The BPDQ Toolbox is free software: you can redistribute it and/or modify 0037 % it under the terms of the GNU General Public License as published by 0038 % the Free Software Foundation, either version 3 of the License, or 0039 % (at your option) any later version. 0040 % 0041 % The BPDQ Toolbox is distributed in the hope that it will be useful, 0042 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0043 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0044 % GNU General Public License for more details. 0045 % 0046 % You should have received a copy of the GNU General Public License 0047 % along with The BPDQ Toolbox. If not, see <http://www.gnu.org/licenses/>.