function X=iterative_sol(eqn, opts,opA,p,opE,C,opC)

if opts.prec_shifted
        [params_innersolver.Q1,params_innersolver.precond_right1]=schur(eqn.P1+p*eye(size(eqn.P1)));
        if ~isfield(eqn,'Q2')
  		 [params_innersolver.Q2,params_innersolver.precond_right2]=schur(eqn.P2);
		 eqn.Q2=params_innersolver.Q2;
	end
else
	if ~isfield(eqn,'Q1')
		[eqn.Q1,eqn.right1]=schur(opts.P1);
            	[eqn.Q2,eqn.right2]=schur(opts.P2);
		%[eqn.P1,eqn.P2]=lu(opts.P);
	end
        params_innersolver.precond_right1=eqn.right1;
        params_innersolver.precond_right2=eqn.right2;
	params_innersolver.Q1=eqn.Q1;
	params_innersolver.Q2=eqn.Q2;

end 
%params_innersolver.precond_right=eqn.P; 

params_innersolver.solver='bgmres';
params_innersolver.tol_res=1e-10;
params_innersolver.verbose=0; 
params_innersolver.max_iterations = 500;

X = block_solve(-(eqn.A_+p*eqn.E_),-C,params_innersolver); 
