function [B, elapse] = BRE_compress(A, model)
%   This is a wrapper function of Binary Reconstructive Embedding testing.
%
%	Usage:
%	[B,elapse] = BRE_compress(A, model)
%
%	      A: Rows of vectors of data points. Each row is sample point
%     model: The model generated by BRE_learn.
%
%	      B: The binary code of the input data A. Each row is sample point
%    elapse: The coding time (testing time).
%
%
%
%   version 2.0 --Nov/2016 
%   version 1.0 --Jan/2013 
%
%   Written by  Yue Lin (linyue29@gmail.com)
%               Deng Cai (dengcai AT gmail DOT com) 
%                                             


tmp_T = tic;

Ktest = A*model.X';
H_query = zeros(size(A,1),size(model.W,2));
for b = 1:size(model.W,2)
    H_query(:,b) = Ktest(:,model.hash_inds(:,b))*model.W(:,b);
end
B = (H_query>0);

elapse = toc(tmp_T);
end
