function Z=create_offdiag_cov_regression(yy)

%input yy is nxT
[n,T]=size(yy);
yyp=yy';


repFilling=repmat(  permute(yyp,[2,3,1]),[1,n,1] );
LinIDFill=find( logical(spblkdiag(repmat(ones(1,n),[1,1,n]))));
yz=zeros(n,n*n,T);
yz(repmat([0:T-1]*(n^3),[n*n,1])+repmat(LinIDFill,[1,T]))=-vec(repFilling);


zz=triu(ones(n))-eye(n);
z=zz(:);
Z=yz(:,logical(z),:);

        

