function pi = compute_pi_mux2(bnode, bnet)

n = bnode.self;

j = bnet.pearl.parent_index{n}(bnode.rgate); % rgate is my j'th parent
m = bnet.pearl.msg{n}.pi_from_parent{j};
pi_from_R = m(:);

j = bnet.pearl.parent_index{n}(bnode.cgate); % cgate is my j'th parent
m = bnet.pearl.msg{n}.pi_from_parent{j};
pi_from_C = m(:);

pi_from_RC = pi_from_R * pi_from_C';

pi_from_inputs = collect_pi_from_inputs_mux2(bnode, bnet);
[nrows ncols] = size(bnode.input);
pi_from_inputs = reshape(pi_from_inputs, [bnode.self_size nrows*ncols]);

pi =  pi_from_inputs * pi_from_RC(:);
