Power Method Pseudocode for Finding Dominant Eigen Value and Eigen Vector


Earlier in Power Method Algorithm for Finding Dominant Eigen Value and Eigen Vector article we discussed an Algorithm for finding largest Eigen value and corresponding Eigen vector. In this article we are going to develop pseudocode for this method so that it will be easy while implementing on computer.

Pseudocode for Power Method

  1. Start
	
  2. Input:
      a. Order of Matrix (n)
      b. Tolerable Error (e)
	
  3. Read Matrix (A):
      For i = 1 to n
        For j = 1 to n
          Read Ai,j
        Next j
      Next i
  
  4. Read Initial Guess Vector (X):
      For i = 1 to n
        Read Xi
      Next i

  5. Initialize: Lambda_Old = 1

  6. Multiplication (X_NEW = A * X):
      For i = 1 to n
        Temp = 0.0
        For j = 1 to n
          Temp = Temp + Ai,j * Xj
        Next j
        X_NEWi = Temp
      Next i

  7. Replace X by X_NEW:
     For i = 1 to n
       Xi = X_NEWi
     Next i
     
  8. Finding Largest:
      Lambda_New = |X1|
      For i = 2 to n
        If |Xi| > Lambda_New
          Lambda_New = |Xi|
        End If
      Next i

  9. Normalization:
     For i = 1 to n
       Xi = Xi/Lambda_New
     Next i

  10. Display:
      Print Lambda_New
      For i = 1 to n
        Print Xi
      Next i

  11. Checking Accuracy:
       If |Lambda_New - Lambda_Old| > e
         Lambda_Old = Lambda_New
         Goto Step (6)
       End If
  
  12. Stop

  -----------------------------------
  Note: All array indexes are assumed to start from 1.

Recommended Readings

  1. Power Method Algorithm for Finding Dominant Eigen Value and Eigen Vector
  2. Power Method Pseudocode for Finding Dominant Eigen Value and Eigen Vector
  3. Power Method Using C Programming for Finding Dominant Eigen Value and Eigen Vector
  4. Power Method Using C++ Programming (Finding Dominant Eigen Value and Eigen Vector)