function [AT,BT,CT] = dshift_care1(A,B,C,v,eta)
% [AT,BT,CT]=DSHIFT_CARE1(A,B,C,v,eta) applies the double shift technique 
% to the CARE C + XA + A'X - XBX = 0
% A, B, C: matrix coefficients of the CARE such that  H = [A -B; -C -A']
%             has a double eigenvalue equal to zero
% v: a column vector in the right kernel of H
% eta: a scalar 
% AT, BT, CT: matrix coefficients of the new CARE such that  
% [AH -BH; -CH -AH']*v = eta*v
H = [A,-B;-C,-A'];
n = size(A,1);
v1 = v(1:n);
v2 = v(n+1:2*n);
theta = 1/norm(v)^2;
AT = A + eta*(v1*v2' + theta*v1*v1' - theta*v2*v2');
BT = B - eta*(theta*v1*v2' + theta*v2*v1' - v1*v1');
CT = C - eta*(theta*v2*v1' + theta*v1*v2' + v2*v2');
