# How to use Givens rotation for complex matrix?

I have a $$A$$ an hermitian matrix and i want to tridiagonalize it with givens rotation.

I found this : QR factorization of complex matrix

I try it with this matrix :

$$A = \begin{bmatrix} 4 & 2+3i & 1+4i \\ 2-3i & 5 & 2+i \\ 1-4i & 2-i & 6 \end{bmatrix}$$

I want to put a 0 at position $$A_{13}$$ using $$A_{12}$$ as a pivot. I computed $$s$$ and $$c$$ as following : \begin{align} norm &= \sqrt{|c_0|^2 + |s_0|^2} = \sqrt{\sqrt{(2^2+(-3^2)}^2 + \sqrt{1^2+(-4^2)}^2}=5.48\\ s_0 &= \bar A_{13} = 1-4i \\ c_0 &= \bar A_{12} = 2-3i\\ \Rightarrow c &= \frac{c_0}{norm}=\frac{2-3i}{5.48}= 0.37-0.55i \\ \Rightarrow s &= \frac{s_0}{norm}=\frac{1-4i}{5.48}=0.18-0.73i \\ \end{align}

I can now construct my rotation matrix :

$$G = \begin{bmatrix} 1 & 0 & 0 \\ 0 & c & s \\ 0 & -\bar{s} & \bar{c} \end{bmatrix} = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 0.37-0.55i & 0.18-0.73i \\ 0 & -0.18 -0.73i & 0.37+0.55i\end{bmatrix}$$

In order to put the 0 at position $$A_{13}$$ i have to do $$A_{new} = S^{\dagger }*A*S$$

I dont know why that doesnt work. I have written a matlab script :

A =    [ 4   , 2+3i, 1+4i;
2-3i, 5   , 2+1i;
1-4i, 2-1i, 6];

fprintf('\n keyElement = s_0  = %8.2f + %8.2fi\n', real(A(1,3)), imag(A(1,3)));
fprintf('\n pivotElement = c_0  = %8.2f + %8.2fi\n', real(A(1,2)), imag(A(1,2)));

s_0 = conj(A(1,3));
c_0 = conj(A(1,2));
fprintf('\n s_0 value = %8.2f + %8.2fi\n', real(s_0), imag(s_0));
fprintf('\n c_0 value = %8.2f + %8.2fi\n', real(c_0), imag(c_0));

norm = sqrt(abs(c_0).^2+abs(s_0).^2);
fprintf('\n norm value : %8.2f\n', norm);

c = c_0 / norm;
s = s_0/ norm;
fprintf('\n c value = %8.2f + %8.2fi\n', real(c), imag(c));
fprintf('\n s value = %8.2f + %8.2fi\n', real(s), imag(s));

G = [ 1, 0, 0;
0, c, s;
0, -(conj(s)), conj(c);];
fprintf('\n rotation matrix \n');
disp(G);

test = G'*A*G;
disp(test);


And the output is : $$test = \begin{bmatrix} 4 & 5.11-1.46i & 0.73+1.09i \\ 5.11-1.46i & 7.63 & 0.06+0.83i \\ 0.73-1.09i & 0.06-0.83i & 3.37 \end{bmatrix}$$

while I would have liked to have this : $$test = \begin{bmatrix} * & * & 0 \\ * & * & * \\ 0 & * & * \end{bmatrix}$$

The formula for $$s$$ is $$-b/r$$. You have forgotten the minus sign. Also, if you want to see the result of the Givens rotation, you need $$G*A$$, not $$G'AG$$. Lastly, Matlab has built in functionality for givens rotations, under the name 'planerot'. See my script below:

A = [ 4 , 2+3i, 1+4i; 2-3i, 5 , 2+1i; 1-4i, 2-1i, 6];

G = eye(3); G(2:3,2:3) =planerot([2-3i;1-4i]); G*A

The formula for s should include a negative sign: $$s = -\frac{\overline{A_{13}}}{\text{norm}}$$`

To see the result of the given rotation, you need to compute $$G^H A, \text{ not } G' A G.$$

The idea is to tridiagonalize a matrix in order to apply a Cuppen's algorithm to compute the eigenvalues and eigenvectors of the original matrix. That's why I do $$G'AG$$ to maintain the similarity of the matrix, thus preserving the eigenvalues of $$A$$ .

In fact, my error comes from my pivot; when using a horizontal pivot I need to apply this rotation matrix : $$G = \begin{bmatrix} 1 & 0 & 0 \\ 0 & -\bar{s} & c \\ 0 & \bar{c} & s \end{bmatrix}$$

And when i do this on my $$A$$ matrix i have this in result : $$A = \begin{bmatrix} 4 & 5.48 & 0 \\ 5.48 & 7.77 & -0.33-0.33i \\ 0 & -0.33-0.33i & 3.23 \end{bmatrix}$$