end % default value

% if no input arguments, create random policy parameters and check derivatives
if nargin == 0
  D = 2;
  d = 3;
  policy.w = randn(D,d);
  policy.b = randn(D,1);
  m = randn(d,1);
  s = randn(d); s = s*s';
  policy.maxU = '2 3';
  policy.fcn = @(policy, m, s)conCat(@conLin, @gSat, policy, m, s);
end

D = length(policy.maxU);
d = length(m);

switch deriv
  case 'dMdm'
      [dd dy dh] = checkgrad(@conT0, m, delta, policy, s);

  case 'dSdm'
      [dd dy dh] = checkgrad(@conT1, m, delta, 