EigenVe2(M) = Eigenvectors of square matrix M by SVD


EigenVe2(M) = Eigenvectors of square matrix M by SVD:

Ve = EigenVe2(M) // V = eigenvectors of M by SVD
{
   P = CharPoly(M) // P = Characteristic polynomial of square matrix M
   R = PolRoots(P) // R = All of the roots of polynomial P
   f = 1
   for (i = M.n − 1; i >= 1; i−−) // Delete roots that are
duplicates
      if (r[i] == r[i + 1)
         Delete root i from r
   for (i = 1; i <= r.m; i++)
   {
      U = M
      for (j = 1; j <= M.n; j++)  // Subtract i-th root from
         u[j, j] = u[j, j] − r[i] // all diagonal elements of U
      (U, W, V) = SVD(U)          // Decompose U to (U, W, V)
      for (j = M.n; j >= 1; j−−)  // Delete columns of V for W = 0
      {
         if (w[j] != 0)
            Delete column j from matrix V
      }
      for (ci = 1; ci <= V.n; ci++)// Concat Columns of V to Ve
      {
         for (ri = 1; ri <= M.n; ri++)
         {
            Ve[ri, f] = v[ri, ci]
         }
         f++
      }
   }
   for (ci = 1; ci <= M.n; ci++)  // For all columns of Ve
   {
      di = 0
      for (ri = n; ri >= 1; ri−−) // Find last non-zero element
         if (Ve[ri, ci] != 0)     // in this column
         {
            di = Ve[ri, ci]
            break
         }
      if (di == MultiCD.cZero)      // if column is all zeros
      {
         Delete column ci from matrix Ve
      }
      else
      {
         for (ri = 1; ri <= M.n; ri++)   // Make last non-zero element
            Ve[ri, ci] = Ve[ri, ci] / di // equal to one
      }
   }
} // EigenVe2

See: Complex SVD -- Numerical Recipes Forum

Return to Matrix and Polynomial Computations
Return to Harry's Home Page


This page accessed times since September 18, 2006.
Page created by: hjsmithh@sbcglobal.net
Changes last made on Monday, 06-Aug-07 20:22:44 PDT

1