function atom_probs = BR_cc_probs2ap(cc_probs)
% BR_cc_probs2ap - determine atom probabilities from CC probs
% On input:
%     cc_probs (2^nx1 vector): complete conjunction set probabilities
% On output:
%     atom_probs (nx1 vector): atom probabilities
% Call:
%     ap = BR_cc_probs2ap(cc_probs);
% Author:
%     T. Henderson
%     UU
%     Fall 2017
%

n = log2(length(cc_probs));

atom_probs = zeros(n,1);

for c = 0:2^n-1
    bits = BR_int2bits(c,n);
    for b = 1:n
        if bits(b)==1
            atom_probs(b) = atom_probs(b) + cc_probs(c+1);
        end
    end
end
