function bnet = send_lambda_msgs_mux(bnode, bnet, S)

n = bnode.self;
ns = bnet.node_sizes;
global scaled
assert(bnet.pearl.computed_lambda(n));
for i=1:length(S)
  p = S(i);
  lam_msg = zeros(ns(p), 1);
  if p == bnode.gate
    for s=1:ns(p)
      j = find_equiv_posns(bnode.input(s), bnode.parents); % s is my j'th parent
      t = bnet.pearl.msg{n}.pi_from_parent{j};
      lam_msg(s) = sum(bnet.pearl.msg{n}.lambda .* t);
    end
  else
    for u=1:ns(p)
      j = find_equiv_posns(p, bnode.input); % p is my j'th input
      t = prod_CPT_and_pi_msgs_mux(bnode, bnet, j, u);
      lam_msg(u) = sum(bnet.pearl.msg{n}.lambda .* t);
    end
  end

  if scaled, lam_msg = normalise(lam_msg); end
  index = bnet.pearl.child_index{p}(n);
  if 0
    bnet.pearl.msg{p}.lambda_from_child{index} = lam_msg;
  else
    old_lam = bnet.pearl.msg{p}.lambda_from_child{index}(:);
    alpha = bnet.pearl.momentum;
    bnet.pearl.msg{p}.lambda_from_child{index} = alpha*old_lam + (1-alpha)*lam_msg;
  end
  bnet.pearl.msg{p}.recvd_lambda_from_child(index) = 1;
end

