1

I am using the following function to block diagonalize antisymmetric matrices.

function [R, RI , S ] = Matrix_block (A)
[U,D]= schur (A);
E=ordeig(double(D)) ;
[R, S]= ordschur (U,D, abs(E)<1000*eps ) ;
RI=R';

The code works perfectly fine for real antisymmetric matrices but fails for complex antisymmetric matrices as follows :-

a = rand(6); a = a-a'; [r,ri,s] = Matrix_block(a); 
b = rand(6)+1i*rand(6); b= b-conj(b)'; [r,ri,s] = Matrix_block(b); 

How can I correct my code for it to work also for complex matrices ? I want a block-diagonal matrix (of the following form) as the output for both real and complex matrices.

     0        e1   -0.0000   -0.0000    0.0000   -0.0000
    -e1        0    0.0000    0.0000   -0.0000    0.0000
     0         0   -0.0000    e2        0.0000   -0.0000
     0         0       -e2   -0.0000    0.0000   -0.0000
     0         0         0         0   -0.0000    e3
     0         0         0         0    -e3      -0.0000
cleanplay
  • 271
  • 4
  • 14
  • `b= b-conj(b)';` http://stackoverflow.com/questions/25150027/using-transpose-versus-ctranspose-in-matlab – Yvon Aug 13 '14 at 07:20
  • Add some expected output for both real and complex anti-symmetric matrices. – gire Aug 13 '14 at 08:00

1 Answers1

0

You need a different algorithm for the complex case. The Matlab documentation says:

If A is complex, schur returns the complex Schur form in matrix T. The complex Schur form is upper triangular with the eigenvalues of A on the diagonal.

Also, I could notice that you cast your matrix D into double(D). This has no real effects since D is already double. Nevertheless I have seen that the ordeig return different values for the eigenvalues depending if you input D or double(D) even for the real case. It is something to dig more deeply.

gire
  • 1,105
  • 1
  • 6
  • 16