function [AT,BT,CT,DT] = shift_nare(A,B,C,D,v,eta)
% [AT,BT,CT,DT]=SHIFT_NARE(A,B,C,D,v,eta) applies the shift technique 
% to the NARE C + XA + DX - XBX = 0
% A, B, C, D: matrix coefficients of the NARE such that  
% H = [A -B; -C -D] is singular
% v: a column vector in the kernel of H
% eta: a scalar 
% AT, BT, CT, DT: matrix coefficients of the new NARE such that  
% [AT -BT; -CT -DT]*v = eta*v
H = [A,-B;-C,-D];
n = size(A,1);
m = size(D,1);
p = v/norm(v)^2;
HT = H + eta*v*p';
AT = HT(1:n,1:n);
BT = -HT(1:n,n+1:n+m);
CT = -HT(n+1:n+m,1:n);
DT = -HT(n+1:n+m,n+1:n+m);
