function w = mixmlppak(net)
%mixmlppak Combines weights and biases of a gated experts model into one weight vector.
%
%       W = MIXMLPPAK(NET) takes a gated experts data structure NET and 
%       combines the component weight matrices and bias vectors into a 
%       single row vector W. The facility to switch between these two
%       representations for the network parameters is useful, for example,
%       in training gated experts by error function minimization, since a 
%       single vector of parameters can be handled by general-purpose
%       optimization routines. 
%
%       See also
%       mlppak, mixmlp, mixmlpunpak, mixmlpfwd, mixmlperr, mixmlpgrad
%
%       Copyright: Perry Moerland


% Check arguments for consistency
errstring = consist(net, 'mixmlp');
if ~isempty(errstring);
  error(errstring);
end

w = [];

for i=1:net.nexp
  % expert network is MLP
  temp = mlppak(net.exp(i));
  w = cat(2,w,temp);
end;

% gating network is MLP
temp = mlppak(net.gate);
w = cat(2,w,temp);



