function [ystar,cvout,cm]=transformH1(Y,sigma,res)
T=rows(Y);
N=cols(Y);
s12=sigma(1:N,N+1:end);
s12trans=s12';
s22=sigma(N+1:end,N+1:end);
s11=sigma(1:N,1:N);
is22=invpd(s22);    
cm=s12*is22*res';
cv=s11-s12*is22*s12trans;

ystar=Y-cm';
cvout=cv;


