function B = Quntze(A,M)

% This function will take the minimum and maximum of the input
% matrix A and normalize the matrix, so the elements are between
% 0 and 1.  Then it will map the values onto the Bit Mask.

n = length(A);
for i = 1:n
   for j = 1:n
      B(i,j) = round(A(i,j)*2^M(i,j));
   end
end