function [qt] = q2qt(q,L);
% [qt] = q2qt(q,L);
% PURPOSE:
% Make extended weight matrix qt=tilde(q), i.e. qt a block diagonal
% matrix with q on the diagonal.
%

[nc,nr]=size(q);
qt=zeros(nc*L,nr*L);
%
for i=1:L
  for j=1:L
    if i==j
     qt((i-1)*nc+1:i*nc,(j-1)*nr+1:j*nr)=q;
    end
  end
end
%
% END FUNCTION Q2QT