function pot = mk_cgpot(dmembers, cmembers, node_sizes, subtype)
% MK_CG_POT Make a Conditional Gaussian potential.
% pot = mk_cgpot(dmembers, cmembers, node_sizes, subtype)

pot.ddom = dmembers;
pot.cdom = cmembers;
pot.domain = union(dmembers, cmembers);
%pot.sizes = node_sizes(pot.domain);
pot.dsizes = node_sizes(pot.ddom);
pot.dsize = prod(node_sizes(pot.ddom));
pot.csizes = node_sizes(pot.cdom);
if isempty(pot.cdom)
  pot.csize = 0;
else
  pot.csize = sum(node_sizes(pot.cdom));
end
pot.type = 'cg';
pot.subtype = subtype;
pot.pot = cell(1,pot.dsize);
n = pot.csize;

if subtype=='m'
  for i=1:pot.dsize
    pot.pot{i}.logp = 0;
    pot.pot{i}.mu = zeros(n,1);
    pot.pot{i}.Sigma = zeros(n,n);
  end
else
  for i=1:pot.dsize
    pot.pot{i}.g = 0;
    pot.pot{i}.h = zeros(n,1);
    pot.pot{i}.K = zeros(n,n);
  end
end


