function y=apply_prec(x,A, param)
% apply the preconditioner within block GMRES

n=size(param.precond_right1,1);
m=size(param.precond_right2);

if param.prec_shifted
        [param.Q1,param.precond_right1]=schur(param.P1+param.p*eye(size(param.P1)));
end

X=reshape(x,n,m);
X=param.Q1'*X*param.Q2;
X=lyap(param.precond_right1,param.precond_right2,-X);
Y=param.Q1*X*param.Q2';
y=A*Y(:);

 
