function A = sysmat(B)
% function A = sysmat(B)
## Constructs the lags*nv x lags*nv system matrix for the "stacked" first-order
## version, from the nv x nv x lags array of coefficients By returned by rfvar3.
    n = size(B);
    B = reshape(B, [n(1), n(2) * n(3)]);
    A = [B; eye(n(1)*(n(3)-1), n(2)*n(3))];