function [AT,BT,CT] = dshift_care2(A,B,C,v,eta) % [AT,BT,CT]=DSHIFT_CARE2(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); s = v1'*v2; if s == 0 error('v1 is orthogonal to v2: shift is impossible') end v1 = v1/s; v2 = v2/s; AT = A; BT = B - eta*v1*v1'; CT = C - eta*v2*v2';