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

ystar=Y-cm';
cvout=cv;


