SPECDIAG is the jSpectral module of jLab.

  SPECDIAG  Diagonalize a 2 x 2 spectral matrix.
   
    [D1,D2,TH,NU,Z]=SPECDIAG(S) for a 2 x 2 spectral matrix S returns the
    eigenvalues D1 and D2 and the angles TH and NU and eigenvector matrix Z
    which diagonalize S according to the decomposition
 
           Z = JMAT2(TH) *  KMAT(PI/4) * JMAT2(NU) 
           S = Z [D1 0; 0 D2] Z'
 
    where JMAT2 is the two by two rotation matrix and KMAT(PI/4) is a
    diagonal matrix with main diagonal [(1+i) (1-i)]/SQRT(2). 
 
    If S is a 2 x 2 x M matrix, then D1, D2, NU, and TH are all Mx1 column
    vectors, and Z is 2 x 2 x M. More generally, if S is 2 x 2 x M x ... N, 
    then D1, D2, NU, and TH are all M x ... N  and Z is 2 x 2 x M x ... N.  
    Note that singleton dimensions will be squeezed out.
   
    [...]=SPECDIAG(S11,S22,S12) also works. In this case all input and
    output variables are matrices of the same size.  Z is not output. 
 
    'SPECDIAG --t' runs some tests.
   
    Usage: [d1,d2,th,nu,z]=specdiag(s);
           [d1,d2,th,nu]=specdiag(s11,s22,s12);
    _________________________________________________________________
    This is part of JLAB --- type 'help jlab' for more information
    (C) 2004--2016 J.M. Lilly --- type 'help jlab_license' for details        

contents | allhelp | index